Package adams.flow.control
Class AbstractDirectedControlActor
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.core.AbstractActor
-
- adams.flow.control.AbstractControlActor
-
- adams.flow.control.AbstractDirectedControlActor
-
- All Implemented Interfaces:
AdditionalInformationHandler,CleanUpHandler,Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,Pausable,QuickInfoSupporter,ShallowCopySupporter<Actor>,SizeOfHandler,Stoppable,StoppableWithFeedback,VariablesInspectionHandler,FlowPauseStateListener,VariableChangeListener,AtomicExecution,Actor,ActorHandler,ControlActor,ErrorHandler,Flushable,SubFlowWrapUp,Serializable,Comparable
- Direct Known Subclasses:
AbstractConnectedControlActor,IfStorageValue,IfThenElse,MutableControlActor,Switch
public abstract class AbstractDirectedControlActor extends AbstractControlActor implements AtomicExecution
Ancestor for all actors that control sub-actors in some way.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected AbstractDirectorm_Directorthe director used for executing.protected booleanm_FinishBeforeStoppingwhether to finish execution first before stopping.protected intm_StoppingTimeoutthe timeout in milliseconds for stopping in case of atomic execution (<= 0 is infinity).protected intm_StoppingWarningIntervalthe interval in msec to warn if actors haven't stopped yet (and not stopping timeout set).-
Fields inherited from class adams.flow.control.AbstractControlActor
m_Compatibility, m_PauseStateManager, m_SetUpSubActors
-
Fields inherited from class adams.flow.core.AbstractActor
m_Annotations, m_BackupState, m_DetectedObjectVariables, m_DetectedVariables, m_ErrorHandler, m_Executed, m_Executing, m_ExecutionListeningSupporter, m_FullName, m_LoggingPrefix, m_Name, m_Parent, m_ScopeHandler, m_Self, m_Silent, m_Skip, m_StopFlowOnError, m_StopMessage, m_Stopped, m_StorageHandler, m_VariablesUpdated
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
Fields inherited from interface adams.flow.core.Actor
FILE_EXTENSION, FILE_EXTENSION_GZ
-
-
Constructor Summary
Constructors Constructor Description AbstractDirectedControlActor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanUp()Cleans up after the execution has finished.voiddefineOptions()Adds options to the internal list of options.protected StringdoExecute()Executes the actor.StringfinishBeforeStoppingTipText()Returns the tip text for this property.voidflushExecution()Stops the processing of tokens without stopping the flow.AbstractDirectorgetDirector()Returns the current director in use.booleangetFinishBeforeStopping()Returns whether to finish processing before stopping execution.StringgetQuickInfo()Returns a quick info about the actor, which will be displayed in the GUI.intgetStoppingTimeout()Returns the timeout for waiting for the sub-flow to stop.intgetStoppingWarningInterval()Returns the interval for outputting warnings if the sub-flow hasn't stopped yet (and no stopping timeout set).protected AbstractDirectornewDirector()Returns an instance of a director.voidsetFinishBeforeStopping(boolean value)Sets whether to finish processing before stopping execution.voidsetStoppingTimeout(int value)Sets the timeout for waiting for the sub-flow to stop.voidsetStoppingWarningInterval(int value)Sets the interval for outputting warnings if the sub-flow hasn't stopped yet (and no stopping timeout set).StringsetUp()Initializes the sub-actors for flow execution.voidstopExecution()Stops the execution.StringstoppingTimeoutTipText()Returns the tip text for this property.StringstoppingWarningIntervalTipText()Returns the tip text for this property.protected StringupdateVariables()Gets called when the actor needs to be re-setUp when a variable changes.voidwrapUp()Finishes up the execution.-
Methods inherited from class adams.flow.control.AbstractControlActor
active, canInspectOptions, check, destroy, firstActive, firstInputConsumer, flowPauseStateChanged, forceVariables, get, getActorHandlerInfo, indexOf, initialize, isPaused, isSubFlowWrappedUp, lastActive, pauseExecution, preExecute, reset, resumeExecution, set, setParent, setUpSubActors, size, updateParent, wrapUpSubFlow
-
Methods inherited from class adams.flow.core.AbstractActor
annotationsTipText, backupState, canPerformSetUpCheck, compareTo, configureLogger, equals, execute, finalUpdateVariables, findVariables, findVariables, forCommandLine, forName, forName, getAdditionalInformation, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowActors, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, handleException, hasErrorHandler, hasStopMessage, index, isBackedUp, isExecuted, isExecuting, isFinished, isHeadless, isStopped, nameTipText, performSetUpChecks, performVariableChecks, postExecute, pruneBackup, pruneBackup, restoreState, setAnnotations, setErrorHandler, setName, setSilent, setSkip, setStopFlowOnError, setVariables, shallowCopy, shallowCopy, silentTipText, sizeOf, skipTipText, stopExecution, stopFlowOnErrorTipText, updateDetectedVariables, updatePrefix, variableChanged
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.flow.core.Actor
compareTo, destroy, equals, execute, findVariables, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, hasErrorHandler, hasStopMessage, index, isExecuted, isFinished, isHeadless, isStopped, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setVariables, shallowCopy, shallowCopy, sizeOf, stopExecution, toCommandLine, variableChanged
-
Methods inherited from interface adams.core.AdditionalInformationHandler
getAdditionalInformation
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel, setLoggingLevel
-
Methods inherited from interface adams.core.logging.LoggingSupporter
getLogger, isLoggingEnabled
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager
-
Methods inherited from interface adams.core.VariablesInspectionHandler
canInspectOptions
-
-
-
-
Field Detail
-
m_Director
protected AbstractDirector m_Director
the director used for executing.
-
m_FinishBeforeStopping
protected boolean m_FinishBeforeStopping
whether to finish execution first before stopping.
-
m_StoppingTimeout
protected int m_StoppingTimeout
the timeout in milliseconds for stopping in case of atomic execution (<= 0 is infinity).
-
m_StoppingWarningInterval
protected int m_StoppingWarningInterval
the interval in msec to warn if actors haven't stopped yet (and not stopping timeout set).
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractActor
-
setFinishBeforeStopping
public void setFinishBeforeStopping(boolean value)
Sets whether to finish processing before stopping execution.- Specified by:
setFinishBeforeStoppingin interfaceAtomicExecution- Parameters:
value- if true then actor finishes processing first
-
getFinishBeforeStopping
public boolean getFinishBeforeStopping()
Returns whether to finish processing before stopping execution.- Specified by:
getFinishBeforeStoppingin interfaceAtomicExecution- Returns:
- true if actor finishes processing first
-
finishBeforeStoppingTipText
public String finishBeforeStoppingTipText()
Returns the tip text for this property.- Specified by:
finishBeforeStoppingTipTextin interfaceAtomicExecution- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setStoppingTimeout
public void setStoppingTimeout(int value)
Sets the timeout for waiting for the sub-flow to stop.- Specified by:
setStoppingTimeoutin interfaceAtomicExecution- Parameters:
value- timeout in milliseconds (<= 0 for infinity)
-
getStoppingTimeout
public int getStoppingTimeout()
Returns the timeout for waiting for the sub-flow to stop.- Specified by:
getStoppingTimeoutin interfaceAtomicExecution- Returns:
- timeout in milliseconds (<= 0 for infinity)
-
stoppingTimeoutTipText
public String stoppingTimeoutTipText()
Returns the tip text for this property.- Specified by:
stoppingTimeoutTipTextin interfaceAtomicExecution- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setStoppingWarningInterval
public void setStoppingWarningInterval(int value)
Sets the interval for outputting warnings if the sub-flow hasn't stopped yet (and no stopping timeout set).- Parameters:
value- interval in milliseconds (<= 0 no warning)
-
getStoppingWarningInterval
public int getStoppingWarningInterval()
Returns the interval for outputting warnings if the sub-flow hasn't stopped yet (and no stopping timeout set).- Returns:
- interval in milliseconds (<= 0 no warning)
-
stoppingWarningIntervalTipText
public String stoppingWarningIntervalTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
newDirector
protected AbstractDirector newDirector()
Returns an instance of a director.- Returns:
- the director
-
getDirector
public AbstractDirector getDirector()
Returns the current director in use.- Returns:
- the director, null if none in use
-
updateVariables
protected String updateVariables()
Gets called when the actor needs to be re-setUp when a variable changes.- Overrides:
updateVariablesin classAbstractActor- Returns:
- null if everything is fine, otherwise error message
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfoin interfaceActor- Specified by:
getQuickInfoin interfaceQuickInfoSupporter- Overrides:
getQuickInfoin classAbstractActor- Returns:
- null if no info available, otherwise short string
-
setUp
public String setUp()
Initializes the sub-actors for flow execution.- Specified by:
setUpin interfaceActor- Overrides:
setUpin classAbstractControlActor- Returns:
- null if everything is fine, otherwise error message
- See Also:
AbstractActor.reset()
-
doExecute
protected String doExecute()
Executes the actor.- Specified by:
doExecutein classAbstractActor- Returns:
- null if everything is fine, otherwise error message
-
flushExecution
public void flushExecution()
Stops the processing of tokens without stopping the flow.- Specified by:
flushExecutionin interfaceActorHandler- Specified by:
flushExecutionin interfaceFlushable- Overrides:
flushExecutionin classAbstractControlActor
-
stopExecution
public void stopExecution()
Stops the execution.- Specified by:
stopExecutionin interfaceActor- Specified by:
stopExecutionin interfaceStoppable- Overrides:
stopExecutionin classAbstractControlActor
-
wrapUp
public void wrapUp()
Finishes up the execution.- Specified by:
wrapUpin interfaceActor- Overrides:
wrapUpin classAbstractControlActor
-
cleanUp
public void cleanUp()
Cleans up after the execution has finished. Also removes graphical components.- Specified by:
cleanUpin interfaceActor- Specified by:
cleanUpin interfaceCleanUpHandler- Overrides:
cleanUpin classAbstractControlActor
-
-