Class AbstractSampleDataReader

  • 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
    Direct Known Subclasses:
    MultiColumnSpreadSheetSampleDataReader, RowWiseSpreadSheetSampleDataReader, SpecLibSampleDataReader

    public abstract class AbstractSampleDataReader
    extends adams.data.io.input.AbstractReportReader<SampleData>
    implements SampleDataReader, adams.db.DatabaseConnectionHandler
    Ancestor for sample data readers.
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected adams.db.AbstractDatabaseConnection m_DatabaseConnection
      the database connection in use.
      protected String m_Format
      the spectrum format to use.
      protected boolean m_Offline
      whether operate in offline mode, i.e., not query database.
      • Fields inherited from class adams.data.io.input.AbstractReportReader

        m_Input, m_Stopped
      • Fields inherited from class adams.core.option.AbstractOptionHandler

        m_OptionManager
      • Fields inherited from class adams.core.logging.LoggingObject

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void defineOptions()
      Adds options to the internal list of options.
      protected int determineParentID​(adams.data.report.Report report)
      Tries to determine the parent ID for the current report.
      String formatTipText()
      Returns the tip text for this property.
      adams.db.AbstractDatabaseConnection getDatabaseConnection()
      Returns the currently used database connection object, can be null.
      String getFormat()
      The format of spectrum to use.
      boolean getOffline()
      Returns whether to work in offline mode, i.e., not query the database.
      protected SampleDataF getSampleData()
      Returns the table object to use for accessing the reports.
      protected SpectrumF getSpectrum()
      Returns the table object to use for accessing the spectra.
      protected void initialize()
      Initializes the members.
      String offlineTipText()
      Returns the tip text for this property.
      void setDatabaseConnection​(adams.db.AbstractDatabaseConnection value)
      Sets the database connection object to use.
      void setFormat​(String value)
      Sets the format of spectrum to use.
      void setOffline​(boolean value)
      Sets whether to work in offline mode, i.e., not query the database.
      • Methods inherited from class adams.data.io.input.AbstractReportReader

        checkData, cleanUp, compareTo, destroy, equals, forCommandLine, forName, getDefaultFormatExtension, getFormatDescription, getFormatExtensions, getInput, getReaders, inputTipText, isStopped, newInstance, postRead, read, readData, reset, setInput, shallowCopy, shallowCopy, stopExecution
      • 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
      • Methods inherited from interface adams.core.logging.LoggingLevelHandler

        getLoggingLevel
    • Field Detail

      • m_Format

        protected String m_Format
        the spectrum format to use.
      • m_Offline

        protected boolean m_Offline
        whether operate in offline mode, i.e., not query database.
      • m_DatabaseConnection

        protected adams.db.AbstractDatabaseConnection m_DatabaseConnection
        the database connection in use.
    • Constructor Detail

      • AbstractSampleDataReader

        public AbstractSampleDataReader()
    • Method Detail

      • 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 adams.data.io.input.AbstractReportReader<SampleData>
      • initialize

        protected void initialize()
        Initializes the members.
        Overrides:
        initialize in class adams.core.option.AbstractOptionHandler
      • setOffline

        public void setOffline​(boolean value)
        Sets whether to work in offline mode, i.e., not query the database.
        Parameters:
        value - if true then offline mode
      • getOffline

        public boolean getOffline()
        Returns whether to work in offline mode, i.e., not query the database.
        Returns:
        true if in offline mode
      • offlineTipText

        public String offlineTipText()
        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 of spectrum to use.
        Parameters:
        value - the format
      • getFormat

        public String getFormat()
        The format of spectrum to use.
        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.
      • getDatabaseConnection

        public adams.db.AbstractDatabaseConnection getDatabaseConnection()
        Returns the currently used database connection object, can be null.
        Specified by:
        getDatabaseConnection in interface adams.db.DatabaseConnectionProvider
        Returns:
        the current object
      • setDatabaseConnection

        public void setDatabaseConnection​(adams.db.AbstractDatabaseConnection value)
        Sets the database connection object to use.
        Specified by:
        setDatabaseConnection in interface adams.db.DatabaseConnectionHandler
        Parameters:
        value - the object to use
      • getSampleData

        protected SampleDataF getSampleData()
        Returns the table object to use for accessing the reports.
        Returns:
        the table object
      • getSpectrum

        protected SpectrumF getSpectrum()
        Returns the table object to use for accessing the spectra.
        Returns:
        the table object
      • determineParentID

        protected int determineParentID​(adams.data.report.Report report)
        Tries to determine the parent ID for the current report.
        Specified by:
        determineParentID in class adams.data.io.input.AbstractReportReader<SampleData>
        Parameters:
        report - the report to determine the ID for
        Returns:
        the parent database ID, -1 if it cannot be determined