Package adams.flow.template
Class AbstractActorTemplate
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.template.AbstractActorTemplate
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,ShallowCopySupporter<AbstractActorTemplate>
,SizeOfHandler
,Serializable
- Direct Known Subclasses:
AbstractScript
,AbstractScriptedTemplate
,DummySink
,DummySource
,DummyStandalone
,DummyTransformer
,EndlessLoop
,FileProcessingWithProgressBar
,FromFile
,InstanceDumperVariable
,IterateFilesWithProgressBar
,OptionTraverser
,ProgressInConsole
,PromptUser
,SimpleMenu
,StoreFilenameInVariable
,StoreReportValueInVariable
,UpdateVariable
public abstract class AbstractActorTemplate extends AbstractOptionHandler implements ShallowCopySupporter<AbstractActorTemplate>
Ancestor for generators that use templates for generating Actor objects.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected String
m_Name
the new name for the generated actor.-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AbstractActorTemplate()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description int
compareTo(Object o)
Compares this object with the specified object for order.void
defineOptions()
Adds options to the internal list of options.protected abstract Actor
doGenerate()
Generates the actor.boolean
equals(Object o)
Returns whether the two objects are the same.static AbstractActorTemplate
forCommandLine(String cmdline)
Instantiates the template generator scheme from the given commandline (i.e., classname and optional options).static AbstractActorTemplate
forName(String classname, String[] options)
Instantiates the template generator scheme with the given options.Actor
generate()
Returns the generated actor.static String[]
getBaselineCorrections()
Returns a list with classnames of template generator schemes.protected String
getDefaultName()
Returns the default name.String
getName()
Returns the new name for the actor.abstract boolean
isInteractive()
Whether the flow generated is an interactive one.String
nameTipText()
Returns the tip text for this property.protected Actor
postGenerate(Actor actor)
Hook before generating the actor.protected void
preGenerate()
Hook before generating the actor.void
setName(String value)
Sets the new name for the actor.AbstractActorTemplate
shallowCopy()
Returns a shallow copy of itself, i.e., based on the commandline options.AbstractActorTemplate
shallowCopy(boolean expand)
Returns a shallow copy of itself, i.e., based on the commandline options.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_Name
protected String m_Name
the new name for the generated actor.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
getDefaultName
protected String getDefaultName()
Returns the default name.- Returns:
- the default
-
setName
public void setName(String value)
Sets the new name for the actor. Empty string uses the current one.- Parameters:
value
- the name
-
getName
public String getName()
Returns the new name for the actor. Empty String uses the current one.- Returns:
- the name
-
nameTipText
public String nameTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
isInteractive
public abstract boolean isInteractive()
Whether the flow generated is an interactive one.- Returns:
- true if interactive
-
preGenerate
protected void preGenerate()
Hook before generating the actor.
Default implementation does nothing.
-
doGenerate
protected abstract Actor doGenerate()
Generates the actor.- Returns:
- the generated acto
-
postGenerate
protected Actor postGenerate(Actor actor)
Hook before generating the actor.
Default implementation just updates the name of the actor, if necessary.- Parameters:
actor
- the actor to post-process- Returns:
- the processed actor
-
generate
public Actor generate()
Returns the generated actor.- Returns:
- the actor
-
shallowCopy
public AbstractActorTemplate shallowCopy()
Returns a shallow copy of itself, i.e., based on the commandline options.- Specified by:
shallowCopy
in interfaceShallowCopySupporter<AbstractActorTemplate>
- Returns:
- the shallow copy
-
shallowCopy
public AbstractActorTemplate shallowCopy(boolean expand)
Returns a shallow copy of itself, i.e., based on the commandline options.- Specified by:
shallowCopy
in interfaceShallowCopySupporter<AbstractActorTemplate>
- Parameters:
expand
- whether to expand variables to their current values- Returns:
- the shallow copy
-
compareTo
public int compareTo(Object o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Only compares the commandlines of the two objects.- Parameters:
o
- the object to be compared.- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
- Throws:
ClassCastException
- if the specified object's type prevents it from being compared to this object.
-
equals
public boolean equals(Object o)
Returns whether the two objects are the same.
Only compares the commandlines of the two objects.
-
getBaselineCorrections
public static String[] getBaselineCorrections()
Returns a list with classnames of template generator schemes.- Returns:
- the template generator classnames
-
forName
public static AbstractActorTemplate forName(String classname, String[] options)
Instantiates the template generator scheme with the given options.- Parameters:
classname
- the classname of the template generator scheme to instantiateoptions
- the options for the template generator scheme- Returns:
- the instantiated template generator scheme or null if an error occurred
-
forCommandLine
public static AbstractActorTemplate forCommandLine(String cmdline)
Instantiates the template generator scheme from the given commandline (i.e., classname and optional options).- Parameters:
cmdline
- the classname (and optional options) of the template generator scheme to instantiate- Returns:
- the instantiated template generator scheme or null if an error occurred
-
-