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_Actorsthe 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 Stringcheck()Performs checks on the "sub-actors".protected StringcheckActor(Actor actor)Checks the actor whether it is of the correct type.protected StringcheckActor(Actor actor, int index)Checks the actor whether it is of the correct type.protected StringcheckActors(Actor[] actors)Checks the actors whether they are of the correct type.voidcleanUp()Cleans up after the execution has finished.protected abstract StringdoExecute()Executes the flow item.Actorfind(String name)Finds the actor with the specified name recursively.ActorfirstActive()Returns the first non-skipped actor.voidflushExecution()Stops the processing of tokens without stopping the flow.protected voidforceVariables(Variables value)Updates the Variables instance in use.Actorget(int index)Returns the actor at the given position.protected Class[]getActorFilter()Returns the classes that the flow editor uses for filtering.ActorHandlerInfogetActorHandlerInfo()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.booleanhasActor(Class actor)Checks whether an actor of this type is present as a default (exact match).booleanhasActorBelow(Class parent, Class actor)Checks whether an actor of this type is present as a default (exact match).intindexOf(String actor)Returns the index of the actor.protected voidinitialize()Initializes the members.ActorlastActive()Returns the last non-skipped actor.Stringset(int index, Actor actor)Sets the actor at the given position.protected voidsetActors(Actor[] value)Sets the actors to use.voidsetParent(Actor value)Sets the parent of this actor, e.g., the group it belongs to.StringsetUp()Initializes the item for flow execution.intsize()Returns the size of the group.voidstopExecution()Stops the execution.protected voidupdateParent()Updates the parent of all actors in this group.voidwrapUp()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:
initializein 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:
getActorHandlerInfoin 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:
setParentin interfaceActor- Overrides:
setParentin 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:
sizein 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:
getin 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:
setin 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:
indexOfin 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:
checkin interfaceActorHandler- Returns:
- null if everything is fine, otherwise the error
-
firstActive
public Actor firstActive()
Returns the first non-skipped actor.- Specified by:
firstActivein interfaceActorHandler- Returns:
- the first 'active' actor, null if none available
-
lastActive
public Actor lastActive()
Returns the last non-skipped actor.- Specified by:
lastActivein 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:
forceVariablesin classAbstractActor- Parameters:
value- the instance to use
-
setUp
public String setUp()
Initializes the item for flow execution.- Specified by:
setUpin interfaceActor- Overrides:
setUpin 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:
doExecutein 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:
flushExecutionin interfaceActorHandler- Specified by:
flushExecutionin interfaceFlushable
-
stopExecution
public void stopExecution()
Stops the execution. No message set.- Specified by:
stopExecutionin interfaceActor- Specified by:
stopExecutionin interfaceStoppable- Overrides:
stopExecutionin classAbstractActor
-
wrapUp
public void wrapUp()
Cleans up after the execution has finished. Graphical output is left untouched.- Specified by:
wrapUpin interfaceActor- Overrides:
wrapUpin classAbstractActor
-
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 classAbstractActor
-
-