Package adams.flow.processor
Class AbstractNameUpdater<T>
-
- Type Parameters:
T
- the type of
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,ShallowCopySupporter<ActorProcessor>
,SizeOfHandler
,ActorProcessor
,ModifyingProcessor
,Serializable
,Comparable<ActorProcessor>
- Direct Known Subclasses:
UpdateCallableActorName
,UpdateEventName
,UpdateStorageName
,UpdateVariableName
public abstract class AbstractNameUpdater<T> extends AbstractModifyingProcessor
Ancestor for processors that update names of actors.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected String
m_NewName
the new name.protected String
m_OldName
the old name.-
Fields inherited from class adams.flow.processor.AbstractModifyingProcessor
m_Modified, m_ModifiedActor, m_NoCopy
-
Fields inherited from class adams.flow.processor.AbstractActorProcessor
m_Errors
-
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 AbstractNameUpdater()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected boolean
canProcessClassOptions()
Returns whether class options are treated as argument options and processed as well.boolean
canRecurse(Class cls)
Returns whether the traverser can recurse the specified class (base class from a ClassOption).boolean
canRecurse(Object obj)
Returns whether the traverser can recurse the specified object.protected String
createPrefix(AbstractOption option)
Generates a logging prefix based on the option.void
defineOptions()
Adds options to the internal list of options.String
getNewName()
Returns the new name that replaces the old one.String
getOldName()
Returns the old name to replace.protected abstract T
getReplacement(T old, String newName)
Returns the replacement object.abstract String
globalInfo()
Returns a string describing the object.protected abstract boolean
isBaseClassMatch(Class cls)
Returns whether the base class that we're looking for to perform the replacement on is a match.protected abstract boolean
isNameMatch(T old, String oldName)
Checks whether the located object matches the old name that requires replacement.abstract String
newNameTipText()
Returns the tip text for this property.abstract String
oldNameTipText()
Returns the tip text for this property.protected void
processActor(Actor actor)
Performs the actual processing.protected void
processArgumentOption(AbstractArgumentOption option)
Processes the specified argument option.void
setNewName(String value)
Sets the new name that replaces the old one.void
setOldName(String value)
Sets the old name to replace.-
Methods inherited from class adams.flow.processor.AbstractModifyingProcessor
getModifiedActor, getNoCopy, initialize, isModified, process, setNoCopy
-
Methods inherited from class adams.flow.processor.AbstractActorProcessor
addError, addError, checkData, compareTo, equals, getErrors, hasErrors, reset, shallowCopy, shallowCopy
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, 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.flow.processor.ActorProcessor
compareTo, getErrors, hasErrors, shallowCopy, shallowCopy
-
Methods inherited from interface adams.core.Destroyable
destroy
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager, toCommandLine
-
-
-
-
Method Detail
-
globalInfo
public abstract String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- 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 classAbstractOptionHandler
-
setOldName
public void setOldName(String value)
Sets the old name to replace.- Parameters:
value
- the old name
-
getOldName
public String getOldName()
Returns the old name to replace.- Returns:
- the old name
-
oldNameTipText
public abstract String oldNameTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setNewName
public void setNewName(String value)
Sets the new name that replaces the old one.- Parameters:
value
- the new name
-
getNewName
public String getNewName()
Returns the new name that replaces the old one.- Returns:
- the new name
-
newNameTipText
public abstract String newNameTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
isBaseClassMatch
protected abstract boolean isBaseClassMatch(Class cls)
Returns whether the base class that we're looking for to perform the replacement on is a match.- Parameters:
cls
- the class to check- Returns:
- true if a match
-
isNameMatch
protected abstract boolean isNameMatch(T old, String oldName)
Checks whether the located object matches the old name that requires replacement.- Parameters:
old
- the old object to checkoldName
- the old name to look for- Returns:
- true if a match
-
getReplacement
protected abstract T getReplacement(T old, String newName)
Returns the replacement object.- Parameters:
old
- the old objectnewName
- the new name to use- Returns:
- the replacement object, null in case of error
-
createPrefix
protected String createPrefix(AbstractOption option)
Generates a logging prefix based on the option.- Parameters:
option
- the option to generate the prefix for- Returns:
- the prefix
-
processArgumentOption
protected void processArgumentOption(AbstractArgumentOption option)
Processes the specified argument option.- Parameters:
option
- the option to process
-
canRecurse
public boolean canRecurse(Class cls)
Returns whether the traverser can recurse the specified class (base class from a ClassOption).
Default implementation does not recurse intoFlow
actors.- Parameters:
cls
- the class to determine for whether recursing is possible or not- Returns:
- true if to traverse the options recursively
-
canRecurse
public boolean canRecurse(Object obj)
Returns whether the traverser can recurse the specified object.
Default implementation always returns return value ofcanRecurse(Class)
.- Parameters:
obj
- the Object to determine for whether recursing is possible or not- Returns:
- true if to traverse the options recursively
-
canProcessClassOptions
protected boolean canProcessClassOptions()
Returns whether class options are treated as argument options and processed as well.
Default implementation returns false.- Returns:
- true if can be processed
-
processActor
protected void processActor(Actor actor)
Performs the actual processing.- Specified by:
processActor
in classAbstractActorProcessor
- Parameters:
actor
- the actor to process- See Also:
ModifyingProcessor
-
-