Package adams.flow.control
Class ArrayGenerate
-
- All Implemented Interfaces:
AdditionalInformationHandler
,CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,Pausable
,QuickInfoSupporter
,ShallowCopySupporter<Actor>
,SizeOfHandler
,Stoppable
,StoppableWithFeedback
,ThreadLimiter
,VariablesInspectionHandler
,FlowPauseStateListener
,VariableChangeListener
,AtomicExecution
,Actor
,ActorHandler
,ControlActor
,ErrorHandler
,Flushable
,InputConsumer
,MutableActorHandler
,OutputProducer
,SubFlowWrapUp
,Serializable
,Comparable
public class ArrayGenerate extends Branch implements OutputProducer
Applies all sub-actors to the input token and generates an array from the collected output.
Each of the branches is expected to produce at most one output token (ideally one per branch, otherwise there will be null elements in the output array).
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-name <java.lang.String> (property: name) The name of the actor. default: ArrayGenerate
-annotation <adams.core.base.BaseAnnotation> (property: annotations) The annotations to attach to this actor. default:
-skip <boolean> (property: skip) If set to true, transformation is skipped and the input token is just forwarded as it is. default: false
-stop-flow-on-error <boolean> (property: stopFlowOnError) If set to true, the flow gets stopped in case this actor encounters an error; useful for critical actors. default: false
-silent <boolean> (property: silent) If enabled, then no errors are output in the console. default: false
-finish-before-stopping <boolean> (property: finishBeforeStopping) If enabled, actor first finishes processing all data before stopping. default: false
-branch <adams.flow.core.Actor> [-branch ...] (property: branches) The different branches that branch off and will be supplied with a copy of the same object. default:
-num-threads <int> (property: numThreads) The number of threads to use for executing the branches; -1 = number of CPUs/cores; 0 or 1 = sequential execution. default: -1 minimum: -1
-array-class <adams.core.base.BaseClassname> (property: arrayClass) The class to use for the array; if none is specified, the class of the first element is used. default:
- Version:
- $Revision: 7842 $
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
BACKUP_OUTPUT
the key for storing the output token in the backup.protected BaseClassname
m_ArrayClass
the class for the array.protected Token
m_OutputToken
the output array.-
Fields inherited from class adams.flow.control.Branch
BACKUP_CURRENT, m_ActualNumThreads, m_Branches, m_CollectedOutput, m_CollectOutput, m_CurrentToken, m_Executor, m_FinishBeforeStopping, m_HasGlobalTransformers, m_NumThreads, 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 ArrayGenerate()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
arrayClassTipText()
Returns the tip text for this property.protected Hashtable<String,Object>
backupState()
Backs up the current state of the actor before update the variables.protected String
checkBranch(Actor branch)
Checks the sub-branch.void
defineOptions()
Adds options to the internal list of options.protected String
doExecute()
Executes the actor.Class[]
generates()
Returns the class of objects that it generates.BaseClassname
getArrayClass()
Returns the class for the array.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.String
globalInfo()
Returns a string describing the object.boolean
hasPendingOutput()
Checks whether there is pending output to be collected after executing the flow item.protected void
initialize()
Initializes the members.void
input(Token token)
The method that accepts the input token and then processes it.Token
output()
Returns the generated token.protected String
postExecute()
Post-execute hook.protected void
reset()
Resets the scheme.protected void
restoreState(Hashtable<String,Object> state)
Restores the state of the actor before the variables got updated.void
setArrayClass(BaseClassname value)
Sets the class for the array.void
wrapUp()
Cleans up after the execution has finished.-
Methods inherited from class adams.flow.control.Branch
accepts, add, add, branchesTipText, check, currentInput, executeParallel, executeSequential, finishBeforeStoppingTipText, flushExecution, get, getActorHandlerInfo, getBranches, getCollectedOutput, getCollectOutput, getFinishBeforeStopping, getNumThreads, getStoppingTimeout, getStoppingWarningInterval, hasGlobalTransformers, hasInput, indexOf, numThreadsTipText, remove, removeAll, set, setBranches, setCollectOutput, setFinishBeforeStopping, setNumThreads, setStoppingTimeout, setStoppingWarningInterval, setUp, size, stopExecution, stoppingTimeoutTipText, stoppingWarningIntervalTipText
-
Methods inherited from class adams.flow.control.AbstractControlActor
active, canInspectOptions, cleanUp, destroy, firstActive, firstInputConsumer, flowPauseStateChanged, forceVariables, isPaused, isSubFlowWrappedUp, lastActive, pauseExecution, preExecute, 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, updateVariables, 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
cleanUp, 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, setUp, setVariables, shallowCopy, shallowCopy, sizeOf, stopExecution, stopExecution, toCommandLine, variableChanged
-
Methods inherited from interface adams.flow.core.ActorHandler
firstActive, 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, getOptionManager
-
Methods inherited from interface adams.core.VariablesInspectionHandler
canInspectOptions
-
-
-
-
Field Detail
-
BACKUP_OUTPUT
public static final String BACKUP_OUTPUT
the key for storing the output token in the backup.- See Also:
- Constant Field Values
-
m_ArrayClass
protected BaseClassname m_ArrayClass
the class for the array.
-
m_OutputToken
protected Token m_OutputToken
the output array.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Overrides:
globalInfo
in classBranch
- 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 classBranch
-
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 classBranch
- Returns:
- null if no info available, otherwise short string
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classBranch
-
reset
protected void reset()
Resets the scheme.- Overrides:
reset
in classAbstractControlActor
-
setArrayClass
public void setArrayClass(BaseClassname value)
Sets the class for the array.- Parameters:
value
- the classname, use empty string to use class of first element
-
getArrayClass
public BaseClassname getArrayClass()
Returns the class for the array.- Returns:
- the classname, empty string if class of first element is used
-
arrayClassTipText
public String arrayClassTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
backupState
protected Hashtable<String,Object> backupState()
Backs up the current state of the actor before update the variables.- Overrides:
backupState
in classBranch
- 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 classBranch
- Parameters:
state
- the backup of the state to restore from- See Also:
AbstractActor.updateVariables()
,AbstractActor.backupState()
-
generates
public Class[] generates()
Returns the class of objects that it generates.- Specified by:
generates
in interfaceOutputProducer
- Returns:
- the Class of the generated tokens
-
checkBranch
protected String checkBranch(Actor branch)
Checks the sub-branch.- Overrides:
checkBranch
in classBranch
- Parameters:
branch
- the branch to check- Returns:
- null if everything correct, otherwise the error message
-
input
public void input(Token token)
The method that accepts the input token and then processes it.- Specified by:
input
in interfaceInputConsumer
- Overrides:
input
in classBranch
- Parameters:
token
- the token to accept and process
-
doExecute
protected String doExecute()
Executes the actor.
-
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
-
hasPendingOutput
public boolean hasPendingOutput()
Checks whether there is pending output to be collected after executing the flow item.- Specified by:
hasPendingOutput
in interfaceOutputProducer
- Returns:
- true if there is pending output
-
output
public Token output()
Returns the generated token.- Specified by:
output
in interfaceOutputProducer
- Returns:
- the generated token
-
-