Package adams.data.conversion
Class SwapObjects
-
- All Implemented Interfaces:
AdditionalInformationHandler
,CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,ShallowCopySupporter<AbstractConversion>
,SizeOfHandler
,Stoppable
,Conversion
,InPlaceProcessing
,Serializable
public class SwapObjects extends AbstractSwapObject
Swaps all occurrences of one object with another one.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-no-copy <boolean> (property: noCopy) If enabled, no copy of the object is created before swapping. default: false
-old-object <adams.core.base.BaseCommandLine> (property: oldObject) The old commandline to replace. default: adams.data.conversion.StringToInt
-exact-match <boolean> (property: exactMatch) If enabled, then the complete command-line is used for comparison rather than just the class name. default: false
-new-object <adams.core.base.BaseCommandLine> (property: newObject) The new commandline to replace with. default: adams.data.conversion.StringToLong
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class adams.data.conversion.AbstractSwapObject
AbstractSwapObject.SwapObserver
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_ExactMatch
whether to use an exact match (incl options) or just the class name.protected BaseCommandLine
m_NewObject
the new object.protected BaseCommandLine
m_OldObject
the old object.protected Class
m_OldObjectClass
the class of the old object.-
Fields inherited from class adams.data.conversion.AbstractSwapObject
m_NoCopy, m_Traversal
-
Fields inherited from class adams.data.conversion.AbstractConversion
m_Input, m_Output, m_Owner, m_Stopped
-
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 SwapObjects()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
canSwap(PropertyPath.Path path, PropertyDescriptor desc, Object parent, Object child)
Checks whether a swap can be made.void
defineOptions()
Adds options to the internal list of options.String
exactMatchTipText()
Returns the tip text for this property.boolean
getExactMatch()
Returns whether to use the complete command-line for comparison rather than just the class name.BaseCommandLine
getNewObject()
Returns the new object to replace with.BaseCommandLine
getOldObject()
Returns the old object to replace.String
getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.String
globalInfo()
Returns a string describing the object.String
newObjectTipText()
Returns the tip text for this property.String
oldObjectTipText()
Returns the tip text for this property.protected boolean
performSwap(PropertyPath.Path path, PropertyDescriptor desc, Object parent, Object child)
Performs the swap.protected void
reset()
Resets the scheme.void
setExactMatch(boolean value)
Sets whether to use the complete command-line for comparison rather than just the class name.void
setNewObject(BaseCommandLine value)
Sets the new object to replace with.void
setOldObject(BaseCommandLine value)
Sets the old object to replace.-
Methods inherited from class adams.data.conversion.AbstractSwapObject
accepts, doConvert, doConvert, generates, getNoCopy, noCopyTipText, setNoCopy
-
Methods inherited from class adams.data.conversion.AbstractConversion
checkData, cleanUp, convert, getAdditionalInformation, getInput, getInput, getOutput, getOutput, getOwner, setInput, setOwner, shallowCopy, shallowCopy, stopExecution
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, 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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_OldObject
protected BaseCommandLine m_OldObject
the old object.
-
m_ExactMatch
protected boolean m_ExactMatch
whether to use an exact match (incl options) or just the class name.
-
m_NewObject
protected BaseCommandLine m_NewObject
the new object.
-
m_OldObjectClass
protected transient Class m_OldObjectClass
the class of the old object.
-
-
Method Detail
-
globalInfo
public 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 classAbstractSwapObject
-
reset
protected void reset()
Resets the scheme.- Overrides:
reset
in classAbstractConversion
-
setOldObject
public void setOldObject(BaseCommandLine value)
Sets the old object to replace.- Parameters:
value
- the old object
-
getOldObject
public BaseCommandLine getOldObject()
Returns the old object to replace.- Returns:
- the old object
-
oldObjectTipText
public String oldObjectTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setExactMatch
public void setExactMatch(boolean value)
Sets whether to use the complete command-line for comparison rather than just the class name.- Parameters:
value
- true if to use exact match
-
getExactMatch
public boolean getExactMatch()
Returns whether to use the complete command-line for comparison rather than just the class name.- Returns:
- true if to use exact match
-
exactMatchTipText
public String exactMatchTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setNewObject
public void setNewObject(BaseCommandLine value)
Sets the new object to replace with.- Parameters:
value
- the new object
-
getNewObject
public BaseCommandLine getNewObject()
Returns the new object to replace with.- Returns:
- the new object
-
newObjectTipText
public String newObjectTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractConversion
- Returns:
- null if no info available, otherwise short string
-
canSwap
protected boolean canSwap(PropertyPath.Path path, PropertyDescriptor desc, Object parent, Object child)
Checks whether a swap can be made.- Specified by:
canSwap
in classAbstractSwapObject
- Parameters:
path
- the current pathdesc
- the property descriptorparent
- the parent object to swapchild
- the child object to swap- Returns:
- true if swap can be done
-
performSwap
protected boolean performSwap(PropertyPath.Path path, PropertyDescriptor desc, Object parent, Object child)
Performs the swap.- Specified by:
performSwap
in classAbstractSwapObject
- Parameters:
path
- the current pathdesc
- the property descriptorparent
- the parent object to swapchild
- the child object to swap- Returns:
- true if swap was successful
-
-