@Override public void addDisplayEntity(DisplayEntity ent) { super.addDisplayEntity(ent); // Log the entity's outputs file.format("%n"); logTime = this.getSimTime(); ReportGenerator.printOutputs(file, ent, logTime); // Log the entity's states if (ent instanceof StateEntity) ReportGenerator.printStates(file, (StateEntity) ent); // Empty the output buffer file.flush(); // Send the entity to the next element in the chain this.sendToNextComponent(ent); }
@Override public void earlyInit() { super.earlyInit(); logTime = 0.0d; // Close the file if it is already open if (file != null) { file.close(); file = null; } // Create the report file StringBuilder tmp = new StringBuilder(InputAgent.getReportFileName(InputAgent.getRunName())); tmp.append("-").append(this.getName()); tmp.append(".log"); file = new FileEntity(tmp.toString()); }