Package adams.data.io.input
Class RowWiseSpreadSheetSampleDataReader
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.io.input.AbstractReportReader<SampleData>
-
- adams.data.io.input.AbstractSampleDataReader
-
- adams.data.io.input.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 Summary
Fields Modifier and Type Field Description protected String
m_ColumnMeasurementName
the column name that stores the reference value name.protected String
m_ColumnMeasurementValue
the column name that stores the reference value.protected String
m_ColumnSampleID
the column name to get the sample ID from.protected String
m_ColumnSampleType
the column name that stores the sample type.protected adams.data.io.input.SpreadSheetReader
m_Reader
the spreadsheet reader.protected adams.data.spreadsheet.rowfinder.RowFinder
m_RowFinder
for locating the rows to import.-
Fields inherited from class adams.data.io.input.AbstractSampleDataReader
m_DatabaseConnection, m_Format, m_Offline
-
-
Constructor Summary
Constructors Constructor Description RowWiseSpreadSheetSampleDataReader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
columnMeasurementNameTipText()
Returns the tip text for this property.String
columnMeasurementValueTipText()
Returns the tip text for this property.String
columnSampleIDTipText()
Returns the tip text for this property.String
columnSampleTypeTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.String
getColumnMeasurementName()
Returns the name of the column with the reference value name.String
getColumnMeasurementValue()
Returns the name of the column with the reference value.String
getColumnSampleID()
Returns the name of the column with the sample ID.String
getColumnSampleType()
Returns the name of the column with the sample type.String
getFormatDescription()
Returns a string describing the format (used in the file chooser).String[]
getFormatExtensions()
Returns the extension(s) of the format.adams.data.io.input.SpreadSheetReader
getReader()
Returns the spreadsheet reader in use.adams.data.spreadsheet.rowfinder.RowFinder
getRowFinder()
Returns the row finder to use for locating the rows to import.String
globalInfo()
Returns a string describing the object.protected String
locateColumn(adams.data.spreadsheet.SpreadSheet sheet, String column, boolean fail)
Locates the column and returns the key for the column.SampleData
newInstance()
Returns a new instance of the report class in use.protected List<SampleData>
readData()
Performs the actual reading.String
readerTipText()
Returns the tip text for this property.String
rowFinderTipText()
Returns the tip text for this property.void
setColumnMeasurementName(String value)
Sets the name of the column with the reference value name.void
setColumnMeasurementValue(String value)
Sets the name of the column with the reference value.void
setColumnSampleID(String value)
Sets the name of the column with the sample ID.void
setColumnSampleType(String value)
Sets the name of the column with the sample type.void
setReader(adams.data.io.input.SpreadSheetReader value)
Sets the spreadsheet reader to use.void
setRowFinder(adams.data.spreadsheet.rowfinder.RowFinder value)
Sets the row finder to use for locating the rows to import.-
Methods inherited from class adams.data.io.input.AbstractSampleDataReader
determineParentID, formatTipText, getDatabaseConnection, getFormat, getOffline, getSampleData, getSpectrum, initialize, offlineTipText, setDatabaseConnection, setFormat, setOffline
-
Methods inherited from class adams.data.io.input.AbstractReportReader
checkData, cleanUp, compareTo, destroy, equals, forCommandLine, forName, getDefaultFormatExtension, getInput, getReaders, inputTipText, isStopped, postRead, read, reset, setInput, shallowCopy, shallowCopy, stopExecution
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
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.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceadams.core.GlobalInfoSupporter
- Specified by:
globalInfo
in classadams.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 interfaceadams.core.option.OptionHandler
- Overrides:
defineOptions
in classAbstractSampleDataReader
-
getFormatDescription
public String getFormatDescription()
Returns a string describing the format (used in the file chooser).- Specified by:
getFormatDescription
in interfaceadams.core.io.FileFormatHandler
- Specified by:
getFormatDescription
in classadams.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 interfaceadams.core.io.FileFormatHandler
- Specified by:
getFormatExtensions
in classadams.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 classadams.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 oncolumn
- the column to locatefail
- 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 classadams.data.io.input.AbstractReportReader<SampleData>
- Returns:
- the reports that were read
-
-