Package adams.data.timeseries
Class AbstractTimeseriesFeatureGenerator<T extends Timeseries>
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.timeseries.AbstractTimeseriesFeatureGenerator<T>
-
- Type Parameters:
T
- the type of timeseries to process
- All Implemented Interfaces:
CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,ShallowCopySupporter<AbstractTimeseriesFeatureGenerator>
,SizeOfHandler
,Serializable
,Comparable
- Direct Known Subclasses:
AbstractMetaTimeseriesFeatureGenerator
,Values
public abstract class AbstractTimeseriesFeatureGenerator<T extends Timeseries> extends AbstractOptionHandler implements Comparable, CleanUpHandler, QuickInfoSupporter, ShallowCopySupporter<AbstractTimeseriesFeatureGenerator>
Abstract base class forTimeseries
feature generation.- Version:
- $Revision: 9700 $
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected AbstractFeatureConverter
m_Converter
the feature converter to use.protected Field[]
m_Fields
fields to add to the output data.protected BaseString[]
m_Notes
the notes to add as attributes.-
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 AbstractTimeseriesFeatureGenerator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
checkData(T timeseries)
Optional checks of the timeseries.void
cleanUp()
Cleans up data structures, frees up memory.int
compareTo(Object o)
Compares this object with the specified object for order.String
converterTipText()
Returns the tip text for this property.abstract HeaderDefinition
createHeader(T timeseries)
Creates the header from a template timeseries.void
defineOptions()
Adds options to the internal list of options.void
destroy()
Frees up memory in a "destructive" non-reversible way.boolean
equals(Object o)
Returns whether the two objects are the same.String
fieldsTipText()
Returns the tip text for this property.Object[]
generate(T timeseries)
Process the given timeseries.abstract List<Object>[]
generateRows(T timeseries)
Performs the actual feature genration.AbstractFeatureConverter
getConverter()
Returns the feature converter in use.Class
getDatasetFormat()
Returns the class of the dataset that the converter generates.Field[]
getFields()
Returns the targets to add.BaseString[]
getNotes()
Returns the current notes to add as attributes.String
getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.Class
getRowFormat()
Returns the class of the row that the converter generates.String
notesTipText()
Returns the tip text for this property.HeaderDefinition
postProcessHeader(HeaderDefinition header)
Post-processes the header, adding fields and notes.List<Object>
postProcessRow(T timeseries, List<Object> data)
Post-processes the generated row, adding notes and fields.List<Object>[]
postProcessRows(T timeseries, List<Object>[] data)
Post-processes the generated rows, adding notes and fields.protected void
reset()
Resets the scheme, i.e., the header information.void
setConverter(AbstractFeatureConverter value)
Sets the feature converter to use.void
setFields(Field[] value)
Sets the targets to add.void
setNotes(BaseString[] value)
Sets the notes to add as attributes.AbstractTimeseriesFeatureGenerator
shallowCopy()
Returns a shallow copy of itself, i.e., based on the commandline options.AbstractTimeseriesFeatureGenerator
shallowCopy(boolean expand)
Returns a shallow copy of itself, i.e., based on the commandline options.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, 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, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_Converter
protected AbstractFeatureConverter m_Converter
the feature converter to use.
-
m_Fields
protected Field[] m_Fields
fields to add to the output data.
-
m_Notes
protected BaseString[] m_Notes
the notes to add as attributes.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
reset
protected void reset()
Resets the scheme, i.e., the header information.- Overrides:
reset
in classAbstractOptionHandler
-
setConverter
public void setConverter(AbstractFeatureConverter value)
Sets the feature converter to use.- Parameters:
value
- the converter
-
getConverter
public AbstractFeatureConverter getConverter()
Returns the feature converter in use.- Returns:
- the converter
-
converterTipText
public String converterTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setFields
public void setFields(Field[] value)
Sets the targets to add.- Parameters:
value
- the targets
-
getFields
public Field[] getFields()
Returns the targets to add.- Returns:
- the targets
-
fieldsTipText
public String fieldsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setNotes
public void setNotes(BaseString[] value)
Sets the notes to add as attributes.- Parameters:
value
- the notes prefixes, e.g., "PROCESS INFORMATION"
-
getNotes
public BaseString[] getNotes()
Returns the current notes to add as attributes.- Returns:
- the notes prefixes, e.g., "PROCESS INFORMATION"
-
notesTipText
public String notesTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
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
-
getDatasetFormat
public Class getDatasetFormat()
Returns the class of the dataset that the converter generates.- Returns:
- the format
-
getRowFormat
public Class getRowFormat()
Returns the class of the row that the converter generates.- Returns:
- the format
-
checkData
protected void checkData(T timeseries)
Optional checks of the timeseries.
Default implementation only checks whether timeseries is null.- Parameters:
timeseries
- the timeseries to check
-
createHeader
public abstract HeaderDefinition createHeader(T timeseries)
Creates the header from a template timeseries.- Parameters:
timeseries
- the timeseries to act as a template- Returns:
- the generated header
-
postProcessHeader
public HeaderDefinition postProcessHeader(HeaderDefinition header)
Post-processes the header, adding fields and notes.- Parameters:
header
- the header to process- Returns:
- the post-processed header
-
generateRows
public abstract List<Object>[] generateRows(T timeseries)
Performs the actual feature genration.- Parameters:
timeseries
- the timeseries to process- Returns:
- the generated features
-
postProcessRow
public List<Object> postProcessRow(T timeseries, List<Object> data)
Post-processes the generated row, adding notes and fields.- Parameters:
timeseries
- the timeseriesdata
- the data to process- Returns:
- the updated instance
-
postProcessRows
public List<Object>[] postProcessRows(T timeseries, List<Object>[] data)
Post-processes the generated rows, adding notes and fields.- Parameters:
timeseries
- the timeseries containerdata
- the data to process- Returns:
- the updated instance
-
generate
public Object[] generate(T timeseries)
Process the given timeseries. This method will also create the header if necessary.- Parameters:
timeseries
- the timeseries to process- Returns:
- the generated array
-
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.- Specified by:
compareTo
in interfaceComparable<T extends Timeseries>
- 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 AbstractTimeseriesFeatureGenerator shallowCopy()
Returns a shallow copy of itself, i.e., based on the commandline options.- Specified by:
shallowCopy
in interfaceShallowCopySupporter<T extends Timeseries>
- Returns:
- the shallow copy
-
shallowCopy
public AbstractTimeseriesFeatureGenerator shallowCopy(boolean expand)
Returns a shallow copy of itself, i.e., based on the commandline options.- Specified by:
shallowCopy
in interfaceShallowCopySupporter<T extends Timeseries>
- Parameters:
expand
- whether to expand variables to their current values- Returns:
- the shallow copy
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUp
in interfaceCleanUpHandler
-
destroy
public void destroy()
Frees up memory in a "destructive" non-reversible way.
Calls cleanUp() and cleans up the options.- Specified by:
destroy
in interfaceDestroyable
- Overrides:
destroy
in classAbstractOptionHandler
- See Also:
AbstractOptionHandler.cleanUpOptions()
-
-