Package adams.data.weka.rowfinder
Class AbstractRowFinder
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.weka.rowfinder.AbstractRowFinder
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,ShallowCopySupporter<RowFinder>,SizeOfHandler,RowFinder,Serializable
- Direct Known Subclasses:
AbstractRowFinderWithCapabilities,AbstractTrainableRowFinder,AllFinder,ByLabel,ByNumericRange,ByNumericValue,Constant,NullFinder
public abstract class AbstractRowFinder extends AbstractOptionHandler implements RowFinder, ShallowCopySupporter<RowFinder>
Ancestor for classes that find rows of interest in datasets.- 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 AbstractRowFinder()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static HashSet<Integer>arrayToHashSet(int[] indices)Turns the array into a hashset.protected voidcheck(weka.core.Instances data)Checks the data.intcompareTo(Object o)Compares this object with the specified object for order.protected abstract int[]doFindRows(weka.core.Instances data)Returns the rows of interest in the dataset.booleanequals(Object o)Returns whether the two objects are the same.int[]findRows(weka.core.Instances data)Returns the rows of interest in the dataset.static RowFinderforCommandLine(String cmdline)Instantiates the row finder from the given commandline (i.e., classname and optional options).static RowFinderforName(String classname, String[] options)Instantiates the row finder with the given options.static String[]getRowFinders()Returns a list with classnames of row finders.RowFindershallowCopy()Returns a shallow copy of itself, i.e., based on the commandline options.RowFindershallowCopy(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.Destroyable
destroy
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, defineOptions, getOptionManager, toCommandLine
-
-
-
-
Method Detail
-
check
protected void check(weka.core.Instances data)
Checks the data.
Default implementation only checks whether we have any data at all.- Parameters:
data- the data to check
-
doFindRows
protected abstract int[] doFindRows(weka.core.Instances data)
Returns the rows of interest in the dataset.- Parameters:
data- the dataset to inspect- Returns:
- the rows of interest
-
findRows
public int[] findRows(weka.core.Instances data)
Returns the rows of interest in the dataset.
-
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.- 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 RowFinder shallowCopy()
Returns a shallow copy of itself, i.e., based on the commandline options.- Specified by:
shallowCopyin interfaceShallowCopySupporter<RowFinder>- Returns:
- the shallow copy
-
shallowCopy
public RowFinder shallowCopy(boolean expand)
Returns a shallow copy of itself, i.e., based on the commandline options.- Specified by:
shallowCopyin interfaceShallowCopySupporter<RowFinder>- Parameters:
expand- whether to expand variables to their current values- Returns:
- the shallow copy
-
getRowFinders
public static String[] getRowFinders()
Returns a list with classnames of row finders.- Returns:
- the row finder classnames
-
forName
public static RowFinder forName(String classname, String[] options)
Instantiates the row finder with the given options.- Parameters:
classname- the classname of the row finder to instantiateoptions- the options for the row finder- Returns:
- the instantiated row finder or null if an error occurred
-
forCommandLine
public static RowFinder forCommandLine(String cmdline)
Instantiates the row finder from the given commandline (i.e., classname and optional options).- Parameters:
cmdline- the classname (and optional options) of the row finder to instantiate- Returns:
- the instantiated row finder or null if an error occurred
-
-