Package adams.flow.standalone
Class AbstractStandaloneGroup<T extends Actor>
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.core.AbstractActor
-
- adams.flow.standalone.AbstractStandalone
-
- adams.flow.standalone.AbstractStandaloneGroup<T>
-
- Type Parameters:
T
- the type of sub-actor
- All Implemented Interfaces:
AdditionalInformationHandler
,CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,ShallowCopySupporter<Actor>
,SizeOfHandler
,Stoppable
,StoppableWithFeedback
,VariablesInspectionHandler
,VariableChangeListener
,Actor
,ActorHandler
,ErrorHandler
,Flushable
,StandaloneGroup<T>
,Serializable
,Comparable
- Direct Known Subclasses:
AbstractStandaloneGroupItemGroup
,AbstractStandaloneMutableGroup
public abstract class AbstractStandaloneGroup<T extends Actor> extends AbstractStandalone implements StandaloneGroup<T>
Ancestor for fixed-sized groups.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected List<T>
m_Actors
the actors of the fixed group.-
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 AbstractStandaloneGroup()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract String
check()
Performs checks on the "sub-actors".protected String
checkActor(Actor actor)
Checks the actor whether it is of the correct type.protected String
checkActor(Actor actor, int index)
Checks the actor whether it is of the correct type.protected String
checkActors(Actor[] actors)
Checks the actors whether they are of the correct type.void
cleanUp()
Cleans up after the execution has finished.protected abstract String
doExecute()
Executes the flow item.Actor
find(String name)
Finds the actor with the specified name recursively.Actor
firstActive()
Returns the first non-skipped actor.void
flushExecution()
Stops the processing of tokens without stopping the flow.protected void
forceVariables(Variables value)
Updates the Variables instance in use.Actor
get(int index)
Returns the actor at the given position.protected Class[]
getActorFilter()
Returns the classes that the flow editor uses for filtering.ActorHandlerInfo
getActorHandlerInfo()
Returns some information about the actor handler, e.g., whether it can contain standalones and the actor execution.protected Actor[]
getActors()
Returns the actors to use.<A extends Actor>
List<A>getActors(Class<A> actor)
Returns a list of actors comprising of the requested actor type (exact match).<A extends Actor>
List<A>getActorsBelow(Class parent, Class<A> actor)
Returns a list of actors comprising of the requested actor type (exact match).protected abstract List<T>
getDefaultActors()
Returns the list of default actors.boolean
hasActor(Class actor)
Checks whether an actor of this type is present as a default (exact match).boolean
hasActorBelow(Class parent, Class actor)
Checks whether an actor of this type is present as a default (exact match).int
indexOf(String actor)
Returns the index of the actor.protected void
initialize()
Initializes the members.Actor
lastActive()
Returns the last non-skipped actor.String
set(int index, Actor actor)
Sets the actor at the given position.protected void
setActors(Actor[] value)
Sets the actors to use.void
setParent(Actor value)
Sets the parent of this actor, e.g., the group it belongs to.String
setUp()
Initializes the item for flow execution.int
size()
Returns the size of the group.void
stopExecution()
Stops the execution.protected void
updateParent()
Updates the parent of all actors in this group.void
wrapUp()
Cleans up after the execution has finished.-
Methods inherited from class adams.flow.standalone.AbstractStandalone
preExecute
-
Methods inherited from class adams.flow.core.AbstractActor
annotationsTipText, backupState, canInspectOptions, canPerformSetUpCheck, compareTo, configureLogger, defineOptions, destroy, equals, execute, finalUpdateVariables, findVariables, findVariables, forCommandLine, forName, forName, getAdditionalInformation, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowActors, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getQuickInfo, 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, reset, restoreState, 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, globalInfo, 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, 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, defineOptions, getOptionManager
-
Methods inherited from interface adams.core.VariablesInspectionHandler
canInspectOptions
-
-
-
-
Method Detail
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractActor
-
getDefaultActors
protected abstract List<T> getDefaultActors()
Returns the list of default actors.- Returns:
- the default actors
-
getActorFilter
protected Class[] getActorFilter()
Returns the classes that the flow editor uses for filtering.- Returns:
- the classes
-
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
- Returns:
- the info
-
setParent
public void setParent(Actor value)
Sets the parent of this actor, e.g., the group it belongs to.- Specified by:
setParent
in interfaceActor
- Overrides:
setParent
in classAbstractActor
- Parameters:
value
- the new parent
-
updateParent
protected void updateParent()
Updates the parent of all actors in this group.
-
checkActors
protected String checkActors(Actor[] actors)
Checks the actors whether they are of the correct type.- Parameters:
actors
- the actor to check- Returns:
- null if OK, otherwise the error message
-
checkActor
protected String checkActor(Actor actor)
Checks the actor whether it is of the correct type.- Parameters:
actor
- the actor to check- Returns:
- null if OK, otherwise the error message
-
checkActor
protected String checkActor(Actor actor, int index)
Checks the actor whether it is of the correct type.- Parameters:
actor
- the actor to checkindex
- the index of actor, ignored if -1- Returns:
- null if OK, otherwise the error message
-
size
public int size()
Returns the size of the group.- Specified by:
size
in interfaceActorHandler
- Returns:
- the size, always 2
-
setActors
protected void setActors(Actor[] value)
Sets the actors to use.- Parameters:
value
- the actors
-
getActors
protected Actor[] getActors()
Returns the actors to use.- Returns:
- the actors
-
get
public Actor get(int index)
Returns the actor at the given position.- Specified by:
get
in interfaceActorHandler
- 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
- 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
- Parameters:
actor
- the name of the actor to look for- Returns:
- the index of -1 if not found
-
check
public abstract String check()
Performs checks on the "sub-actors".- Specified by:
check
in interfaceActorHandler
- Returns:
- null if everything is fine, otherwise the error
-
firstActive
public Actor firstActive()
Returns the first non-skipped actor.- Specified by:
firstActive
in interfaceActorHandler
- Returns:
- the first 'active' actor, null if none available
-
lastActive
public Actor lastActive()
Returns the last non-skipped actor.- Specified by:
lastActive
in interfaceActorHandler
- Returns:
- the last 'active' actor, null if none available
-
find
public Actor find(String name)
Finds the actor with the specified name recursively.- Parameters:
name
- the name of the actor- Returns:
- the actor, null if not found
-
hasActor
public boolean hasActor(Class actor)
Checks whether an actor of this type is present as a default (exact match).- Parameters:
actor
- the actor type to check- Returns:
- true if such an actor is present
-
getActors
public <A extends Actor> List<A> getActors(Class<A> actor)
Returns a list of actors comprising of the requested actor type (exact match).- Type Parameters:
A
- the type- Parameters:
actor
- the actor type too look here- Returns:
- the list of actors that were located
-
hasActorBelow
public boolean hasActorBelow(Class parent, Class actor)
Checks whether an actor of this type is present as a default (exact match).- Parameters:
parent
- the parent the actor needs to be below (assumed to be ActorHandler, uses first occurrence)actor
- the actor type to check- Returns:
- true if such an actor is present
-
getActorsBelow
public <A extends Actor> List<A> getActorsBelow(Class parent, Class<A> actor)
Returns a list of actors comprising of the requested actor type (exact match).- Type Parameters:
A
- the type- Parameters:
parent
- the parent the actors need to be below (assumed to be ActorHandler, uses first occurrence)actor
- the actor type too look here- Returns:
- the list of actors that were located
-
forceVariables
protected void forceVariables(Variables value)
Updates the Variables instance in use.
Use with caution!- Overrides:
forceVariables
in classAbstractActor
- Parameters:
value
- the instance to use
-
setUp
public String setUp()
Initializes the item for flow execution.- Specified by:
setUp
in interfaceActor
- Overrides:
setUp
in classAbstractActor
- Returns:
- null if everything is fine, otherwise error message
- See Also:
AbstractActor.reset()
-
doExecute
protected abstract String doExecute()
Executes the flow item.- Specified by:
doExecute
in classAbstractActor
- Returns:
- null if everything is fine, otherwise error message
-
flushExecution
public void flushExecution()
Stops the processing of tokens without stopping the flow.- Specified by:
flushExecution
in interfaceActorHandler
- Specified by:
flushExecution
in interfaceFlushable
-
stopExecution
public void stopExecution()
Stops the execution. No message set.- Specified by:
stopExecution
in interfaceActor
- Specified by:
stopExecution
in interfaceStoppable
- Overrides:
stopExecution
in classAbstractActor
-
wrapUp
public void wrapUp()
Cleans up after the execution has finished. Graphical output is left untouched.- Specified by:
wrapUp
in interfaceActor
- Overrides:
wrapUp
in classAbstractActor
-
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 classAbstractActor
-
-