use of fr.guiguilechat.jcelechat.model.sde.npcs.Agent.AGENT_DIVISION in project JCELechat by guiguilechat.
the class MultipleAgentStations method main.
public static void main(String[] args) {
HashMap<String, StationAgentsSummary> summsHS = new HashMap<>();
HashMap<String, StationAgentsSummary> summsLS = new HashMap<>();
HashMap<String, StationAgentsSummary> summsNS = new HashMap<>();
for (Agent a : Agent.load().values()) {
if (a.level >= 3 && a.level < 5 && a.type == AGENT_TYPE.Basic && validDivisions.contains(a.division)) {
SolarSystem solsyst = SolarSystem.load().get(a.system);
Map<String, StationAgentsSummary> dataholder = null;
if (solsyst.isHS()) {
dataholder = summsHS;
}
if (solsyst.isLS()) {
dataholder = summsLS;
}
if (solsyst.isNS()) {
dataholder = summsNS;
}
StationAgentsSummary sum = dataholder.get(a.station);
if (sum == null) {
sum = new StationAgentsSummary();
sum.solsyst = SolarSystem.load().get(a.system);
dataholder.put(a.station, sum);
}
switch(a.division) {
case Distribution:
if (a.level == 3) {
sum.L3D++;
} else {
sum.L4D++;
}
break;
case Mining:
if (a.level == 3) {
sum.L3M++;
} else {
sum.L4M++;
}
break;
case Security:
if (a.level == 3) {
sum.L3S++;
} else {
sum.L4S++;
}
break;
default:
throw new UnsupportedOperationException("case not handled " + a.division);
}
}
}
if (csv) {
System.out.println("region" + csvSeparator + "constellation" + csvSeparator + "solar system" + csvSeparator + "security status" + csvSeparator + "true sec" + csvSeparator + "station" + csvSeparator + "division" + csvSeparator + "level" + csvSeparator + "number");
}
for (HashMap<String, StationAgentsSummary> mmap : Arrays.asList(summsHS, summsLS, summsNS)) {
String secstatus = mmap == summsHS ? "HS" : mmap == summsLS ? "LS" : "NS";
if (!csv) {
System.out.println(secstatus + ":");
}
for (AGENT_DIVISION division : validDivisions) {
for (int level : new int[] { 3, 4 }) {
if (!csv) {
System.out.println(" " + division + " level " + level);
}
mmap.entrySet().stream().sorted((e1, e2) -> e1.getKey().compareTo(e2.getKey())).forEach(e -> {
StationAgentsSummary val = e.getValue();
int nb = val.missions(division, level);
if (nb > 1) {
if (!csv) {
System.out.println(" " + e.getKey() + " : " + nb);
} else {
System.out.println(val.solsyst.region + csvSeparator + val.solsyst.constellation + csvSeparator + val.solsyst.name + csvSeparator + secstatus + csvSeparator + val.solsyst.truesec + csvSeparator + e.getKey() + csvSeparator + division + csvSeparator + level + csvSeparator + nb);
}
}
});
}
}
}
}
Aggregations