Package adams.flow.control
Class Sequence
-
- 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
,InputConsumer
,MutableActorHandler
,OptionalStopRestrictor
,StopRestrictor
,SubFlowWrapUp
,Serializable
,Comparable
- Direct Known Subclasses:
AutogeneratedSink
,ConditionalSequence
,InactiveSink
,SinkReset
,StorageValueSequence
,SubProcess
public class Sequence extends MutableConnectedControlActor implements InputConsumer, OptionalStopRestrictor
Encapsulates a sequence of flow items.
Valid options are:
-D (property: debug) If set to true, scheme may output additional info to the console.
-name <java.lang.String> (property: name) The name of the actor. default: Sequence
-annotation <adams.core.base.BaseString> [-annotation ...] (property: annotations) The annotations to attach to this actor.
-skip (property: skip) If set to true, transformation is skipped and the input token is just forwarded as it is.
-progress (property: showProgress) If set to true, progress information will be output to stdout ('.').
-actor <adams.flow.core.Actor [options]> [-actor ...] (property: actors) All the actors that define this sequence.
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
BACKUP_CURRENT
the key for storing the current token in the backup.protected boolean
m_AllowSource
whether to allow a source or not.protected boolean
m_AllowStandalones
whether to allow standalones or not.protected Token
m_CurrentToken
the token that gets passed on to all sub-branches.protected boolean
m_RestrictedStop
whether a restricted stop occurred.protected boolean
m_RestrictingStops
whether stops get restricted or not.-
Fields inherited from class adams.flow.control.MutableConnectedControlActor
m_Actors
-
Fields inherited from class adams.flow.control.AbstractDirectedControlActor
m_Director, m_FinishBeforeStopping, m_StoppingTimeout, m_StoppingWarningInterval
-
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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class[]
accepts()
Returns the class that the consumer accepts.String
actorsTipText()
Returns the tip text for this property.protected Hashtable<String,Object>
backupState()
Backs up the current state of the actor before update the variables.void
cleanUp()
Cleans up after the execution has finished.Token
currentInput()
Returns the current input token, if any.ActorHandlerInfo
getActorHandlerInfo()
Returns some information about the actor handler, e.g., whether it can contain standalones and the actor execution.boolean
getAllowSource()
Returns whether a source is allowed or not.boolean
getAllowStandalones()
Returns whether standalones are allowed or not.protected boolean
getDefaultRestrictingStops()
Returns the default for restricting stops.String
globalInfo()
Returns a string describing the object.boolean
hasInput()
Returns whether an input token is currently present.protected void
initialize()
Initializes the members.void
input(Token token)
The method that accepts the input token and then processes it.boolean
isRestrictedStop()
Returns whether the stop was a restricted one (that can be resumed).boolean
isRestrictingStops()
Returns whether stops are being restricted.protected String
postExecute()
Post-execute hook.protected String
preExecute()
Pre-execute hook.protected void
restoreState(Hashtable<String,Object> state)
Restores the state of the actor before the variables got updated.void
restrictedStopExecution()
Stops the (restricted) execution.void
restrictedStopExecution(String msg)
Stops the (restricted) execution.void
setAllowSource(boolean value)
Sets whether a source is allowed or not.void
setAllowStandalones(boolean value)
Sets whether standalones are allowed or not.void
setRestrictingStops(boolean value)
Sets whether to restrict stops or not.void
wrapUp()
Finishes up the execution.-
Methods inherited from class adams.flow.control.MutableConnectedControlActor
add, add, defineOptions, get, getActors, indexOf, remove, removeAll, set, setActors, size
-
Methods inherited from class adams.flow.control.AbstractConnectedControlActor
check, checkConnections, classesToString
-
Methods inherited from class adams.flow.control.AbstractDirectedControlActor
doExecute, finishBeforeStoppingTipText, flushExecution, getDirector, getFinishBeforeStopping, getQuickInfo, getStoppingTimeout, getStoppingWarningInterval, newDirector, setFinishBeforeStopping, setStoppingTimeout, setStoppingWarningInterval, setUp, stopExecution, stoppingTimeoutTipText, stoppingWarningIntervalTipText, updateVariables
-
Methods inherited from class adams.flow.control.AbstractControlActor
active, canInspectOptions, destroy, firstActive, firstInputConsumer, flowPauseStateChanged, forceVariables, isPaused, isSubFlowWrappedUp, lastActive, pauseExecution, reset, resumeExecution, setParent, setUpSubActors, updateParent, wrapUpSubFlow
-
Methods inherited from class adams.flow.core.AbstractActor
annotationsTipText, 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, pruneBackup, pruneBackup, 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, 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, getQuickInfo, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, hasErrorHandler, hasStopMessage, index, isExecuted, isFinished, isHeadless, isStopped, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setUp, setVariables, shallowCopy, shallowCopy, sizeOf, stopExecution, stopExecution, toCommandLine, variableChanged
-
Methods inherited from interface adams.flow.core.ActorHandler
check, firstActive, flushExecution, lastActive
-
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, defineOptions, getOptionManager
-
Methods inherited from interface adams.core.VariablesInspectionHandler
canInspectOptions
-
-
-
-
Field Detail
-
BACKUP_CURRENT
public static final String BACKUP_CURRENT
the key for storing the current token in the backup.- See Also:
- Constant Field Values
-
m_CurrentToken
protected transient Token m_CurrentToken
the token that gets passed on to all sub-branches.
-
m_AllowStandalones
protected boolean m_AllowStandalones
whether to allow standalones or not.
-
m_AllowSource
protected boolean m_AllowSource
whether to allow a source or not.
-
m_RestrictingStops
protected boolean m_RestrictingStops
whether stops get restricted or not.
-
m_RestrictedStop
protected boolean m_RestrictedStop
whether a restricted stop occurred.
-
-
Constructor Detail
-
Sequence
public Sequence()
Default constructor.
-
Sequence
public Sequence(String name)
Initializes the actor with the specified name.- Parameters:
name
- the name to use
-
-
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
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classMutableConnectedControlActor
-
actorsTipText
public String actorsTipText()
Returns the tip text for this property.- Specified by:
actorsTipText
in classMutableConnectedControlActor
- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getDefaultRestrictingStops
protected boolean getDefaultRestrictingStops()
Returns the default for restricting stops.- Returns:
- true if restricted
-
setRestrictingStops
public void setRestrictingStops(boolean value)
Sets whether to restrict stops or not.- Specified by:
setRestrictingStops
in interfaceOptionalStopRestrictor
- Parameters:
value
- true if to restrict
-
isRestrictingStops
public boolean isRestrictingStops()
Returns whether stops are being restricted.- Specified by:
isRestrictingStops
in interfaceStopRestrictor
- Returns:
- true if restricting stops
-
isRestrictedStop
public boolean isRestrictedStop()
Returns whether the stop was a restricted one (that can be resumed).- Specified by:
isRestrictedStop
in interfaceStopRestrictor
- Returns:
- true if restricted stop occurred
-
restrictedStopExecution
public void restrictedStopExecution()
Stops the (restricted) execution. No message set.- Specified by:
restrictedStopExecution
in interfaceStopRestrictor
-
restrictedStopExecution
public void restrictedStopExecution(String msg)
Stops the (restricted) execution.- Specified by:
restrictedStopExecution
in interfaceStopRestrictor
- Parameters:
msg
- the message to set as reason for stopping, can be null
-
setAllowStandalones
public void setAllowStandalones(boolean value)
Sets whether standalones are allowed or not.- Parameters:
value
- true if standalones are allowed
-
getAllowStandalones
public boolean getAllowStandalones()
Returns whether standalones are allowed or not.- Returns:
- true if standalones are allowed
-
setAllowSource
public void setAllowSource(boolean value)
Sets whether a source is allowed or not.- Parameters:
value
- true if a source is allowed
-
getAllowSource
public boolean getAllowSource()
Returns whether a source is allowed or not.- Returns:
- true if a source is allowed
-
getActorHandlerInfo
public ActorHandlerInfo getActorHandlerInfo()
Returns some information about the actor handler, e.g., whether it can contain standalones and the actor execution.- Specified by:
getActorHandlerInfo
in interfaceActorHandler
- Specified by:
getActorHandlerInfo
in classAbstractControlActor
- Returns:
- the info
-
backupState
protected Hashtable<String,Object> backupState()
Backs up the current state of the actor before update the variables.- Overrides:
backupState
in classAbstractActor
- Returns:
- the backup
- See Also:
AbstractActor.updateVariables()
,AbstractActor.restoreState(Hashtable)
-
restoreState
protected void restoreState(Hashtable<String,Object> state)
Restores the state of the actor before the variables got updated.- Overrides:
restoreState
in classAbstractActor
- Parameters:
state
- the backup of the state to restore from- See Also:
AbstractActor.updateVariables()
,AbstractActor.backupState()
-
accepts
public Class[] accepts()
Returns the class that the consumer accepts.- Specified by:
accepts
in interfaceInputConsumer
- Returns:
- the Class of objects that can be processed
-
input
public void input(Token token)
The method that accepts the input token and then processes it.- Specified by:
input
in interfaceInputConsumer
- Parameters:
token
- the token to accept and process
-
hasInput
public boolean hasInput()
Returns whether an input token is currently present.- Specified by:
hasInput
in interfaceInputConsumer
- Returns:
- true if input token present
-
currentInput
public Token currentInput()
Returns the current input token, if any.- Specified by:
currentInput
in interfaceInputConsumer
- Returns:
- the input token, null if none present
-
preExecute
protected String preExecute()
Pre-execute hook.- Overrides:
preExecute
in classAbstractControlActor
- Returns:
- null if everything is fine, otherwise error message
- See Also:
SubFlowWrapUp.wrapUpSubFlow()
-
postExecute
protected String postExecute()
Post-execute hook.- Overrides:
postExecute
in classAbstractActor
- Returns:
- null if everything is fine, otherwise error message
- See Also:
AbstractActor.m_Executed
-
wrapUp
public void wrapUp()
Finishes up the execution.- Specified by:
wrapUp
in interfaceActor
- Overrides:
wrapUp
in classAbstractDirectedControlActor
-
cleanUp
public void cleanUp()
Cleans up after the execution has finished. Also removes graphical components.- Specified by:
cleanUp
in interfaceActor
- Specified by:
cleanUp
in interfaceCleanUpHandler
- Overrides:
cleanUp
in classAbstractDirectedControlActor
-
-