Package jasima.core.util
Class ConsolePrinter
- java.lang.Object
-
- jasima.core.util.ConsolePrinter
-
- All Implemented Interfaces:
ExperimentListener,NotifierListener<Experiment,Experiment.ExperimentEvent>
public class ConsolePrinter extends Object implements ExperimentListener
Prints experiment messages to the console.- Author:
- Torsten Hildebrandt
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jasima.core.experiment.ExperimentListener
ExperimentListener.AfterRunListener, ExperimentListener.BeforeRunListener, ExperimentListener.DoneListener, ExperimentListener.ErrorListener, ExperimentListener.FinallyListener, ExperimentListener.FinishedListener, ExperimentListener.FinishingListener, ExperimentListener.HandleOtherListener, ExperimentListener.InitializedListener, ExperimentListener.MultiExperimentCompletedTaskListener, ExperimentListener.PrintListener, ExperimentListener.ProduceResultsListener, ExperimentListener.RunPerformedListener, ExperimentListener.StartingListener
-
-
Constructor Summary
Constructors Constructor Description ConsolePrinter()ConsolePrinter(MsgCategory logLevel)ConsolePrinter(MsgCategory logLevel, String logFormat)ConsolePrinter(String logFormat)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterRun(Experiment e)voidbeforeRun(Experiment e)voiddone(Experiment e)voiderror(Experiment e, Throwable t)voidfinished(Experiment e, Map<String,Object> results)static StringgetDescription(Experiment e)Returns a textual representation of an experiment's properties and their current values.LocalegetLocale()StringgetLogFormat()MsgCategorygetLogLevel()PrintWritergetOut()voidinitialized(Experiment e)booleanisPrintStdEvents()voidmultiExperimentCompletedTask(Experiment e, Experiment runExperiment, Map<String,Object> runResults)voidprint(Experiment e, ExperimentMessage.ExpPrintMessage event)static voidprintEventList(Simulation sim)Prints the current event list (including the current event) to the console.static voidprintEventList(PrintWriter out, Simulation sim)Prints the current event list (including the current event) to the givenPrintWriter.static voidprintResults(Experiment e, Map<String,Object> res)static voidprintResults(PrintWriter out, Experiment e, Map<String,Object> res)static voidprintResults(PrintWriter out, Map<String,Object> res)static voidprintResults(Map<String,Object> res)voidsetLocale(Locale locale)Sets theLocalethat is used when formatting messages.voidsetLogFormat(String logFormat)voidsetLogLevel(MsgCategory logLevel)voidsetOut(PrintWriter out)Sets thePrintWriterwhere to send output.voidsetPrintStdEvents(boolean printStdEvents)PrintStdEvents determines, if print events for standard events (like experiment starting) should be produced.voidstarting(Experiment e)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jasima.core.experiment.ExperimentListener
finalAction, finishing, handleOther, inform, produceResults, runPerformed
-
-
-
-
Constructor Detail
-
ConsolePrinter
public ConsolePrinter()
-
ConsolePrinter
public ConsolePrinter(MsgCategory logLevel)
-
ConsolePrinter
public ConsolePrinter(String logFormat)
-
ConsolePrinter
public ConsolePrinter(MsgCategory logLevel, String logFormat)
-
-
Method Detail
-
print
public void print(Experiment e, ExperimentMessage.ExpPrintMessage event)
- Specified by:
printin interfaceExperimentListener
-
starting
public void starting(Experiment e)
- Specified by:
startingin interfaceExperimentListener
-
initialized
public void initialized(Experiment e)
- Specified by:
initializedin interfaceExperimentListener
-
beforeRun
public void beforeRun(Experiment e)
- Specified by:
beforeRunin interfaceExperimentListener
-
afterRun
public void afterRun(Experiment e)
- Specified by:
afterRunin interfaceExperimentListener
-
done
public void done(Experiment e)
- Specified by:
donein interfaceExperimentListener
-
finished
public void finished(Experiment e, Map<String,Object> results)
- Specified by:
finishedin interfaceExperimentListener
-
error
public void error(Experiment e, Throwable t)
- Specified by:
errorin interfaceExperimentListener
-
multiExperimentCompletedTask
public void multiExperimentCompletedTask(Experiment e, Experiment runExperiment, Map<String,Object> runResults)
- Specified by:
multiExperimentCompletedTaskin interfaceExperimentListener
-
getLogLevel
public MsgCategory getLogLevel()
-
setLogLevel
public void setLogLevel(MsgCategory logLevel)
-
getLogFormat
public String getLogFormat()
-
setLogFormat
public void setLogFormat(String logFormat)
-
getOut
public PrintWriter getOut()
-
setOut
public void setOut(PrintWriter out)
Sets thePrintWriterwhere to send output. If this is null, print events will be written toSystem.out.- Parameters:
out- ThePrintWriterto use.
-
isPrintStdEvents
public boolean isPrintStdEvents()
-
setPrintStdEvents
public void setPrintStdEvents(boolean printStdEvents)
PrintStdEvents determines, if print events for standard events (like experiment starting) should be produced. Defaults totrue.- Parameters:
printStdEvents- Whether or not to print standard events.
-
getLocale
public Locale getLocale()
-
setLocale
public void setLocale(Locale locale)
Sets theLocalethat is used when formatting messages. The default isLocale.US.- Parameters:
locale- The locale to use.- See Also:
Util#DEF_LOCALE
-
printResults
public static void printResults(@Nullable Experiment e, Map<String,Object> res)
- Parameters:
e- The experiment that was executed.res- The list of results.
-
printResults
public static void printResults(Map<String,Object> res)
- Parameters:
res- The map of results.
-
printResults
public static void printResults(PrintWriter out, @Nullable Experiment e, Map<String,Object> res)
- Parameters:
out- ThePrintWriterto use for printing.e- The experiment that was executed.res- The list of results.
-
printResults
public static void printResults(PrintWriter out, Map<String,Object> res)
- Parameters:
out- ThePrintWriterto use for printing.res- The map of results.
-
printEventList
public static void printEventList(PrintWriter out, Simulation sim)
Prints the current event list (including the current event) to the givenPrintWriter.
-
printEventList
public static void printEventList(Simulation sim)
Prints the current event list (including the current event) to the console.
-
getDescription
public static String getDescription(Experiment e)
Returns a textual representation of an experiment's properties and their current values.- Parameters:
e- The experiment to describe.
-
-