Package adams.data.binning.algorithm
Class AbstractBinningAlgorithm
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.binning.algorithm.AbstractBinningAlgorithm
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,QuickInfoSupporter,SizeOfHandler,BinningAlgorithm,Serializable
- Direct Known Subclasses:
AbstractEqualWidthBinningAlgorithm,FrequencyBinning,NoBinning
public abstract class AbstractBinningAlgorithm extends AbstractOptionHandler implements BinningAlgorithm, QuickInfoSupporter
Ancestor for binning algorithms.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected intm_NumDecimalsthe number of decimals to show.-
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 AbstractBinningAlgorithm()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected <T> Stringcheck(List<Binnable<T>> objects)Hook method for performing checks before binning.voiddefineOptions()Adds options to the internal list of options.protected abstract <T> List<Bin<T>>doGenerateBins(List<Binnable<T>> objects)Performs the actual bin generation on the provided objects.protected <T> voidfillBins(List<Bin<T>> bins, List<Binnable<T>> objects)Places the binnable objects in the respective bins.<T> List<Bin<T>>generateBins(List<Binnable<T>> objects)Performs the bin generation on the provided objects.protected <T> com.github.fracpete.javautils.struct.Struct2<Double,Double>getMinMax(List<Binnable<T>> objects)Determines the min/max from the binnable objects.intgetNumDecimals()Returns the number of decimals to show in the intervals.StringgetQuickInfo()Returns a quick info about the object, which can be displayed in the GUI.StringnumDecimalsTipText()Returns the tip text for this property.voidsetNumDecimals(int value)Sets the number of decimals to show in intervals.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, 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, equals, 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, getOptionManager, toCommandLine
-
-
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractOptionHandler
-
setNumDecimals
public void setNumDecimals(int value)
Sets the number of decimals to show in intervals.- Parameters:
value- the number of decimals
-
getNumDecimals
public int getNumDecimals()
Returns the number of decimals to show in the intervals.- Returns:
- the number of decimals
-
numDecimalsTipText
public String numDecimalsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.
Default implementation returns null.- Specified by:
getQuickInfoin interfaceQuickInfoSupporter- Returns:
- null if no info available, otherwise short string
-
check
protected <T> String check(List<Binnable<T>> objects)
Hook method for performing checks before binning.- Parameters:
objects- the objects to bin- Returns:
- null if successful, otherwise error message
-
getMinMax
protected <T> com.github.fracpete.javautils.struct.Struct2<Double,Double> getMinMax(List<Binnable<T>> objects)
Determines the min/max from the binnable objects.- Parameters:
objects- the objects to determine the min/max from (using their associated value)- Returns:
- the min/max
-
doGenerateBins
protected abstract <T> List<Bin<T>> doGenerateBins(List<Binnable<T>> objects)
Performs the actual bin generation on the provided objects.- Parameters:
objects- the objects to bin- Returns:
- the generated bins
- Throws:
IllegalStateException- if binning fails
-
fillBins
protected <T> void fillBins(List<Bin<T>> bins, List<Binnable<T>> objects)
Places the binnable objects in the respective bins.- Parameters:
bins- the bins to fillobjects- the objects to distribute
-
generateBins
public <T> List<Bin<T>> generateBins(List<Binnable<T>> objects)
Performs the bin generation on the provided objects.- Specified by:
generateBinsin interfaceBinningAlgorithm- Parameters:
objects- the objects to bin- Returns:
- the generated bins
- Throws:
IllegalStateException- if check or binning fails
-
-