Class RowWiseSpreadSheetSampleDataReader

  • All Implemented Interfaces:
    adams.core.CleanUpHandler, adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.io.FileFormatHandler, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.ShallowCopySupporter<adams.data.io.input.AbstractReportReader>, adams.core.SizeOfHandler, adams.core.Stoppable, adams.core.StoppableWithFeedback, adams.data.io.input.ReportReader<SampleData>, SampleDataReader, adams.db.DatabaseConnectionHandler, adams.db.DatabaseConnectionProvider, adams.db.DatabaseConnectionUser, Serializable, Comparable

    public class RowWiseSpreadSheetSampleDataReader
    extends AbstractSampleDataReader
    Reads a sample data file from a spreadsheet (format depends on reader), one reference value per row.

    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
        min-user-mode: Expert
     
    -input <adams.core.io.PlaceholderFile> (property: input)
        The file to read and turn into a report.
        default: ${CWD}
     
    -offline <boolean> (property: offline)
        If set to true, the database won't get queried, e.g., for obtaining the
        parent ID.
        default: false
     
    -format <java.lang.String> (property: format)
        The type of spectrum to use (used internally to determine the database ID
        of the spectrum).
        default: NIR
     
    -reader <adams.data.io.input.SpreadSheetReader> (property: reader)
        The spreadsheet reader to use.
        default: adams.data.io.input.CsvSpreadSheetReader -data-row-type adams.data.spreadsheet.DenseDataRow -spreadsheet-type adams.data.spreadsheet.DefaultSpreadSheet
     
    -col-id <java.lang.String> (property: columnSampleID)
        The name of the column containing the sample ID.
        default: ID
     
    -col-type <java.lang.String> (property: columnSampleType)
        The name of the column containing the sample type.
        default: Type
     
    -col-measurement <java.lang.String> (property: columnMeasurementName)
        The name of the column containing the reference value name.
        default: Measurement
     
    -col-value <java.lang.String> (property: columnMeasurementValue)
        The name of the column containing the reference value.
        default: Value
     
    -row-finder <adams.data.spreadsheet.rowfinder.RowFinder> (property: rowFinder)
        The row finder to use for locating the rows to import.
        default: adams.data.spreadsheet.rowfinder.AllFinder
     
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_Reader

        protected adams.data.io.input.SpreadSheetReader m_Reader
        the spreadsheet reader.
      • m_ColumnSampleID

        protected String m_ColumnSampleID
        the column name to get the sample ID from.
      • m_ColumnSampleType

        protected String m_ColumnSampleType
        the column name that stores the sample type.
      • m_ColumnMeasurementName

        protected String m_ColumnMeasurementName
        the column name that stores the reference value name.
      • m_ColumnMeasurementValue

        protected String m_ColumnMeasurementValue
        the column name that stores the reference value.
      • m_RowFinder

        protected adams.data.spreadsheet.rowfinder.RowFinder m_RowFinder
        for locating the rows to import.
    • Constructor Detail

      • RowWiseSpreadSheetSampleDataReader

        public RowWiseSpreadSheetSampleDataReader()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing the object.
        Specified by:
        globalInfo in interface adams.core.GlobalInfoSupporter
        Specified by:
        globalInfo in class adams.core.option.AbstractOptionHandler
        Returns:
        a description suitable for displaying in the gui
      • defineOptions

        public void defineOptions()
        Adds options to the internal list of options.
        Specified by:
        defineOptions in interface adams.core.option.OptionHandler
        Overrides:
        defineOptions in class AbstractSampleDataReader
      • getFormatDescription

        public String getFormatDescription()
        Returns a string describing the format (used in the file chooser).
        Specified by:
        getFormatDescription in interface adams.core.io.FileFormatHandler
        Specified by:
        getFormatDescription in class adams.data.io.input.AbstractReportReader<SampleData>
        Returns:
        a description suitable for displaying in the file chooser
      • getFormatExtensions

        public String[] getFormatExtensions()
        Returns the extension(s) of the format.
        Specified by:
        getFormatExtensions in interface adams.core.io.FileFormatHandler
        Specified by:
        getFormatExtensions in class adams.data.io.input.AbstractReportReader<SampleData>
        Returns:
        the extension(s) (without the dot!)
      • setReader

        public void setReader​(adams.data.io.input.SpreadSheetReader value)
        Sets the spreadsheet reader to use.
        Parameters:
        value - the reader
      • getReader

        public adams.data.io.input.SpreadSheetReader getReader()
        Returns the spreadsheet reader in 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.
      • setColumnSampleID

        public void setColumnSampleID​(String value)
        Sets the name of the column with the sample ID.
        Parameters:
        value - the column name
      • getColumnSampleID

        public String getColumnSampleID()
        Returns the name of the column with the sample ID.
        Returns:
        the column name
      • columnSampleIDTipText

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

        public void setColumnSampleType​(String value)
        Sets the name of the column with the sample type.
        Parameters:
        value - the column name
      • getColumnSampleType

        public String getColumnSampleType()
        Returns the name of the column with the sample type.
        Returns:
        the column name
      • columnSampleTypeTipText

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

        public void setColumnMeasurementName​(String value)
        Sets the name of the column with the reference value name.
        Parameters:
        value - the column name
      • getColumnMeasurementName

        public String getColumnMeasurementName()
        Returns the name of the column with the reference value name.
        Returns:
        the column name
      • columnMeasurementNameTipText

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

        public void setColumnMeasurementValue​(String value)
        Sets the name of the column with the reference value.
        Parameters:
        value - the column name
      • getColumnMeasurementValue

        public String getColumnMeasurementValue()
        Returns the name of the column with the reference value.
        Returns:
        the column name
      • columnMeasurementValueTipText

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

        public void setRowFinder​(adams.data.spreadsheet.rowfinder.RowFinder value)
        Sets the row finder to use for locating the rows to import.
        Parameters:
        value - the finder
      • getRowFinder

        public adams.data.spreadsheet.rowfinder.RowFinder getRowFinder()
        Returns the row finder to use for locating the rows to import.
        Returns:
        the finder
      • rowFinderTipText

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

        public SampleData newInstance()
        Returns a new instance of the report class in use.
        Specified by:
        newInstance in class adams.data.io.input.AbstractReportReader<SampleData>
        Returns:
        the new (empty) report
      • locateColumn

        protected String locateColumn​(adams.data.spreadsheet.SpreadSheet sheet,
                                      String column,
                                      boolean fail)
        Locates the column and returns the key for the column.
        Parameters:
        sheet - the spreadsheet to work on
        column - the column to locate
        fail - if true then a IllegalStateException execption is thrown in case the column cannot be located
        Returns:
        the column key or null if not found
      • readData

        protected List<SampleData> readData()
        Performs the actual reading.
        Specified by:
        readData in class adams.data.io.input.AbstractReportReader<SampleData>
        Returns:
        the reports that were read