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 StringBACKUP_CURRENTthe key for storing the current token in the backup.protected booleanm_AllowSourcewhether to allow a source or not.protected booleanm_AllowStandaloneswhether to allow standalones or not.protected Tokenm_CurrentTokenthe token that gets passed on to all sub-branches.protected booleanm_RestrictedStopwhether a restricted stop occurred.protected booleanm_RestrictingStopswhether 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.StringactorsTipText()Returns the tip text for this property.protected Hashtable<String,Object>backupState()Backs up the current state of the actor before update the variables.voidcleanUp()Cleans up after the execution has finished.TokencurrentInput()Returns the current input token, if any.ActorHandlerInfogetActorHandlerInfo()Returns some information about the actor handler, e.g., whether it can contain standalones and the actor execution.booleangetAllowSource()Returns whether a source is allowed or not.booleangetAllowStandalones()Returns whether standalones are allowed or not.protected booleangetDefaultRestrictingStops()Returns the default for restricting stops.StringglobalInfo()Returns a string describing the object.booleanhasInput()Returns whether an input token is currently present.protected voidinitialize()Initializes the members.voidinput(Token token)The method that accepts the input token and then processes it.booleanisRestrictedStop()Returns whether the stop was a restricted one (that can be resumed).booleanisRestrictingStops()Returns whether stops are being restricted.protected StringpostExecute()Post-execute hook.protected StringpreExecute()Pre-execute hook.protected voidrestoreState(Hashtable<String,Object> state)Restores the state of the actor before the variables got updated.voidrestrictedStopExecution()Stops the (restricted) execution.voidrestrictedStopExecution(String msg)Stops the (restricted) execution.voidsetAllowSource(boolean value)Sets whether a source is allowed or not.voidsetAllowStandalones(boolean value)Sets whether standalones are allowed or not.voidsetRestrictingStops(boolean value)Sets whether to restrict stops or not.voidwrapUp()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:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initializein classMutableConnectedControlActor
-
actorsTipText
public String actorsTipText()
Returns the tip text for this property.- Specified by:
actorsTipTextin 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:
setRestrictingStopsin interfaceOptionalStopRestrictor- Parameters:
value- true if to restrict
-
isRestrictingStops
public boolean isRestrictingStops()
Returns whether stops are being restricted.- Specified by:
isRestrictingStopsin interfaceStopRestrictor- Returns:
- true if restricting stops
-
isRestrictedStop
public boolean isRestrictedStop()
Returns whether the stop was a restricted one (that can be resumed).- Specified by:
isRestrictedStopin interfaceStopRestrictor- Returns:
- true if restricted stop occurred
-
restrictedStopExecution
public void restrictedStopExecution()
Stops the (restricted) execution. No message set.- Specified by:
restrictedStopExecutionin interfaceStopRestrictor
-
restrictedStopExecution
public void restrictedStopExecution(String msg)
Stops the (restricted) execution.- Specified by:
restrictedStopExecutionin 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:
getActorHandlerInfoin interfaceActorHandler- Specified by:
getActorHandlerInfoin classAbstractControlActor- Returns:
- the info
-
backupState
protected Hashtable<String,Object> backupState()
Backs up the current state of the actor before update the variables.- Overrides:
backupStatein 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:
restoreStatein 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:
acceptsin 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:
inputin interfaceInputConsumer- Parameters:
token- the token to accept and process
-
hasInput
public boolean hasInput()
Returns whether an input token is currently present.- Specified by:
hasInputin interfaceInputConsumer- Returns:
- true if input token present
-
currentInput
public Token currentInput()
Returns the current input token, if any.- Specified by:
currentInputin interfaceInputConsumer- Returns:
- the input token, null if none present
-
preExecute
protected String preExecute()
Pre-execute hook.- Overrides:
preExecutein classAbstractControlActor- Returns:
- null if everything is fine, otherwise error message
- See Also:
SubFlowWrapUp.wrapUpSubFlow()
-
postExecute
protected String postExecute()
Post-execute hook.- Overrides:
postExecutein 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:
wrapUpin interfaceActor- Overrides:
wrapUpin classAbstractDirectedControlActor
-
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 classAbstractDirectedControlActor
-
-