Package adams.data.smoothing
Class AbstractSmoother<T extends DataContainer>
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.smoothing.AbstractSmoother<T>
-
- Type Parameters:
T- the type of container to process
- All Implemented Interfaces:
CleanUpHandler,Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,ShallowCopySupporter<AbstractSmoother>,SizeOfHandler,Serializable,Comparable
- Direct Known Subclasses:
AbstractDatabaseConnectionSmoother,AbstractLOWESSBased,AbstractSavitzkyGolayBased,AbstractSlidingWindow,PassThrough
public abstract class AbstractSmoother<T extends DataContainer> extends AbstractOptionHandler implements Comparable, CleanUpHandler, ShallowCopySupporter<AbstractSmoother>
Abstract base class for smoothing schemes. Derived classes only have to override theprocessData(T)method. Thereset()method can be used to reset an algorithms internal state.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractSmoother.SmootherJob<T extends DataContainer>A job class specific to smoothing schemes.
-
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 AbstractSmoother()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcheckData(T data)The default implementation only checks whether there is any data set.voidcleanUp()Cleans up data structures, frees up memory.intcompareTo(Object o)Compares this object with the specified object for order.voiddestroy()Frees up memory in a "destructive" non-reversible way.booleanequals(Object o)Returns whether the two objects are the same.static AbstractSmootherforCommandLine(String cmdline)Instantiates the smoothing scheme from the given commandline (i.e., classname and optional options).static AbstractSmootherforName(String classname, String[] options)Instantiates the smoothing scheme with the given options.static String[]getSmoothers()Returns a list with classnames of smoothing schemes.protected abstract TprocessData(T data)Performs the actual smoothing.protected voidreset()Resets the smoothing scheme (but does not clear the input data!).AbstractSmoothershallowCopy()Returns a shallow copy of itself, i.e., based on the commandline options.AbstractSmoothershallowCopy(boolean expand)Returns a shallow copy of itself, i.e., based on the commandline options.Tsmooth(T data)Returns the smoothed data, smooths the original data first if necessary.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, defineOptions, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, 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, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Method Detail
-
reset
protected void reset()
Resets the smoothing scheme (but does not clear the input data!). Derived classes must call this method in set-methods of parameters to assure the invalidation of previously generated data.- Overrides:
resetin classAbstractOptionHandler
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory. Sets the input data to null.- Specified by:
cleanUpin interfaceCleanUpHandler
-
destroy
public void destroy()
Frees up memory in a "destructive" non-reversible way.
Calls cleanUp() and cleans up the options.- Specified by:
destroyin interfaceDestroyable- Overrides:
destroyin classAbstractOptionHandler- See Also:
AbstractOptionHandler.cleanUpOptions()
-
smooth
public T smooth(T data)
Returns the smoothed data, smooths the original data first if necessary.- Parameters:
data- the data to smooth- Returns:
- the smoothed data
-
checkData
protected void checkData(T data)
The default implementation only checks whether there is any data set.- Parameters:
data- the data to check
-
processData
protected abstract T processData(T data)
Performs the actual smoothing.- Parameters:
data- the to smooth- Returns:
- the smoothed data
-
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:
compareToin interfaceComparable<T extends DataContainer>- 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 AbstractSmoother shallowCopy()
Returns a shallow copy of itself, i.e., based on the commandline options.- Specified by:
shallowCopyin interfaceShallowCopySupporter<T extends DataContainer>- Returns:
- the shallow copy
-
shallowCopy
public AbstractSmoother shallowCopy(boolean expand)
Returns a shallow copy of itself, i.e., based on the commandline options.- Specified by:
shallowCopyin interfaceShallowCopySupporter<T extends DataContainer>- Parameters:
expand- whether to expand variables to their current values- Returns:
- the shallow copy
-
getSmoothers
public static String[] getSmoothers()
Returns a list with classnames of smoothing schemes.- Returns:
- the smoothing scheme classnames
-
forName
public static AbstractSmoother forName(String classname, String[] options)
Instantiates the smoothing scheme with the given options.- Parameters:
classname- the classname of the smoothing scheme to instantiateoptions- the options for the smoothing scheme- Returns:
- the instantiated smoothing scheme or null if an error occurred
-
forCommandLine
public static AbstractSmoother forCommandLine(String cmdline)
Instantiates the smoothing scheme from the given commandline (i.e., classname and optional options).- Parameters:
cmdline- the classname (and optional options) of the smoothing scheme to instantiate- Returns:
- the instantiated smoothing scheme or null if an error occurred
-
-