@Override public void infoEmited(SimulationInfo info) { if (info instanceof ElementActionInfo) { final ElementActionInfo elemInfo = (ElementActionInfo) info; final long ts = elemInfo.getTs(); // Only saves information after the warmUp period has passed if (ts > warmUp) { checkPeriod(ts); int infoType; switch (elemInfo.getType()) { case ENDACT: infoType = END; break; case STAACT: infoType = STA; break; case REQACT: infoType = REQ; break; default: infoType = -1; break; } if (infoType != -1) { final Activity act = elemInfo.getActivity(); final Element elem = elemInfo.getElement(); final ElementType et = elem.getType(); actExCounter[infoType][act.getIdentifier()].addExecution(elemInfo.getWorkGroup()); etExCounter[infoType].incrementAndGet(et.getIdentifier()); if (isDebugMode()) { String message = new String(); message += elemInfo.toString() + "\n"; final ActivityCounters counters = actExCounter[infoType][act.getIdentifier()]; message += act.getDescription() + " executed " + counters.exCounter + " times\n"; for (int i = 0; i < act.getWorkGroupSize(); i++) message += "\t with workgroup " + act.getWorkGroup(i).getDescription() + " " + counters.wgExCounter[i] + " times\n"; message += "Type " + et.getDescription() + " executed " + etExCounter[infoType].get(et.getIdentifier()) + " times\n"; debug(message); } } } } else if (info instanceof SimulationEndInfo) { buffer.close(); } else { Error err = new Error("Incorrect info received: " + info.toString()); err.printStackTrace(); } }
public ActivityCounters(Activity act) { wgExCounter = new int[act.getWorkGroupSize()]; }