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 BaseRegExpm_Findthe string to find.protected Stringm_Replacethe 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 intcompare(String o1, String o2)Compares its two arguments for order.voiddefineOptions()Adds options to the internal list of options.booleanequals(Object obj)Indicates whether some other object is "equal to" this Comparator.StringfindTipText()Returns the tip text for this property.BaseRegExpgetFind()Returns the string to find (regular expression).StringgetQuickInfo()Returns a quick info about the actor, which will be displayed in the GUI.StringgetReplace()Returns the string to replace the occurences with.StringglobalInfo()Returns a string describing the object.StringreplaceTipText()Returns the tip text for this property.voidsetFind(BaseRegExp value)Sets the string to find (regular expression).voidsetReplace(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:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin 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:
getQuickInfoin 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:
comparein 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:
equalsin interfaceComparator<String>- Overrides:
equalsin classObject- Parameters:
obj- the object to compare with this Comparator- Returns:
- true if the object is a DefaultCompare object as well
-
-