Package adams.data.io.input
Class AbstractSpectrumReader
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.io.input.AbstractDataContainerReader<Spectrum>
-
- adams.data.io.input.AbstractSpectrumReader
-
- All Implemented Interfaces:
adams.core.AdditionalInformationHandler
,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.AbstractDataContainerReader>
,adams.core.SizeOfHandler
,adams.core.Stoppable
,Serializable
,Comparable
- Direct Known Subclasses:
AbstractJCampSpectrumReader
,ASCIIXYSpectrumReader
,ASCSpectrumReader
,CALSpectrumReader
,ColumnWiseSpreadSheetSpectrumReader
,DPTSpectrumReader
,ExtractIdAndTypeSpectrumReader
,FilteredSpectrumReader
,JCampDX2SpectrumReader
,JsonSpectrumReader
,MPSSpectrumReader
,OpusSpectrumReader
,OpusSpectrumReaderExt
,RelabSpectrumReader
,RowWiseSpreadSheetSpectrumReader
,ScioLabExportSpectrumReader
,SimpleSpectrumReader
,SoilCaresScannerSpectrumReader
,SPASpectrumReader
,SPCSpectrumReader
,SpecLibSpectrumReader
,TrinamixSpectrumJsonReader
,TrinamixSpectrumReader
,UnscramblerSpectrumReader
,ZippedSpectrumReader
public abstract class AbstractSpectrumReader extends adams.data.io.input.AbstractDataContainerReader<Spectrum> implements adams.core.Stoppable
Abstract ancestor for readers that read files in various formats and turn them into spectrums.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected String
m_Format
the form of this data.protected String
m_Instrument
the instrument this data is from.protected boolean
m_KeepFormat
whether to not override the format obtained from the file.protected boolean
m_Stopped
whether reading was stopped.protected boolean
m_UseAbsoluteSource
whether to use absolute filename for the source report field or just the file's name.static String
OPTION_OUTPUTDIR
-
Constructor Summary
Constructors Constructor Description AbstractSpectrumReader()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkData()
Hook method for checking the data.protected adams.data.report.Report
createDummyReport(Spectrum cont)
Creates a dummy report.void
defineOptions()
Adds options to the internal list of options.String
formatTipText()
Returns the tip text for this property.protected String
getDefaultFormat()
Returns the default format of the spectra.protected String
getDefaultInstrument()
Returns the default instrument of the spectra.protected boolean
getDefaultKeepFormat()
Returns the default for keeping the format.protected boolean
getDefaultUseAbsoluteSource()
Returns the default for using absolute source filename.String
getFormat()
Returns the format string of the data.String
getInstrument()
Returns the instrument's name.boolean
getKeepFormat()
Returns whether to keep the format obtained from the file.static String[]
getReaders()
Returns a list with classnames of readers.boolean
getUseAbsoluteSource()
Returns whether to use absolute source filename rather than just name.String
instrumentTipText()
Returns the tip text for this property.String
keepFormatTipText()
Returns the tip text for this property.protected void
postProcessData()
Performs some post-processing.static void
runReader(Class env, Class reader, String[] args)
Runs the reader from commandline.void
setFormat(String value)
Sets the format string of the data (always converted to upper case).void
setInstrument(String value)
Sets the instrument's name.void
setKeepFormat(boolean value)
Sets whether to keep the format obtained from the file.void
setUseAbsoluteSource(boolean value)
Sets whether to use absolute source filename rather than just name.void
stopExecution()
Stops the execution.String
useAbsoluteSourceTipText()
Returns the tip text for this property.-
Methods inherited from class adams.data.io.input.AbstractDataContainerReader
cleanUp, compareTo, createDummyReportTipText, destroy, doRead, equals, getAdditionalInformation, getCreateDummyReport, getDefaultFormatExtension, getFormatDescription, getFormatExtensions, getInput, initialize, inputTipText, isInputFile, read, readData, reset, setCreateDummyReport, setInput, shallowCopy, shallowCopy
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Field Detail
-
OPTION_OUTPUTDIR
public static final String OPTION_OUTPUTDIR
- See Also:
- Constant Field Values
-
m_Instrument
protected String m_Instrument
the instrument this data is from.
-
m_Format
protected String m_Format
the form of this data.
-
m_KeepFormat
protected boolean m_KeepFormat
whether to not override the format obtained from the file.
-
m_UseAbsoluteSource
protected boolean m_UseAbsoluteSource
whether to use absolute filename for the source report field or just the file's name.
-
m_Stopped
protected boolean m_Stopped
whether reading was stopped.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceadams.core.option.OptionHandler
- Overrides:
defineOptions
in classadams.data.io.input.AbstractDataContainerReader<Spectrum>
-
getDefaultInstrument
protected String getDefaultInstrument()
Returns the default instrument of the spectra.- Returns:
- the default
-
getDefaultFormat
protected String getDefaultFormat()
Returns the default format of the spectra.- Returns:
- the default
-
getDefaultKeepFormat
protected boolean getDefaultKeepFormat()
Returns the default for keeping the format.- Returns:
- the default
-
getDefaultUseAbsoluteSource
protected boolean getDefaultUseAbsoluteSource()
Returns the default for using absolute source filename.- Returns:
- the default
-
setInstrument
public void setInstrument(String value)
Sets the instrument's name.- Parameters:
value
- the name
-
getInstrument
public String getInstrument()
Returns the instrument's name.- Returns:
- the name
-
instrumentTipText
public String instrumentTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setFormat
public void setFormat(String value)
Sets the format string of the data (always converted to upper case). Use null to set default format.- Parameters:
value
- the format
-
getFormat
public String getFormat()
Returns the format string of the data.- Returns:
- the format
-
formatTipText
public String formatTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setKeepFormat
public void setKeepFormat(boolean value)
Sets whether to keep the format obtained from the file.- Parameters:
value
- true if to keep format
-
getKeepFormat
public boolean getKeepFormat()
Returns whether to keep the format obtained from the file.- Returns:
- true if to keep format
-
keepFormatTipText
public String keepFormatTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setUseAbsoluteSource
public void setUseAbsoluteSource(boolean value)
Sets whether to use absolute source filename rather than just name.- Parameters:
value
- true if to use absolute source
-
getUseAbsoluteSource
public boolean getUseAbsoluteSource()
Returns whether to use absolute source filename rather than just name.- Returns:
- true if to use absolute source
-
useAbsoluteSourceTipText
public String useAbsoluteSourceTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
checkData
protected void checkData()
Hook method for checking the data.- Overrides:
checkData
in classadams.data.io.input.AbstractDataContainerReader<Spectrum>
-
createDummyReport
protected adams.data.report.Report createDummyReport(Spectrum cont)
Creates a dummy report.- Overrides:
createDummyReport
in classadams.data.io.input.AbstractDataContainerReader<Spectrum>
- Parameters:
cont
- the data container the dummy is for- Returns:
- the dummy report or null
- See Also:
AbstractDataContainerReader.m_CreateDummyReport
,postProcessData()
-
postProcessData
protected void postProcessData()
Performs some post-processing.- Overrides:
postProcessData
in classadams.data.io.input.AbstractDataContainerReader<Spectrum>
-
stopExecution
public void stopExecution()
Stops the execution.- Specified by:
stopExecution
in interfaceadams.core.Stoppable
-
getReaders
public static String[] getReaders()
Returns a list with classnames of readers.- Returns:
- the reader classnames
-
runReader
public static void runReader(Class env, Class reader, String[] args)
Runs the reader from commandline.- Parameters:
env
- the environment class to usereader
- the reader to executeargs
- the commandline arguments, use --input to specify the input file/dir and --output-dir to specify directory to save them as .spec files
-
-