Class AbstractColumnStatistic
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.spreadsheet.colstatistic.AbstractColumnStatistic
-
- All Implemented Interfaces:
Destroyable
,ErrorProvider
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,Serializable
- Direct Known Subclasses:
AbstractDoubleArrayColumnStatistic
,Distinct
,LabelCounts
,Missing
,MultiColumnStatistic
,Unique
public abstract class AbstractColumnStatistic extends AbstractOptionHandler implements ErrorProvider
Ancestor for column statistic generators.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected String
m_LastError
the last error that was generated.-
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 AbstractColumnStatistic()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected String
check(SpreadSheet sheet, int colIndex)
Checks whether the spreadsheet can be handled.protected SpreadSheet
createOutputHeader()
Generates the header for the statistics result.protected SpreadSheet
doGenerate(SpreadSheet sheet, int colIndex)
Performs the actual generation of statistics for the specified spreadsheet column.protected abstract void
doVisit(Row row, int colIndex)
Gets called with every row in the spreadsheet for generating the stats.SpreadSheet
generate(SpreadSheet sheet, int colIndex)
Generates statistics for the specified spreadsheet column.String
getLastError()
Returns the last error that occurred.boolean
hasLastError()
Checks whether there was an error with the last stats generation.protected abstract SpreadSheet
postVisit(SpreadSheet sheet, int colIndex)
Finishes up the stats generation after all the cells have been visited.protected abstract void
preVisit(SpreadSheet sheet, int colIndex)
Performs initialization before the cells are being visited.-
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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_LastError
protected String m_LastError
the last error that was generated.
-
-
Method Detail
-
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, int colIndex)
Checks whether the spreadsheet can be handled.- Parameters:
sheet
- the spreadsheet to checkcolIndex
- the column index- Returns:
- null if everythin ok, otherwise error message
-
createOutputHeader
protected SpreadSheet createOutputHeader()
Generates the header for the statistics result.- Returns:
- the generated header
-
preVisit
protected abstract void preVisit(SpreadSheet sheet, int colIndex)
Performs initialization before the cells are being visited.- Parameters:
sheet
- the spreadsheet to generate the stats forcolIndex
- the column index
-
doVisit
protected abstract void doVisit(Row row, int colIndex)
Gets called with every row in the spreadsheet for generating the stats.- Parameters:
row
- the current rowcolIndex
- the column index
-
postVisit
protected abstract SpreadSheet postVisit(SpreadSheet sheet, int colIndex)
Finishes up the stats generation after all the cells have been visited.- Parameters:
sheet
- the spreadsheet to generate the stats forcolIndex
- the column index- Returns:
- the generated stats
-
doGenerate
protected SpreadSheet doGenerate(SpreadSheet sheet, int colIndex)
Performs the actual generation of statistics for the specified spreadsheet column.- Parameters:
sheet
- the spreadsheet to generate the stats forcolIndex
- the column index- Returns:
- the generated statistics, null in case of an error
-
generate
public SpreadSheet generate(SpreadSheet sheet, int colIndex)
Generates statistics for the specified spreadsheet column.- Parameters:
sheet
- the spreadsheet to generate the stats forcolIndex
- the column index- Returns:
- the generated statistics, null in case of an error
-
-