Package adams.data.cleaner.spectrum
Class AbstractCleaner
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.cleaner.spectrum.AbstractCleaner
-
- All Implemented Interfaces:
adams.core.Destroyable,adams.core.GlobalInfoSupporter,adams.core.logging.LoggingLevelHandler,adams.core.logging.LoggingSupporter,adams.core.option.OptionHandler,adams.core.ShallowCopySupporter<AbstractCleaner>,adams.core.SizeOfHandler,Serializable,Comparable
- Direct Known Subclasses:
AbstractDatabaseConnectionCleaner,AbstractSerializableCleaner,MinMax,PassThrough
public abstract class AbstractCleaner extends adams.core.option.AbstractOptionHandler implements Comparable, adams.core.ShallowCopySupporter<AbstractCleaner>
Abstract base class for cleaners handlingSpectrumobjects. Derived classes only have to override thecheck(Spectrum)method. Thereset()method can be used to reset an algorithms internal state, e.g., after setting options.- Version:
- $Revision: 2355 $
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected adams.data.filter.Filterm_ActualPreFilterthe actual pre-filter to use.protected adams.flow.core.Actorm_FlowContextthe flow context.protected adams.data.filter.Filterm_PreFilterthe pre-filter to use.
-
Constructor Summary
Constructors Constructor Description AbstractCleaner()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Stringcheck(Spectrum data)Performs the check.intcompareTo(Object o)Compares this object with the specified object for order.voiddefineOptions()Adds options to the internal list of options.booleanequals(Object o)Returns whether the two objects are the same.static AbstractCleanerforCommandLine(String cmdline)Instantiates the filter from the given commandline (i.e., classname and optional options).static AbstractCleanerforName(String classname, String[] options)Instantiates the filter with the given options.static String[]getCleaners()Returns a list with classnames of filters.adams.flow.core.ActorgetFlowContext()Returns the flow context.adams.data.filter.FiltergetPreFilter()Returns the filter to use for pre-filtering the data.protected abstract StringperformCheck(Spectrum data)Performs the actual check.protected voidpreCheck(Spectrum data)Performs the some pre-checks whether the data is actually suitable.protected SpectrumpreFilter(Spectrum data)Performs the filtering.StringpreFilterTipText()Returns the tip text for this property.protected voidreset()Resets the scheme.voidsetFlowContent(adams.flow.core.Actor value)Sets the flow context.voidsetPreFilter(adams.data.filter.Filter value)Sets the filter to use for pre-filtering the data.AbstractCleanershallowCopy()Returns a shallow copy of itself, i.e., based on the commandline options.AbstractCleanershallowCopy(boolean expand)Returns a shallow copy of itself, i.e., based on the commandline options.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, initialize, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceadams.core.option.OptionHandler- Overrides:
defineOptionsin classadams.core.option.AbstractOptionHandler
-
reset
protected void reset()
Resets the scheme.- Overrides:
resetin classadams.core.option.AbstractOptionHandler
-
setPreFilter
public void setPreFilter(adams.data.filter.Filter value)
Sets the filter to use for pre-filtering the data.- Parameters:
value- the filter
-
getPreFilter
public adams.data.filter.Filter getPreFilter()
Returns the filter to use for pre-filtering the data.- Returns:
- the filter
-
preFilterTipText
public String preFilterTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setFlowContent
public void setFlowContent(adams.flow.core.Actor value)
Sets the flow context.- Parameters:
value- the context
-
getFlowContext
public adams.flow.core.Actor getFlowContext()
Returns the flow context.- Returns:
- the context, null if not available
-
preFilter
protected Spectrum preFilter(Spectrum data)
Performs the filtering.- Parameters:
data- the data to filter
-
preCheck
protected void preCheck(Spectrum data)
Performs the some pre-checks whether the data is actually suitable.- Parameters:
data- the spectrum to check
-
performCheck
protected abstract String performCheck(Spectrum data)
Performs the actual check.- Parameters:
data- the spectrum to check- Returns:
- null if ok, otherwise error message
-
check
public String check(Spectrum data)
Performs the check.- Parameters:
data- the spectrum to check- Returns:
- null if ok, otherwise error message
-
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- 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 AbstractCleaner shallowCopy()
Returns a shallow copy of itself, i.e., based on the commandline options.- Specified by:
shallowCopyin interfaceadams.core.ShallowCopySupporter<AbstractCleaner>- Returns:
- the shallow copy
-
shallowCopy
public AbstractCleaner shallowCopy(boolean expand)
Returns a shallow copy of itself, i.e., based on the commandline options.- Specified by:
shallowCopyin interfaceadams.core.ShallowCopySupporter<AbstractCleaner>- Parameters:
expand- whether to expand variables to their current values- Returns:
- the shallow copy
-
getCleaners
public static String[] getCleaners()
Returns a list with classnames of filters.- Returns:
- the filter classnames
-
forName
public static AbstractCleaner forName(String classname, String[] options)
Instantiates the filter with the given options.- Parameters:
classname- the classname of the filter to instantiateoptions- the options for the filter- Returns:
- the instantiated filter or null if an error occurred
-
forCommandLine
public static AbstractCleaner forCommandLine(String cmdline)
Instantiates the filter from the given commandline (i.e., classname and optional options).- Parameters:
cmdline- the classname (and optional options) of the filter to instantiate- Returns:
- the instantiated filter or null if an error occurred
-
-