Class SpreadSheetTimeseriesReader

  • All Implemented Interfaces:
    AdditionalInformationHandler, CleanUpHandler, Destroyable, GlobalInfoSupporter, FileFormatHandler, LoggingLevelHandler, LoggingSupporter, OptionHandler, ShallowCopySupporter<AbstractDataContainerReader>, SizeOfHandler, MetaFileReader, Serializable, Comparable

    public class SpreadSheetTimeseriesReader
    extends AbstractTimeseriesReader
    implements MetaFileReader
    Reads timeseries containers from columns of a spreadsheet.
    A new container is started, whenever the value of the ID column changes (hence you need to ensure that the data is ordered on this column).
    However, it is not required to have an ID column present. In this case, all of the data gets added to the same timeseries.

    Valid options are:

    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -input <adams.core.io.PlaceholderFile> (property: input)
        The file to read and turn into a container.
        default: ${CWD}
     
    -create-dummy-report <boolean> (property: createDummyReport)
        If true, then a dummy report is created if none present.
        default: false
     
    -reader <adams.data.io.input.SpreadSheetReader> (property: reader)
        The reader to use for reading the spreadsheet file.
        default: adams.data.io.input.CsvSpreadSheetReader
     
    -column-id <java.lang.String> (property: columnID)
        The name of the (optional) column containing the ID that distinguishes the 
        timeseries.
        default: id
     
    -column-timestamp <java.lang.String> (property: columnTimestamp)
        The name of the column containing the timestamp for a data point (accepted 
        types: integer, date, time, datetime, timestamp).
        default: timestamp
     
    -column-value <java.lang.String> (property: columnValue)
        The name of the column containing the value for a data point (accepted types:
         numeric).
        default: value
     
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_ColumnID

        protected String m_ColumnID
        the ID column.
      • m_ColumnIDIndex

        protected int m_ColumnIDIndex
        the ID column index.
      • m_ColumnTimestamp

        protected String m_ColumnTimestamp
        the timestamp column.
      • m_ColumnTimestampIndex

        protected int m_ColumnTimestampIndex
        the timestamp column type.
      • m_ColumnValue

        protected String m_ColumnValue
        the value column.
      • m_ColumnValueIndex

        protected int m_ColumnValueIndex
        the value column index.
      • m_Timeseries

        protected Timeseries m_Timeseries
        the current container.
      • m_RowIndex

        protected int m_RowIndex
        the current row index.
    • Constructor Detail

      • SpreadSheetTimeseriesReader

        public SpreadSheetTimeseriesReader()
    • Method Detail

      • getActualFormatExtensions

        public String[] getActualFormatExtensions()
        Returns the underlying format extensions.
        Specified by:
        getActualFormatExtensions in interface MetaFileReader
        Returns:
        the format extensions (excluding dot)
      • setReader

        public void setReader​(SpreadSheetReader value)
        Sets the reader to use.
        Parameters:
        value - the reader
      • getReader

        public SpreadSheetReader getReader()
        Returns the reader to use.
        Returns:
        the reader
      • readerTipText

        public String readerTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setColumnID

        public void setColumnID​(String value)
        Sets the name of the ID column.
        Parameters:
        value - the column name
      • getColumnID

        public String getColumnID()
        Returns the name of the ID column.
        Returns:
        the column name
      • columnIDTipText

        public String columnIDTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setColumnTimestamp

        public void setColumnTimestamp​(String value)
        Sets the name of the timestamp column.
        Parameters:
        value - the column name
      • getColumnTimestamp

        public String getColumnTimestamp()
        Returns the name of the timestamp column.
        Returns:
        the column name
      • columnTimestampTipText

        public String columnTimestampTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setColumnValue

        public void setColumnValue​(String value)
        Sets the name of the value column.
        Parameters:
        value - the column name
      • getColumnValue

        public String getColumnValue()
        Returns the name of the value column.
        Returns:
        the column name
      • columnValueTipText

        public String columnValueTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • readDataPoint

        protected TimeseriesPoint readDataPoint​(SpreadSheet sheet)
                                         throws Exception
        Reads the next timeseries data point.
        Parameters:
        sheet - the current sheet
        Returns:
        the next data point
        Throws:
        Exception - if reading of timeseries data fails
      • performRead

        protected void performRead​(SpreadSheet sheet)
                            throws Exception
        Completes and returns the last timeseries that was started.
        Parameters:
        sheet - the current sheet
        Throws:
        Exception - if reading of timeseries data fails
      • analyzeColumns

        protected void analyzeColumns​(SpreadSheet sheet)
                               throws Exception
        Analyzes the columns.
        Parameters:
        sheet - the current sheet
        Throws:
        Exception - if columns not present or of wrong type