Class AbstractMatrixStatistic
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.spreadsheet.matrixstatistic.AbstractMatrixStatistic
-
- All Implemented Interfaces:
Destroyable
,ErrorProvider
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,Serializable
- Direct Known Subclasses:
Max
,Mean
,Median
,Min
,Missing
,MultiMatrixStatistic
,StandardDeviation
public abstract class AbstractMatrixStatistic extends AbstractOptionHandler implements ErrorProvider
Ancestor for matrix statistic generators, i.e., ones that take the specified subset of the spreadsheet into account.- Version:
- $Revision: 9765 $
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected SpreadSheetColumnRange
m_Columns
the columns of the subset to obtain.protected String
m_LastError
the last error that was generated.protected Range
m_Rows
the rows of the subset to obtain.-
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 AbstractMatrixStatistic()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected String
check(SpreadSheet sheet)
Checks whether the spreadsheet can be handled.String
columnsTipText()
Returns the tip text for this property.protected SpreadSheet
createOutputHeader()
Generates the header for the statistics result.void
defineOptions()
Adds options to the internal list of options.protected abstract SpreadSheet
doGenerate(SpreadSheet sheet)
Performs the actual generation of statistics for the specified spreadsheet.SpreadSheet
generate(SpreadSheet sheet)
Generates statistics for the specified spreadsheet.SpreadSheetColumnRange
getColumns()
Returns the columns of the subset.String
getLastError()
Returns the last error that occurred.protected gnu.trove.list.TDoubleList
getNumericValues(SpreadSheet sheet)
Returns all the numeric values in the matrix, skipping NaN and infinity.Range
getRows()
Returns the rows of the subset.boolean
hasLastError()
Checks whether there was an error with the last stats generation.String
rowsTipText()
Returns the tip text for this property.void
setColumns(SpreadSheetColumnRange value)
Sets the columns of the subset.void
setRows(Range value)
Sets the rows of the subset.-
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.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_Rows
protected Range m_Rows
the rows of the subset to obtain.
-
m_Columns
protected SpreadSheetColumnRange m_Columns
the columns of the subset to obtain.
-
m_LastError
protected String m_LastError
the last error that was generated.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
setRows
public void setRows(Range value)
Sets the rows of the subset.- Parameters:
value
- the rows
-
getRows
public Range getRows()
Returns the rows of the subset.- Returns:
- the rows
-
rowsTipText
public String rowsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setColumns
public void setColumns(SpreadSheetColumnRange value)
Sets the columns of the subset.- Parameters:
value
- the columns
-
getColumns
public SpreadSheetColumnRange getColumns()
Returns the columns of the subset.- Returns:
- the columns
-
columnsTipText
public String columnsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
hasLastError
public boolean hasLastError()
Checks whether there was an error with the last stats generation.- Specified by:
hasLastError
in interfaceErrorProvider
- Returns:
- true if there was an error
- See Also:
getLastError()
-
getLastError
public String getLastError()
Returns the last error that occurred.- Specified by:
getLastError
in interfaceErrorProvider
- Returns:
- the last error, null if none occurred
-
check
protected String check(SpreadSheet sheet)
Checks whether the spreadsheet can be handled.- Parameters:
sheet
- the spreadsheet to check- Returns:
- null if everythin ok, otherwise error message
-
createOutputHeader
protected SpreadSheet createOutputHeader()
Generates the header for the statistics result.- Returns:
- the generated header
-
getNumericValues
protected gnu.trove.list.TDoubleList getNumericValues(SpreadSheet sheet)
Returns all the numeric values in the matrix, skipping NaN and infinity.- Parameters:
sheet
- the spreadsheet to process- Returns:
- the values
-
doGenerate
protected abstract SpreadSheet doGenerate(SpreadSheet sheet)
Performs the actual generation of statistics for the specified spreadsheet.- Parameters:
sheet
- the spreadsheet subset to generate the stats for- Returns:
- the generated statistics, null in case of an error
-
generate
public SpreadSheet generate(SpreadSheet sheet)
Generates statistics for the specified spreadsheet.- Parameters:
sheet
- the spreadsheet to generate the stats for- Returns:
- the generated statistics, null in case of an error
-
-