Package adams.flow.control
Class IfStorageValue
-
- 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
public class IfStorageValue extends AbstractDirectedControlActor
An If-Then-Else source actor for storage values. If a storage value is available, the 'Then' branch gets executed, otherwise the 'Else' branch.
Whereas the 'Then' branch receives the storage value (in case this branch accepts input), the 'Else' branch needs to produce its own data, i.e., having a source actor.
Valid options are:
-D <int> (property: debugLevel) The greater the number the more additional info the scheme may output to the console (0 = off). default: 0 minimum: 0
-name <java.lang.String> (property: name) The name of the actor. default: IfStorageValue
-annotation <adams.core.base.BaseText> (property: annotations) The annotations to attach to this actor. default:
-skip (property: skip) If set to true, transformation is skipped and the input token is just forwarded as it is.
-stop-flow-on-error (property: stopFlowOnError) If set to true, the flow gets stopped in case this actor encounters an error; useful for critical actors.
-cache <java.lang.String> (property: cache) The name of the cache to retrieve the value from; uses the regular storage if left empty. default:
-storage-name <adams.flow.control.StorageName> (property: storageName) The name of the stored value to retrieve. default: storage
-then <adams.flow.core.Actor> (property: thenActor) The actor of the 'then' branch. default: adams.flow.control.Sequence -name then -actor adams.flow.sink.Null
-else <adams.flow.core.Actor> (property: elseActor) The actor of the 'else' branch. default: adams.flow.control.Sequence -name else -actor adams.flow.source.StringConstants
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
IfStorageValue.IfStorageValueDirector
A specialized director for an IfStorageValue control actor.
-
Field Summary
Fields Modifier and Type Field Description protected String
m_Cache
the name of the LRU cache.protected Actor
m_ElseActor
the actor to execute in the "else" branch.protected StorageName
m_StorageName
the name of the stored value.protected Actor
m_ThenActor
the actor to execute in the "then" branch.-
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
-
-
Constructor Summary
Constructors Constructor Description IfStorageValue()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
cacheTipText()
Returns the tip text for this property.String
check()
Performs checks on the "sub-actors".void
defineOptions()
Adds options to the internal list of options.String
elseActorTipText()
Returns the tip text for this property.Actor
get(int index)
Returns the actor at the given position.ActorHandlerInfo
getActorHandlerInfo()
Returns some information about the actor handler, e.g., whether it can contain standalones and the actor execution.String
getCache()
Returns the name of the LRU cache to use, regular storage if left empty.protected Actor
getDefaultElse()
Returns the default 'Else' actor.protected Actor
getDefaultThen()
Returns the default 'Then' actor.Actor
getElseActor()
Returns the actor of the 'else' branch.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.StorageName
getStorageName()
Returns the name of the stored value.Actor
getThenActor()
Returns the actor of the 'then' branch.String
globalInfo()
Returns a string describing the object.int
indexOf(String actor)
Returns the index of the actor.protected void
initialize()
Initializes the members.protected AbstractDirector
newDirector()
Returns an instance of a director.String
set(int index, Actor actor)
Sets the actor at the given position.void
setCache(String value)
Sets the name of the LRU cache to use, regular storage if left empty.void
setElseActor(Actor value)
Sets the actor of the 'else' branch.void
setStorageName(StorageName value)
Sets the name of the stored value.void
setThenActor(Actor value)
Sets the actor of the 'then' branch.int
size()
Returns the size of the group.String
storageNameTipText()
Returns the tip text for this property.String
thenActorTipText()
Returns the tip text for this property.-
Methods inherited from class adams.flow.control.AbstractDirectedControlActor
cleanUp, doExecute, finishBeforeStoppingTipText, flushExecution, getDirector, getFinishBeforeStopping, getStoppingTimeout, getStoppingWarningInterval, setFinishBeforeStopping, setStoppingTimeout, setStoppingWarningInterval, setUp, stopExecution, stoppingTimeoutTipText, stoppingWarningIntervalTipText, updateVariables, wrapUp
-
Methods inherited from class adams.flow.control.AbstractControlActor
active, canInspectOptions, destroy, firstActive, firstInputConsumer, flowPauseStateChanged, forceVariables, isPaused, isSubFlowWrappedUp, lastActive, pauseExecution, preExecute, reset, resumeExecution, setParent, setUpSubActors, 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, 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_Cache
protected String m_Cache
the name of the LRU cache.
-
m_StorageName
protected StorageName m_StorageName
the name of the stored value.
-
m_ThenActor
protected Actor m_ThenActor
the actor to execute in the "then" branch.
-
m_ElseActor
protected Actor m_ElseActor
the actor to execute in the "else" branch.
-
-
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 classAbstractDirectedControlActor
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractControlActor
-
getDefaultThen
protected Actor getDefaultThen()
Returns the default 'Then' actor.- Returns:
- the default actor
-
getDefaultElse
protected Actor getDefaultElse()
Returns the default 'Else' actor.- Returns:
- the default actor
-
newDirector
protected AbstractDirector newDirector()
Returns an instance of a director.- Overrides:
newDirector
in classAbstractDirectedControlActor
- Returns:
- the director
-
setCache
public void setCache(String value)
Sets the name of the LRU cache to use, regular storage if left empty.- Parameters:
value
- the cache
-
getCache
public String getCache()
Returns the name of the LRU cache to use, regular storage if left empty.- Returns:
- the cache
-
cacheTipText
public String cacheTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setStorageName
public void setStorageName(StorageName value)
Sets the name of the stored value.- Parameters:
value
- the name
-
getStorageName
public StorageName getStorageName()
Returns the name of the stored value.- Returns:
- the name
-
storageNameTipText
public String storageNameTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setThenActor
public void setThenActor(Actor value)
Sets the actor of the 'then' branch.- Parameters:
value
- the actor
-
getThenActor
public Actor getThenActor()
Returns the actor of the 'then' branch.- Returns:
- the actor
-
thenActorTipText
public String thenActorTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setElseActor
public void setElseActor(Actor value)
Sets the actor of the 'else' branch.- Parameters:
value
- the actor
-
getElseActor
public Actor getElseActor()
Returns the actor of the 'else' branch.- Returns:
- the actor
-
elseActorTipText
public String elseActorTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceActor
- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractDirectedControlActor
- Returns:
- null if no info available, otherwise short string
-
size
public int size()
Returns the size of the group.- Specified by:
size
in interfaceActorHandler
- Specified by:
size
in classAbstractControlActor
- Returns:
- always 2
-
get
public Actor get(int index)
Returns the actor at the given position.- Specified by:
get
in interfaceActorHandler
- Specified by:
get
in classAbstractControlActor
- Parameters:
index
- the position- Returns:
- the actor
-
set
public String set(int index, Actor actor)
Sets the actor at the given position.- Specified by:
set
in interfaceActorHandler
- Specified by:
set
in classAbstractControlActor
- Parameters:
index
- the positionactor
- the actor to set at this position- Returns:
- null if everything is fine, otherwise the error
-
indexOf
public int indexOf(String actor)
Returns the index of the actor.- Specified by:
indexOf
in interfaceActorHandler
- Specified by:
indexOf
in classAbstractControlActor
- Parameters:
actor
- the name of the actor to look for- Returns:
- the index of -1 if not found
-
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
-
check
public String check()
Performs checks on the "sub-actors". Default implementation does nothing.- Specified by:
check
in interfaceActorHandler
- Overrides:
check
in classAbstractControlActor
- Returns:
- null
-
-