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 StringBACKUP_OUTPUTthe key for storing the output token in the backup.protected BaseClassnamem_ArrayClassthe class for the array.protected Tokenm_OutputTokenthe 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_HasCallableTransformers, 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 StringarrayClassTipText()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 StringcheckBranch(Actor branch)Checks the sub-branch.voiddefineOptions()Adds options to the internal list of options.protected StringdoExecute()Executes the actor.Class[]generates()Returns the class of objects that it generates.BaseClassnamegetArrayClass()Returns the class for the array.StringgetQuickInfo()Returns a quick info about the actor, which will be displayed in the GUI.StringglobalInfo()Returns a string describing the object.booleanhasPendingOutput()Checks whether there is pending output to be collected after executing the flow item.protected voidinitialize()Initializes the members.voidinput(Token token)The method that accepts the input token and then processes it.Tokenoutput()Returns the generated token.protected StringpostExecute()Post-execute hook.protected voidreset()Resets the scheme.protected voidrestoreState(Hashtable<String,Object> state)Restores the state of the actor before the variables got updated.voidsetArrayClass(BaseClassname value)Sets the class for the array.voidwrapUp()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, hasCallableTransformers, 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:
globalInfoin interfaceGlobalInfoSupporter- Overrides:
globalInfoin classBranch- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classBranch
-
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 classBranch- Returns:
- null if no info available, otherwise short string
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initializein classBranch
-
reset
protected void reset()
Resets the scheme.- Overrides:
resetin 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:
backupStatein 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:
restoreStatein 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:
generatesin interfaceOutputProducer- Returns:
- the Class of the generated tokens
-
checkBranch
protected String checkBranch(Actor branch)
Checks the sub-branch.- Overrides:
checkBranchin 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:
inputin interfaceInputConsumer- Overrides:
inputin classBranch- Parameters:
token- the token to accept and process
-
doExecute
protected String doExecute()
Executes the actor.
-
postExecute
protected String postExecute()
Post-execute hook.- Overrides:
postExecutein 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:
hasPendingOutputin interfaceOutputProducer- Returns:
- true if there is pending output
-
output
public Token output()
Returns the generated token.- Specified by:
outputin interfaceOutputProducer- Returns:
- the generated token
-
-