Package adams.flow.execution
Class ExecutionCounter
- java.lang.Object
-
- All Implemented Interfaces:
CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,ShallowCopySupporter<FlowExecutionListener>
,SizeOfHandler
,FlowExecutionListener
,GraphicalFlowExecutionListener
,TimedFlowExecutionListener
,Serializable
,Comparable
public class ExecutionCounter extends AbstractTimedFlowExecutionListenerWithTable
Counts how often an actor was executed.
The final counts can be written to a log file in CSV format.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-update-interval <int> (property: updateInterval) The update interval after which the GUI gets refreshed. default: 100 minimum: 1
-log-file <adams.core.io.PlaceholderFile> (property: logFile) The CSV log file to write to; writing is disabled if pointing to a directory. default: ${CWD}
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,Integer>
m_Counts
keeps track of the execution count (actor name - count).protected PlaceholderFile
m_LogFile
the file to write to.-
Fields inherited from class adams.flow.execution.AbstractTimedFlowExecutionListenerWithTable
m_Counter, m_UpdateInterval
-
Fields inherited from class adams.flow.execution.AbstractFlowExecutionListenerWithTable
m_FileChooser, m_Table
-
Fields inherited from class adams.flow.execution.AbstractGraphicalFlowExecutionListener
m_ListenerPanel
-
Fields inherited from class adams.flow.execution.AbstractFlowExecutionListener
m_Owner
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description ExecutionCounter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanUp()
Cleans up data structures, frees up memory.protected TableModel
createTableModel()
Creates a new table model with the current data.void
defineOptions()
Adds options to the internal list of options.void
finishListening()
Gets called when the flow execution ends.protected int
getDefaultUpdateInterval()
Returns the default update interval.String
getListenerTitle()
The title of this listener.PlaceholderFile
getLogFile()
Returns the log file.String
globalInfo()
Returns a string describing the object.protected void
initialize()
Initializes the members.String
logFileTipText()
Returns the tip text for this property.void
postExecute(Actor actor)
Gets called after the actor was executed.void
setLogFile(PlaceholderFile value)
Sets the log file.void
startListening()
Gets called when the flow execution starts.String
updateIntervalTipText()
Returns the tip text for this property.-
Methods inherited from class adams.flow.execution.AbstractTimedFlowExecutionListenerWithTable
getUpdateInterval, incCounter, setUpdateInterval
-
Methods inherited from class adams.flow.execution.AbstractFlowExecutionListenerWithTable
getFileChooser, getSheet, newListenerPanel, updateGUI
-
Methods inherited from class adams.flow.execution.AbstractGraphicalFlowExecutionListener
getDefaultFrameSize, getDisposeOnFinish, newListenerPanelIfNecessary
-
Methods inherited from class adams.flow.execution.AbstractFlowExecutionListener
compareTo, equals, getListeners, getOwner, postInput, postOutput, preExecute, preInput, preOutput, setOwner, shallowCopy, shallowCopy
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.flow.execution.FlowExecutionListener
getOwner, postInput, postOutput, preExecute, preInput, preOutput, setOwner
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_LogFile
protected PlaceholderFile m_LogFile
the file to write to.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractTimedFlowExecutionListenerWithTable
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractFlowExecutionListenerWithTable
-
getDefaultUpdateInterval
protected int getDefaultUpdateInterval()
Description copied from class:AbstractTimedFlowExecutionListenerWithTable
Returns the default update interval.- Overrides:
getDefaultUpdateInterval
in classAbstractTimedFlowExecutionListenerWithTable
-
updateIntervalTipText
public String updateIntervalTipText()
Returns the tip text for this property.- Specified by:
updateIntervalTipText
in interfaceTimedFlowExecutionListener
- Specified by:
updateIntervalTipText
in classAbstractTimedFlowExecutionListenerWithTable
- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLogFile
public void setLogFile(PlaceholderFile value)
Sets the log file.- Parameters:
value
- the file
-
getLogFile
public PlaceholderFile getLogFile()
Returns the log file.- Returns:
- the condition
-
logFileTipText
public String logFileTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getListenerTitle
public String getListenerTitle()
The title of this listener.- Returns:
- the title
-
createTableModel
protected TableModel createTableModel()
Creates a new table model with the current data.- Specified by:
createTableModel
in classAbstractFlowExecutionListenerWithTable
- Returns:
- the model with the current data
-
startListening
public void startListening()
Gets called when the flow execution starts.- Specified by:
startListening
in interfaceFlowExecutionListener
- Overrides:
startListening
in classAbstractTimedFlowExecutionListenerWithTable
-
postExecute
public void postExecute(Actor actor)
Gets called after the actor was executed.- Specified by:
postExecute
in interfaceFlowExecutionListener
- Overrides:
postExecute
in classAbstractFlowExecutionListener
- Parameters:
actor
- the actor that was executed
-
finishListening
public void finishListening()
Gets called when the flow execution ends.
Outputs the counts in debug mode.- Specified by:
finishListening
in interfaceFlowExecutionListener
- Overrides:
finishListening
in classAbstractGraphicalFlowExecutionListener
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUp
in interfaceCleanUpHandler
- Overrides:
cleanUp
in classAbstractTimedFlowExecutionListenerWithTable
-
-