Package adams.data.id
Class AbstractIDGenerator<T>
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.id.AbstractIDGenerator<T>
-
- Type Parameters:
T
- the data type to accept
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,ShallowCopySupporter<AbstractIDGenerator>
,SizeOfHandler
,Serializable
,Comparable
- Direct Known Subclasses:
AbstractIDFilenameGenerator
,IDGeneratorPostProcessor
public abstract class AbstractIDGenerator<T> extends AbstractOptionHandler implements Comparable, ShallowCopySupporter<AbstractIDGenerator>
Abstract base class for ID string generators. Derived classes only have to override theassemble(Object)
method. Thereset()
method can be used to reset a scheme's internal state, e.g., after setting options, which invalidate the previously generated data.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
-
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 AbstractIDGenerator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract String
assemble(Object o)
Generates the actual ID.protected void
check(Object o)
For performing checks on the provided data.int
compareTo(Object o)
Compares this object with the specified object for order.boolean
equals(Object o)
Returns whether the two objects are the same.String
generate(Object o)
Generates the ID.protected String
postProcess(String id)
For post-processing the ID.AbstractIDGenerator
shallowCopy()
Returns a shallow copy of itself, i.e., based on the commandline options.AbstractIDGenerator
shallowCopy(boolean expand)
Returns a shallow copy of itself, i.e., based on the commandline options.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, defineOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, 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 adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Method Detail
-
check
protected void check(Object o)
For performing checks on the provided data. If data doesn't pass the check then just throw an IllegalStateException.
Default implementation does nothing.- Parameters:
o
- the object to check
-
assemble
protected abstract String assemble(Object o)
Generates the actual ID.- Parameters:
o
- the object to generate the ID for- Returns:
- the generated ID
-
postProcess
protected String postProcess(String id)
For post-processing the ID.
The default implementation does nothing.- Parameters:
id
- the ID to post-process- Returns:
- the post-processed id
- See Also:
#m_MakeFilename
-
generate
public String generate(Object o)
Generates the ID.- Parameters:
o
- the object to generate the ID for- Returns:
- the generated ID
-
compareTo
public int compareTo(Object o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Only compares the commandlines of the two objects.- Specified by:
compareTo
in interfaceComparable<T>
- Parameters:
o
- the object to be compared.- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
- Throws:
ClassCastException
- if the specified object's type prevents it from being compared to this object.
-
equals
public boolean equals(Object o)
Returns whether the two objects are the same.
Only compares the commandlines of the two objects.
-
shallowCopy
public AbstractIDGenerator shallowCopy()
Returns a shallow copy of itself, i.e., based on the commandline options.- Specified by:
shallowCopy
in interfaceShallowCopySupporter<T>
- Returns:
- the shallow copy
-
shallowCopy
public AbstractIDGenerator shallowCopy(boolean expand)
Returns a shallow copy of itself, i.e., based on the commandline options.- Specified by:
shallowCopy
in interfaceShallowCopySupporter<T>
- Parameters:
expand
- whether to expand variables to their current values- Returns:
- the shallow copy
-
-