Package adams.data.report
Class AbstractReportFilter<T extends DataContainer>
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.report.AbstractReportFilter<T>
-
- Type Parameters:
T- the type of data handled by the filter
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,ShallowCopySupporter<AbstractReportFilter>,SizeOfHandler,Serializable,Comparable
- Direct Known Subclasses:
AbstractDatabaseConnectionReportFilter,AbstractFilteredReportFilter,AbstractScript,AbstractScriptedReportFilter,PassThrough,RemoveByDataType,RemoveByName
public abstract class AbstractReportFilter<T extends DataContainer> extends AbstractOptionHandler implements Comparable, ShallowCopySupporter<AbstractReportFilter>
Abstract base class for filters that process Reports. 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
-
-
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 AbstractReportFilter()
-
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.booleanequals(Object o)Returns whether the two objects are the same.Tfilter(T data)Filters the data.static AbstractReportFilterforCommandLine(String cmdline)Instantiates the filter from the given commandline (i.e., classname and optional options).static AbstractReportFilterforName(String classname, String[] options)Instantiates the filter with the given options.static String[]getFilters()Returns a list with classnames of filters.protected abstract TprocessData(T data)Performs the actual filtering.protected voidreset()Resets the filter.AbstractReportFiltershallowCopy()Returns a shallow copy of itself, i.e., based on the commandline options.AbstractReportFiltershallowCopy(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, 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 filter. 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.
-
filter
public T filter(T data)
Filters the data.- Parameters:
data- the data to filter- Returns:
- the filtered data
-
checkData
protected void checkData(T data)
The default implementation only checks whether there is any data set.- Parameters:
data- the data to filter
-
processData
protected abstract T processData(T data)
Performs the actual filtering.- Parameters:
data- the data to filter- Returns:
- the filtered 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 AbstractReportFilter 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 AbstractReportFilter 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
-
getFilters
public static String[] getFilters()
Returns a list with classnames of filters.- Returns:
- the filter classnames
-
forName
public static AbstractReportFilter 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 AbstractReportFilter 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
-
-