Package adams.data.io.input
Class MultiColumnSpreadSheetSampleDataReader
- 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.MultiColumnSpreadSheetSampleDataReader
-
- 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 MultiColumnSpreadSheetSampleDataReader extends AbstractSampleDataReader
Reads sample data from a spreadsheet (format depends on reader), reference values stored in the specified range of columns and the column headers representing the reference value names.
-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 <adams.data.spreadsheet.SpreadSheetColumnIndex> (property: columnSampleID) The column containing the sample ID. default: ID example: An index is a number starting with 1; column names (case-sensitive) as well as the following placeholders can be used: first, second, third, last_2, last_1, last; numeric indices can be enforced by preceding them with '#' (eg '#12'); column names can be surrounded by double quotes.
-cols-sampledata <adams.data.spreadsheet.SpreadSheetColumnRange> (property: columnsSampleData) The columns with the reference values; header represents the reference name. default: example: A range is a comma-separated list of single 1-based indices or sub-ranges of indices ('start-end'); 'inv(...)' inverts the range '...'; column names (case-sensitive) as well as the following placeholders can be used: first, second, third, last_2, last_1, last; numeric indices can be enforced by preceding them with '#' (eg '#12'); column names can be surrounded by double quotes.
-cols-numeric <adams.data.spreadsheet.SpreadSheetColumnRange> (property: columnsNumeric) The columns with numeric reference values. default: example: A range is a comma-separated list of single 1-based indices or sub-ranges of indices ('start-end'); 'inv(...)' inverts the range '...'; column names (case-sensitive) as well as the following placeholders can be used: first, second, third, last_2, last_1, last; numeric indices can be enforced by preceding them with '#' (eg '#12'); column names can be surrounded by double quotes.
-cols-bool <adams.data.spreadsheet.SpreadSheetColumnRange> (property: columnsBoolean) The columns with boolean reference values. default: example: A range is a comma-separated list of single 1-based indices or sub-ranges of indices ('start-end'); 'inv(...)' inverts the range '...'; column names (case-sensitive) as well as the following placeholders can be used: first, second, third, last_2, last_1, last; numeric indices can be enforced by preceding them with '#' (eg '#12'); column names can be surrounded by double quotes.
-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 adams.data.spreadsheet.SpreadSheetColumnIndex
m_ColumnSampleID
the column name to get the sample ID from.protected adams.data.spreadsheet.SpreadSheetColumnRange
m_ColumnsBoolean
the range of columns with boolean sample data.protected adams.data.spreadsheet.SpreadSheetColumnRange
m_ColumnsNumeric
the range of columns with numeric sample data.protected adams.data.spreadsheet.SpreadSheetColumnRange
m_ColumnsSampleData
the range of columns with the sample data.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 MultiColumnSpreadSheetSampleDataReader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
columnSampleIDTipText()
Returns the tip text for this property.String
columnsBooleanTipText()
Returns the tip text for this property.String
columnsNumericTipText()
Returns the tip text for this property.String
columnsSampleDataTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.adams.data.spreadsheet.SpreadSheetColumnIndex
getColumnSampleID()
Returns the column with the sample ID.adams.data.spreadsheet.SpreadSheetColumnRange
getColumnsBoolean()
Returns the columns with boolean reference values.adams.data.spreadsheet.SpreadSheetColumnRange
getColumnsNumeric()
Returns the columns with numeric reference values.adams.data.spreadsheet.SpreadSheetColumnRange
getColumnsSampleData()
Returns the columns with the reference values.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.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
setColumnSampleID(adams.data.spreadsheet.SpreadSheetColumnIndex value)
Sets the column with the sample ID.void
setColumnsBoolean(adams.data.spreadsheet.SpreadSheetColumnRange value)
Sets the range of columns with boolean reference values.void
setColumnsNumeric(adams.data.spreadsheet.SpreadSheetColumnRange value)
Sets the range of columns with numeric reference values.void
setColumnsSampleData(adams.data.spreadsheet.SpreadSheetColumnRange value)
Sets the range of columns with the reference values.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 adams.data.spreadsheet.SpreadSheetColumnIndex m_ColumnSampleID
the column name to get the sample ID from.
-
m_ColumnsSampleData
protected adams.data.spreadsheet.SpreadSheetColumnRange m_ColumnsSampleData
the range of columns with the sample data.
-
m_ColumnsNumeric
protected adams.data.spreadsheet.SpreadSheetColumnRange m_ColumnsNumeric
the range of columns with numeric sample data.
-
m_ColumnsBoolean
protected adams.data.spreadsheet.SpreadSheetColumnRange m_ColumnsBoolean
the range of columns with boolean sample data.
-
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(adams.data.spreadsheet.SpreadSheetColumnIndex value)
Sets the column with the sample ID.- Parameters:
value
- the column
-
getColumnSampleID
public adams.data.spreadsheet.SpreadSheetColumnIndex getColumnSampleID()
Returns the column with the sample ID.- Returns:
- the column
-
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.
-
setColumnsSampleData
public void setColumnsSampleData(adams.data.spreadsheet.SpreadSheetColumnRange value)
Sets the range of columns with the reference values.- Parameters:
value
- the columns
-
getColumnsSampleData
public adams.data.spreadsheet.SpreadSheetColumnRange getColumnsSampleData()
Returns the columns with the reference values.- Returns:
- the columns
-
columnsSampleDataTipText
public String columnsSampleDataTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setColumnsNumeric
public void setColumnsNumeric(adams.data.spreadsheet.SpreadSheetColumnRange value)
Sets the range of columns with numeric reference values.- Parameters:
value
- the columns
-
getColumnsNumeric
public adams.data.spreadsheet.SpreadSheetColumnRange getColumnsNumeric()
Returns the columns with numeric reference values.- Returns:
- the columns
-
columnsNumericTipText
public String columnsNumericTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setColumnsBoolean
public void setColumnsBoolean(adams.data.spreadsheet.SpreadSheetColumnRange value)
Sets the range of columns with boolean reference values.- Parameters:
value
- the columns
-
getColumnsBoolean
public adams.data.spreadsheet.SpreadSheetColumnRange getColumnsBoolean()
Returns the columns with boolean reference values.- Returns:
- the columns
-
columnsBooleanTipText
public String columnsBooleanTipText()
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
-
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
-
-