Finished text parser
This commit is contained in:
parent
d439ac92fc
commit
832ed15060
11 changed files with 323 additions and 127 deletions
|
@ -2,24 +2,31 @@ package WayofTime.alchemicalWizardry.book.registries;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.alchemicalWizardry.book.compact.Category;
|
||||
import WayofTime.alchemicalWizardry.book.compact.Entry;
|
||||
|
||||
public class EntryRegistry {
|
||||
public static void registerCategories(Category category){
|
||||
public class EntryRegistry
|
||||
{
|
||||
public static void registerCategories(Category category)
|
||||
{
|
||||
categories.add(category);
|
||||
categoryMap.put(category.name, category);
|
||||
entryOrder.put(category, new ArrayList());
|
||||
categoryCount++;
|
||||
}
|
||||
public static ArrayList<Category> categories = new ArrayList<Category>();
|
||||
public static HashMap<Category, List<String>> entryOrder = new HashMap();
|
||||
public static HashMap<String, Category> categoryMap = new HashMap<String, Category>();
|
||||
|
||||
public static int categoryCount = 0;
|
||||
|
||||
public static void registerEntry(Category category, HashMap<String, Entry> entryMap, Entry entry){
|
||||
public static void registerEntry(Category category, HashMap<String, Entry> entryMap, Entry entry)
|
||||
{
|
||||
entryMap.put(entry.name, entry);
|
||||
entries.put(category, entryMap);
|
||||
entryOrder.get(category).add(entry.name);
|
||||
|
||||
if(maxEntries.containsKey(category) && entry.indexPage > maxEntries.get(category))
|
||||
maxEntries.put(category, entry.indexPage);
|
||||
|
@ -36,4 +43,26 @@ public class EntryRegistry {
|
|||
public static HashMap<String, Entry> rituals = new HashMap<String, Entry>();
|
||||
public static HashMap<String, Entry> bloodUtils = new HashMap<String, Entry>();
|
||||
|
||||
public static Entry[] getEntriesInOrderForCategory(Category category)
|
||||
{
|
||||
HashMap<String, Entry> entries = EntryRegistry.entries.get(category);
|
||||
List<String> nameList = entryOrder.get(category);
|
||||
|
||||
ArrayList<Entry> list = new ArrayList<Entry>();
|
||||
|
||||
for(String str : nameList)
|
||||
{
|
||||
list.add(entries.get(str));
|
||||
}
|
||||
|
||||
Object[] entriesList = list.toArray();
|
||||
Entry[] entryList = new Entry[entriesList.length];
|
||||
|
||||
for(int i=0; i<entriesList.length; i++)
|
||||
{
|
||||
entryList[i] = (Entry)(entriesList[i]);
|
||||
}
|
||||
|
||||
return entryList;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue