Package adams.core
Class NumericStringCompare
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.core.NumericStringCompare
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,SizeOfHandler
,Serializable
,Comparator<String>
public class NumericStringCompare extends AbstractOptionHandler implements Comparator<String>, Serializable, QuickInfoSupporter
Compares the numeric portion of two String objects by extracting it using the supplied regexp.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected BaseRegExp
m_Find
the string to find.protected String
m_Replace
the replacement string.-
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 NumericStringCompare()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(String o1, String o2)
Compares its two arguments for order.void
defineOptions()
Adds options to the internal list of options.boolean
equals(Object obj)
Indicates whether some other object is "equal to" this Comparator.String
findTipText()
Returns the tip text for this property.BaseRegExp
getFind()
Returns the string to find (regular expression).String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.String
getReplace()
Returns the string to replace the occurences with.String
globalInfo()
Returns a string describing the object.String
replaceTipText()
Returns the tip text for this property.void
setFind(BaseRegExp value)
Sets the string to find (regular expression).void
setReplace(String value)
Sets the string to replace the occurrences with.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, 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 java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_Find
protected BaseRegExp m_Find
the string to find.
-
m_Replace
protected String m_Replace
the replacement string.
-
-
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 classAbstractOptionHandler
-
setFind
public void setFind(BaseRegExp value)
Sets the string to find (regular expression).- Parameters:
value
- the string
-
getFind
public BaseRegExp getFind()
Returns the string to find (regular expression).- Returns:
- the string
-
findTipText
public String findTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setReplace
public void setReplace(String value)
Sets the string to replace the occurrences with.- Parameters:
value
- the string
-
getReplace
public String getReplace()
Returns the string to replace the occurences with.- Returns:
- the string
-
replaceTipText
public String replaceTipText()
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 actor, which will be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Returns:
- null if no info available, otherwise short string
-
compare
public int compare(String o1, String o2)
Compares its two arguments for order.- Specified by:
compare
in interfaceComparator<String>
- Parameters:
o1
- the first objecto2
- the second object- Returns:
- -1 if o1<o2, 0 if o1=o2 and 1 if o1&;gt;o2
-
equals
public boolean equals(Object obj)
Indicates whether some other object is "equal to" this Comparator.- Specified by:
equals
in interfaceComparator<String>
- Overrides:
equals
in classObject
- Parameters:
obj
- the object to compare with this Comparator- Returns:
- true if the object is a DefaultCompare object as well
-
-