Package adams.data.featureconverter
Class AbstractFeatureConverter<D,R>
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.featureconverter.AbstractFeatureConverter<D,R>
-
- Type Parameters:
D
- the type of dataset that is generatedR
- the type of row that is generated
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,SizeOfHandler
,Serializable
- Direct Known Subclasses:
AbstractMetaFeatureConverter
,FeatureContainer
,FixedColumnText
,SpreadSheet
,Text
,Weka
public abstract class AbstractFeatureConverter<D,R> extends AbstractOptionHandler implements QuickInfoSupporter
Ancestor for generic feature converter schemes.- 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_Dataset
the name of the dataset.protected D
m_Header
the header.protected HeaderDefinition
m_HeaderDefinition
the data types.-
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 AbstractFeatureConverter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description String
datasetTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.protected abstract D
doGenerateHeader(HeaderDefinition header)
Performs the actual generation of the header data structure using the supplied header definition.protected abstract R
doGenerateRow(List<Object> data)
Performs the actual generation of a row from the raw data.D
generateHeader(HeaderDefinition header)
Generates the header data structure using the supplied header definition.R
generateRow(List<Object> data)
Generates a row from the raw data.String
getDataset()
Returns the dataset name in use.abstract Class
getDatasetFormat()
Returns the class of the dataset that the converter generates.D
getHeader()
Returns the current header, if any.HeaderDefinition
getHeaderDefinition()
Returns the current header definition, if any.String
getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.abstract Class
getRowFormat()
Returns the class of the row that the converter generates.boolean
isInitialized()
Returns whether the header has been initialized.void
reset()
Resets the scheme.void
setDataset(String value)
Sets the dataset name to use.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, 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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_Header
protected D m_Header
the header.
-
m_HeaderDefinition
protected HeaderDefinition m_HeaderDefinition
the data types.
-
m_Dataset
protected String m_Dataset
the name of the dataset.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
reset
public void reset()
Resets the scheme.- Overrides:
reset
in classAbstractOptionHandler
-
setDataset
public void setDataset(String value)
Sets the dataset name to use.- Parameters:
value
- the dataset name
-
getDataset
public String getDataset()
Returns the dataset name in use.- Returns:
- the dataset name
-
datasetTipText
public String datasetTipText()
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:
getQuickInfo
in interfaceQuickInfoSupporter
- Returns:
- null if no info available, otherwise short string
-
isInitialized
public boolean isInitialized()
Returns whether the header has been initialized.- Returns:
- true if initialized
-
getHeader
public D getHeader()
Returns the current header, if any.- Returns:
- the header, null if none generated yet
-
getHeaderDefinition
public HeaderDefinition getHeaderDefinition()
Returns the current header definition, if any.- Returns:
- the header definition, null if none supplied yet
-
getDatasetFormat
public abstract Class getDatasetFormat()
Returns the class of the dataset that the converter generates.- Returns:
- the format
-
getRowFormat
public abstract Class getRowFormat()
Returns the class of the row that the converter generates.- Returns:
- the format
-
doGenerateHeader
protected abstract D doGenerateHeader(HeaderDefinition header)
Performs the actual generation of the header data structure using the supplied header definition.- Parameters:
header
- the header definition- Returns:
- the dataset structure
-
generateHeader
public D generateHeader(HeaderDefinition header)
Generates the header data structure using the supplied header definition.- Parameters:
header
- the header definition- Returns:
- the dataset structure
-
doGenerateRow
protected abstract R doGenerateRow(List<Object> data)
Performs the actual generation of a row from the raw data.- Parameters:
data
- the data of the row, elements can be null (= missing)- Returns:
- the dataset structure
-
-