use of main.data.XLinkedMap in project Eidolons by IDemiurge.
the class VendorListsPanel method initListMap.
public Map<String, HC_PagedListPanel> initListMap(String tabName) {
List<String> group = getListGroup(tabName);
ArrayList<String> specialLists = new ArrayList<>();
Map<String, HC_PagedListPanel> map = new XLinkedMap<>();
for (String listName : group) {
if (checkSpecial(listName)) {
specialLists.add(listName);
continue;
}
if (!responsive) {
if (!checkList(listName, false)) {
continue;
}
}
if (!showAll) {
if (!checkList(listName, true)) {
continue;
}
}
List<String> types = DataManager.getTypesSubGroupNames(TYPE, listName);
if (Launcher.ILYA_MODE) {
if (TYPE == DC_TYPE.SPELLS || TYPE == DC_TYPE.SKILLS) {
FilterMaster.filterByProp(types, G_PROPS.WORKSPACE_GROUP.getName(), "" + MetaEnums.WORKSPACE_GROUP.DESIGN, TYPE, true);
FilterMaster.filterByProp(types, G_PROPS.WORKSPACE_GROUP.getName(), "" + MetaEnums.WORKSPACE_GROUP.IMPLEMENT, TYPE, true);
FilterMaster.filterByProp(types, PROPS.ITEM_SHOP_CATEGORY.getName(), "" + ItemEnums.ITEM_SHOP_CATEGORY.SPECIAL, TYPE, true);
// so you see, it wouldn't be hard to filter the items for
// each shop in macro
}
}
if (types == null) {
// shot in the leg!
continue;
}
if (types.isEmpty()) {
continue;
}
List<ObjType> data;
// if (checkSpecial(listName))
// data = getSpecialData();
// else {
OBJ_TYPE T = TYPE;
if (T instanceof C_OBJ_TYPE) {
if (tabName.equalsIgnoreCase(DC_TYPE.JEWELRY.getName())) {
T = DC_TYPE.JEWELRY;
}
if (tabName.equalsIgnoreCase(ItemEnums.ITEM_TYPE.ALCHEMY.toString())) {
T = DC_TYPE.ITEMS;
}
// if (TYPE != OBJ_TYPES.SPELLS)
if (tabName.equalsIgnoreCase(ItemEnums.ARMOR_TYPE.LIGHT.toString()) || tabName.equalsIgnoreCase(ItemEnums.ARMOR_TYPE.HEAVY.toString())) {
T = DC_TYPE.ARMOR;
}
}
// TODO is there a
data = DataManager.toTypeList(types, T);
if (getFilter() != null) {
data = getFilter().filter(data);
}
if (getSpecialFilter() != null) {
data = getSpecialFilter().filter(data);
}
if (getSorter() != null) {
try {
Collections.sort(data, getSorter());
} catch (Exception e) {
main.system.ExceptionMaster.printStackTrace(e);
// main.system.ExceptionMaster.printStackTrace(e);
}
}
putList(listName, data, map);
}
for (String listName : specialLists) {
List<ObjType> data = getSpecialData();
if (getSorter() != null) {
Collections.sort(data, getSorter());
}
putList(listName, data, map);
}
return map;
}
use of main.data.XLinkedMap in project Eidolons by IDemiurge.
the class Loader method getPropsFromNode.
private static Map<PROPERTY, String> getPropsFromNode(String sub) {
Node node = XML_Converter.findNode(sub, TypeBuilder.PROPS_NODE);
Map<PROPERTY, String> map = new XLinkedMap<>();
XML_Converter.getNodeList(node).forEach(subNode -> {
PROPERTY prop = ContentManager.getPROP(subNode.getNodeName());
String value = subNode.getTextContent();
map.put(prop, value);
});
return map;
}
use of main.data.XLinkedMap in project Eidolons by IDemiurge.
the class MusicCore method getGroupedView.
public static MusicListPanel getGroupedView(int option, Class<?> constClass) {
if (option == -1) {
return null;
}
PROPERTY filterProp = ContentManager.getPROP(constClass.getSimpleName());
// String[] array = (AHK_Master.qwerty + " " +
// AHK_Master.qwerty.substring(1).toUpperCase() + " 123")
// .split(" ");
String viewName = "All " + StringMaster.getWellFormattedString(constClass.getSimpleName());
Map<String, List<String>> map = new XLinkedMap<>();
List<String> musicConsts = EnumMaster.getEnumConstantNames(constClass);
if (option != 0) {
musicConsts = getMusicConsts(constClass, option);
viewName = getViewName(constClass, option);
}
Map<ObjType, String> multiPropMap = new HashMap<>();
loop: for (String g : musicConsts) {
// map.
List<String> list = new ArrayList<>();
// for (MusicList musList : listTypeMap.values()) {
typeLoop: for (ObjType type : DataManager.getTypes(AT_OBJ_TYPE.MUSIC_LIST)) {
if (type.checkProperty(filterProp, g)) {
if (filterProp.isContainer()) {
containerLoop: for (String sub : StringMaster.open(type.getProperty(filterProp))) {
for (String c : musicConsts) {
if (StringMaster.compare(c, sub)) {
if (c.equalsIgnoreCase(g)) {
break containerLoop;
} else {
multiPropMap.put(type, c);
continue typeLoop;
}
}
}
}
}
list.add(AHK_Master.getScriptLineForList(type));
}
}
map.put(g, list);
}
for (ObjType sub : multiPropMap.keySet()) {
for (String c : map.keySet()) {
if (multiPropMap.get(sub).equals(c)) {
map.get(c).add(AHK_Master.getScriptLineForList(sub));
}
}
}
for (String sub : map.keySet()) {
map.put(sub, new ArrayList<>(new LinkedHashSet<>(map.get(sub))));
}
// TODO adapt to max list size also
int wrap = 5 - map.size() / 2;
MusicListPanel musicListPanel = new MusicListPanel("", null);
G_Panel view = // AHK_Master.getPanel()
musicListPanel.initView(map, false, wrap, musicConsts);
musicListPanel.setView(view);
view.setName(viewName);
return musicListPanel;
}
use of main.data.XLinkedMap in project Eidolons by IDemiurge.
the class VersionMaster method getVersionDifferenceMap.
public static Map<VALUE, String> getVersionDifferenceMap(VERSION_PERIOD period, int n, ArcaneEntity type) {
Map<VALUE, String> map = new XLinkedMap<>();
ObjType oldType = getOlderVersion(type, period, n);
for (PARAMETER p : oldType.getParamMap().keySet()) {
int diff = type.getIntParam(p) - oldType.getIntParam(p);
map.put(p, diff + "");
}
return map;
}
use of main.data.XLinkedMap in project Eidolons by IDemiurge.
the class XML_Reader method constructTypeMap.
private static void constructTypeMap(Document doc, String key, Map<String, Set<String>> tabGroupMap, Map<String, Set<String>> treeSubGroupMap) {
key = key.replace("_", " ").toLowerCase();
LogMaster.log(LogMaster.DATA_DEBUG, "type map: " + key);
Map<String, ObjType> typeMap = typeMaps.computeIfAbsent(key, k -> new XLinkedMap<>());
NodeList nl = doc.getFirstChild().getChildNodes();
Set<String> groupSet = new LinkedHashSet<>();
for (int i = 0; i < nl.getLength(); i++) {
Node node = nl.item(i);
NodeList nl1 = node.getChildNodes();
String aspect = node.getNodeName();
PROPERTY groupingKey = DataManager.getGroupingKey(key);
PROPERTY subGroupingKey = DataManager.getSubGroupingKey(key);
for (int a = 0; a < nl1.getLength(); a++) {
Node typeNode = nl1.item(a);
String name = typeNode.getNodeName();
if ("#text".equals(name)) {
continue;
}
ObjType type = TypeBuilder.buildType(typeNode, key);
if (type != null) {
name = type.getName();
// TAB GROUPS
if (type.getProperty(groupingKey) == null) {
type.setProperty(G_PROPS.ASPECT, aspect);
}
groupSet.add(type.getProperty(groupingKey));
aspect = type.getProperty(groupingKey);
// TREE SUB GROUPS
String subKey = type.getProperty(subGroupingKey);
treeSubGroupMap.computeIfAbsent(aspect, k -> new HashSet<>()).add(subKey);
typeMap.put(name, type);
LogMaster.log(LogMaster.DATA_DEBUG, typeNode.getNodeName() + " has been put into map as " + type);
}
}
}
if (tabGroupMap.get(key) == null) {
tabGroupMap.put(key, groupSet);
} else {
tabGroupMap.get(key).addAll(groupSet);
}
// if (key.equals(StringS.ABILS.getName())) {
// Err.info(set + "");
// }
}
Aggregations