use of fr.guiguilechat.jcelechat.model.sde.load.fsd.EtypeIDs in project JCELechat by guiguilechat.
the class CheckESISDE method main.
public static void main(String[] args) {
long start = System.currentTimeMillis();
// first preload everything
Universe universe = ESIStatic.INSTANCE.cache().universe;
Dogma dogma = ESIStatic.INSTANCE.cache().dogma;
MapHolder<Integer, R_get_universe_categories_category_id> catMap = universe.categories().mapItems(catid -> universe.categories(catid)).toMap(h -> h.get().category_id, h -> h.get());
MapHolder<Integer, R_get_universe_groups_group_id> groupMap = universe.groups().mapItems(groupID -> universe.groups(groupID)).toMap(h -> h.get().group_id, h -> h.get());
MapHolder<Integer, R_get_universe_types_type_id> typeMap = universe.types().mapItems(typeID -> universe.types(typeID)).toMap(h -> h.get().type_id, h -> h.get());
MapHolder<Integer, R_get_dogma_attributes_attribute_id> attMap = dogma.attributes().mapItems(typeID -> dogma.attributes(typeID)).toMap(h -> h.get().attribute_id, h -> h.get());
EcategoryIDs.load();
EgroupIDs.load();
EtypeIDs.load();
EdogmaAttributes.load();
long postLoad = System.currentTimeMillis();
System.out.println("loaded in " + (postLoad - start) + "ms");
int errors = 0;
for (Entry<Integer, EcategoryIDs> e : EcategoryIDs.load().entrySet()) {
EcategoryIDs sdeEntry = e.getValue();
R_get_universe_categories_category_id esiEntry = catMap.get().get(e.getKey());
if (sdeEntry.published != esiEntry.published) {
System.out.println("cat=" + e.getKey() + "(" + esiEntry.name + ")" + " esi=" + esiEntry.published + " sde=" + sdeEntry.published);
errors++;
}
}
for (Entry<Integer, EgroupIDs> e : EgroupIDs.load().entrySet()) {
EgroupIDs sdeEntry = e.getValue();
R_get_universe_groups_group_id esiEntry = groupMap.get().get(e.getKey());
if (sdeEntry.published != esiEntry.published) {
System.out.println("group=" + e.getKey() + "(" + esiEntry.name + ")" + " esi=" + esiEntry.published + " sde=" + sdeEntry.published);
errors++;
}
}
for (Entry<Integer, EtypeIDs> e : EtypeIDs.load().entrySet()) {
EtypeIDs sdeEntry = e.getValue();
R_get_universe_types_type_id esiEntry = typeMap.get().get(e.getKey());
if (sdeEntry.published != esiEntry.published) {
System.out.println("type=" + e.getKey() + "(" + esiEntry.name + ")" + " esi=" + esiEntry.published + " sde=" + sdeEntry.published);
errors++;
}
}
Set<Integer> attributeIds = new HashSet<>();
Map<Integer, EdogmaAttributes> attSDEMap = EdogmaAttributes.load();
attributeIds.addAll(attSDEMap.keySet());
attributeIds.addAll(attMap.get().keySet());
for (int attId : attributeIds) {
EdogmaAttributes sdeEntry = attSDEMap.get(attId);
R_get_dogma_attributes_attribute_id esiEntry = attMap.get().get(attId);
if (sdeEntry == null) {
System.out.println("attid=" + attId + " null in SDE, name in ESI=" + esiEntry.name);
errors++;
}
if (esiEntry == null) {
System.out.println("attid=" + attId + " null in ESI, name in SDE=" + sdeEntry.name);
errors++;
}
if (sdeEntry != null && esiEntry != null) {
if (sdeEntry.published != esiEntry.published) {
System.out.println("att=" + attId + "(" + esiEntry.name + ")" + " esi=" + esiEntry.published + " sde=" + sdeEntry.published);
errors++;
}
if (!sdeEntry.name.equals(esiEntry.name)) {
System.out.println("att=" + attId + " esiname=" + esiEntry.name + " sdename=" + sdeEntry.name);
errors++;
}
}
}
System.out.println("found " + errors + " errors in " + (System.currentTimeMillis() - postLoad) + " ms");
}
use of fr.guiguilechat.jcelechat.model.sde.load.fsd.EtypeIDs in project JCELechat by guiguilechat.
the class SDELoader method load.
public static TypeHierarchy load() {
Map<Integer, EdogmaAttributes> attTypes = EdogmaAttributes.load();
TypeHierarchy ret = new TypeHierarchy();
// categories
for (Entry<Integer, EcategoryIDs> e : EcategoryIDs.load().entrySet()) {
CatDetails det = new CatDetails();
det.id = e.getKey();
det.name = e.getValue().enName();
det.published = e.getValue().published;
ret.catID2Details.put(e.getKey(), det);
ret.catID2GroupIDs.put(det.id, new HashSet<>());
}
// groups
for (Entry<Integer, EgroupIDs> e : EgroupIDs.load().entrySet()) {
GroupDetails det = new GroupDetails();
det.id = e.getKey();
det.catID = e.getValue().categoryID;
det.name = e.getValue().enName();
det.published = e.getValue().published;
ret.groupID2Details.put(e.getKey(), det);
ret.groupID2TypeIDs.put(det.id, new HashSet<>());
ret.catID2GroupIDs.computeIfAbsent(e.getValue().categoryID, i -> new HashSet<>()).add(e.getKey());
}
// types
for (Entry<Integer, EtypeIDs> e : EtypeIDs.load().entrySet()) {
TypeDetails det = new TypeDetails();
det.name = e.getValue().enName();
det.id = e.getKey();
det.basePrice = e.getValue().basePrice;
det.marketGroupID = e.getValue().marketGroupID;
det.groupID = e.getValue().groupID;
det.mass = e.getValue().mass;
// no packaged volume in sde ?
det.portionSize = e.getValue().portionSize;
det.published = e.getValue().published;
det.volume = e.getValue().volume;
ret.typeID2Details.put(e.getKey(), det);
ret.groupID2TypeIDs.computeIfAbsent(e.getValue().groupID, i -> new HashSet<>()).add(e.getKey());
}
// Attributes
HashSet<Integer> floatAttributeIds = new HashSet<>();
HashSet<Integer> allAttributesIds = new HashSet<>();
for (Entry<Integer, EtypeDogma> e : EtypeDogma.load().entrySet()) {
int typeID = e.getKey();
TypeDetails td = ret.typeID2Details.get(typeID);
if (td == null) {
td = new TypeDetails();
td.name = "unknown_" + typeID;
ret.typeID2Details.put(typeID, td);
}
EtypeDogma etd = e.getValue();
if (etd.dogmaAttributes != null) {
for (EAttributes tatt : etd.dogmaAttributes) {
int attId = tatt.attributeID;
float value = tatt.value;
td.definition.put(attId, value);
// add the attribute to the list of those with a float value
if ((int) value != value) {
floatAttributeIds.add(attId);
}
allAttributesIds.add(attId);
}
}
}
for (int attId : allAttributesIds) {
EdogmaAttributes eattr = attTypes.get(attId);
AttributeDetails det = new AttributeDetails();
det.defaultValue = eattr.defaultValue;
det.description = eattr.description;
det.hasFloat = floatAttributeIds.contains(attId);
det.highIsGood = eattr.highIsGood;
det.id = attId;
det.name = eattr.name;
det.published = eattr.published;
det.stackable = eattr.stackable;
ret.attID2Details.put(attId, det);
}
return ret;
}
Aggregations