Package adams.data.multifilter
Class AbstractMultiSpectrumFilter
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.multifilter.AbstractMultiSpectrumFilter
-
- All Implemented Interfaces:
adams.core.CleanUpHandler
,adams.core.Destroyable
,adams.core.GlobalInfoSupporter
,adams.core.logging.LoggingLevelHandler
,adams.core.logging.LoggingSupporter
,adams.core.option.OptionHandler
,adams.core.ShallowCopySupporter<AbstractMultiSpectrumFilter>
,adams.core.SizeOfHandler
,Serializable
,Comparable
- Direct Known Subclasses:
AbstractFormatsBasedMultiSpectrumFilter
,FilteredMultiSpectrumFilter
,PickByIndex
,PickByReportValue
public abstract class AbstractMultiSpectrumFilter extends adams.core.option.AbstractOptionHandler implements Comparable, adams.core.CleanUpHandler, adams.core.ShallowCopySupporter<AbstractMultiSpectrumFilter>
Abstract base class for multi-spectrum filters. Derived classes only have to override theprocessData()
method. Thereset()
method can be used to reset an algorithms internal state, e.g., after setting options, which invalidate the previously generated data.- Version:
- $Revision: 7774 $
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_DontUpdateID
whether to suppress updating of ID.
-
Constructor Summary
Constructors Constructor Description AbstractMultiSpectrumFilter()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
checkData(MultiSpectrum data)
The default implementation only checks whether there is any data set.void
cleanUp()
Cleans up data structures, frees up memory.int
compareTo(Object o)
Compares this object with the specified object for order.void
defineOptions()
Adds options to the internal list of options.void
destroy()
Frees up memory in a "destructive" non-reversible way.String
dontUpdateIDTipText()
Returns the tip text for this property.boolean
equals(Object o)
Returns whether the two objects are the same.Spectrum
filter(MultiSpectrum data)
Returns the filtered data.static AbstractMultiSpectrumFilter
forCommandLine(String cmdline)
Instantiates the filter from the given commandline (i.e., classname and optional options).static AbstractMultiSpectrumFilter
forName(String classname, String[] options)
Instantiates the filter with the given options.boolean
getDontUpdateID()
Returns whether ID update is suppressed.static String[]
getFilters()
Returns a list with classnames of filters.protected abstract Spectrum
processData(MultiSpectrum data)
Performs the actual filtering.void
reset()
Resets the filter.void
setDontUpdateID(boolean value)
Sets whether ID update is suppressed.AbstractMultiSpectrumFilter
shallowCopy()
Returns a shallow copy of itself, i.e., based on the commandline options.AbstractMultiSpectrumFilter
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, 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:
defineOptions
in interfaceadams.core.option.OptionHandler
- Overrides:
defineOptions
in classadams.core.option.AbstractOptionHandler
-
setDontUpdateID
public void setDontUpdateID(boolean value)
Sets whether ID update is suppressed.- Parameters:
value
- true if to suppress
-
getDontUpdateID
public boolean getDontUpdateID()
Returns whether ID update is suppressed.- Returns:
- true if suppressed
-
dontUpdateIDTipText
public String dontUpdateIDTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
reset
public void reset()
Resets the filter. Derived classes must call this method in set-methods of parameters to assure the invalidation of previously generated data.- Overrides:
reset
in classadams.core.option.AbstractOptionHandler
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory. Sets the input and generated data to null.- Specified by:
cleanUp
in interfaceadams.core.CleanUpHandler
-
destroy
public void destroy()
Frees up memory in a "destructive" non-reversible way.
Calls cleanUp() and cleans up the options.- Specified by:
destroy
in interfaceadams.core.Destroyable
- Overrides:
destroy
in classadams.core.option.AbstractOptionHandler
-
filter
public Spectrum filter(MultiSpectrum data)
Returns the filtered data.- Parameters:
data
- the data to filter- Returns:
- the filtered data
-
checkData
protected void checkData(MultiSpectrum data)
The default implementation only checks whether there is any data set.- Parameters:
data
- the data to filter
-
processData
protected abstract Spectrum processData(MultiSpectrum data)
Performs the actual filtering.- Parameters:
data
- the data to filter- Returns:
- the filtered data, null if failed to generate output
-
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
- 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 AbstractMultiSpectrumFilter shallowCopy()
Returns a shallow copy of itself, i.e., based on the commandline options.- Specified by:
shallowCopy
in interfaceadams.core.ShallowCopySupporter<AbstractMultiSpectrumFilter>
- Returns:
- the shallow copy
-
shallowCopy
public AbstractMultiSpectrumFilter shallowCopy(boolean expand)
Returns a shallow copy of itself, i.e., based on the commandline options.- Specified by:
shallowCopy
in interfaceadams.core.ShallowCopySupporter<AbstractMultiSpectrumFilter>
- Parameters:
expand
- whether to expand variables to their current values- Returns:
- the shallow copy
-
getFilters
public static String[] getFilters()
Returns a list with classnames of filters.- Returns:
- the filter classnames
-
forName
public static AbstractMultiSpectrumFilter 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 AbstractMultiSpectrumFilter 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
-
-