Package adams.flow.processor
Class UpdateVariableName
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,ShallowCopySupporter<ActorProcessor>
,SizeOfHandler
,ActorProcessor
,ModifyingProcessor
,Serializable
,Comparable<ActorProcessor>
public class UpdateVariableName extends AbstractNameUpdater<VariableName>
Updates all occurrences of the old variable name with the new one.
Processes either attached variables or variables that are a part of an object that is derived from adams.core.base.BaseObject.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-old-name <java.lang.String> (property: oldName) The old variable name to replace with the new one. default:
-new-name <java.lang.String> (property: newName) The new variable name that replaces the old one. default:
- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class adams.flow.processor.AbstractNameUpdater
m_NewName, m_OldName
-
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 UpdateVariableName()
-
Method Summary
All Methods Instance 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).protected VariableName
getReplacement(VariableName old, String newName)
Returns the replacement object.String
globalInfo()
Returns a string describing the object.protected boolean
isBaseClassMatch(Class cls)
Returns whether the base class that we're looking for to perform the replacement on is a match.protected boolean
isNameMatch(VariableName old, String oldName)
Checks whether the located object matches the old name that requires replacement.String
newNameTipText()
Returns the tip text for this property.String
oldNameTipText()
Returns the tip text for this property.protected void
processArgumentOption(AbstractArgumentOption option)
Processes the specified argument option.protected boolean
processBaseObject(AbstractArgumentOption option)
Updates variables in BaseObject derived values.-
Methods inherited from class adams.flow.processor.AbstractNameUpdater
canRecurse, createPrefix, defineOptions, getNewName, getOldName, processActor, setNewName, setOldName
-
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 String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractNameUpdater<VariableName>
- Returns:
- a description suitable for displaying in the gui
-
oldNameTipText
public String oldNameTipText()
Returns the tip text for this property.- Specified by:
oldNameTipText
in classAbstractNameUpdater<VariableName>
- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
newNameTipText
public String newNameTipText()
Returns the tip text for this property.- Specified by:
newNameTipText
in classAbstractNameUpdater<VariableName>
- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
isBaseClassMatch
protected boolean isBaseClassMatch(Class cls)
Returns whether the base class that we're looking for to perform the replacement on is a match.- Specified by:
isBaseClassMatch
in classAbstractNameUpdater<VariableName>
- Parameters:
cls
- the class to check- Returns:
- true if a match
-
canRecurse
public boolean canRecurse(Class cls)
Returns whether the traverser can recurse the specified class (base class from a ClassOption).
Does not recurse intoLocalScopeTrigger
andFlow
actors.- Overrides:
canRecurse
in classAbstractNameUpdater<VariableName>
- Parameters:
cls
- the class 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.- Overrides:
canProcessClassOptions
in classAbstractNameUpdater<VariableName>
- Returns:
- true if can be processed
-
isNameMatch
protected boolean isNameMatch(VariableName old, String oldName)
Checks whether the located object matches the old name that requires replacement.- Specified by:
isNameMatch
in classAbstractNameUpdater<VariableName>
- Parameters:
old
- the old object to checkoldName
- the old name to look for- Returns:
- true if a match
-
getReplacement
protected VariableName getReplacement(VariableName old, String newName)
Returns the replacement object.- Specified by:
getReplacement
in classAbstractNameUpdater<VariableName>
- Parameters:
old
- the old objectnewName
- the new name to use- Returns:
- the replacement object, null in case of error
-
processBaseObject
protected boolean processBaseObject(AbstractArgumentOption option)
Updates variables in BaseObject derived values.- Parameters:
option
- the option to process- Returns:
- true if modified
-
processArgumentOption
protected void processArgumentOption(AbstractArgumentOption option)
Processes the specified argument option.- Overrides:
processArgumentOption
in classAbstractNameUpdater<VariableName>
- Parameters:
option
- the option to process
-
-