Class CALSpectrumLoader

  • All Implemented Interfaces:
    Serializable, weka.core.converters.FileSourcedConverter, weka.core.converters.Loader, weka.core.EnvironmentHandler, weka.core.OptionHandler, weka.core.RevisionHandler

    public class CALSpectrumLoader
    extends weka.core.converters.AbstractFileLoader
    implements weka.core.OptionHandler
    Loads a CAL file.
    Version:
    $Revision$
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface weka.core.converters.Loader

        weka.core.converters.Loader.StructureNotReadyException
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected adams.core.base.BaseRegExp m_RefRegExp
      the references to load.
      static String REF_REGEXP  
      • Fields inherited from class weka.core.converters.AbstractFileLoader

        FILE_EXTENSION_COMPRESSED, m_env, m_File, m_sourceFile, m_structure, m_useRelativePath
      • Fields inherited from class weka.core.converters.AbstractLoader

        m_retrieval
      • Fields inherited from interface weka.core.converters.Loader

        BATCH, INCREMENTAL, NONE
    • Field Detail

      • m_RefRegExp

        protected adams.core.base.BaseRegExp m_RefRegExp
        the references to load.
    • Constructor Detail

      • CALSpectrumLoader

        public CALSpectrumLoader()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing the object.
        Returns:
        a description suitable for displaying in the gui
      • getFileExtension

        public String getFileExtension()
        Get the file extension used for this type of file
        Specified by:
        getFileExtension in interface weka.core.converters.FileSourcedConverter
        Returns:
        the file extension
      • getFileExtensions

        public String[] getFileExtensions()
        Gets all the file extensions used for this type of file
        Specified by:
        getFileExtensions in interface weka.core.converters.FileSourcedConverter
        Returns:
        the file extensions
      • getFileDescription

        public String getFileDescription()
        Get a one line description of the type of file
        Specified by:
        getFileDescription in interface weka.core.converters.FileSourcedConverter
        Returns:
        a description of the file type
      • getDefaultRefRegExp

        protected adams.core.base.BaseRegExp getDefaultRefRegExp()
        Returns the default regexp for the references.
        Returns:
        the default
      • listOptions

        public Enumeration listOptions()
        Returns an enumeration describing the available options.
        Specified by:
        listOptions in interface weka.core.OptionHandler
        Returns:
        an enumeration of all the available options.
      • setOptions

        public void setOptions​(String[] options)
                        throws Exception
        Sets the OptionHandler's options using the given list. All options will be set (or reset) during this call (i.e. incremental setting of options is not possible).
        Specified by:
        setOptions in interface weka.core.OptionHandler
        Parameters:
        options - the list of options as an array of strings
        Throws:
        Exception - if an option is not supported
      • getOptions

        public String[] getOptions()
        Gets the current option settings for the OptionHandler.
        Specified by:
        getOptions in interface weka.core.OptionHandler
        Returns:
        the array of current option settings as an array of strings
      • setRefRegExp

        public void setRefRegExp​(adams.core.base.BaseRegExp value)
        Sets the regexp to use for matching the reference names to include in the dataset.
        Parameters:
        value - the expression
      • getRefRegExp

        public adams.core.base.BaseRegExp getRefRegExp()
        Returns the regexp to use for matching the reference names to include in the dataset.
        Returns:
        the expression
      • refRegExpTipText

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

        public void setSource​(InputStream input)
                       throws IOException
        Does nothing.
        Specified by:
        setSource in interface weka.core.converters.Loader
        Overrides:
        setSource in class weka.core.converters.AbstractLoader
        Parameters:
        input - the input stream
        Throws:
        IOException - never
      • getStructure

        public weka.core.Instances getStructure()
                                         throws IOException
        Determines and returns (if possible) the structure (internally the header) of the data set as an empty set of instances.
        Inefficient, as it just returns an empty dataset derived from a call to getDataSet().
        Specified by:
        getStructure in interface weka.core.converters.Loader
        Specified by:
        getStructure in class weka.core.converters.AbstractLoader
        Returns:
        the structure of the data set as an empty set of Instances
        Throws:
        IOException - if there is no source or parsing fails
      • getDataSet

        public weka.core.Instances getDataSet()
                                       throws IOException
        Return the full data set. If the structure hasn't yet been determined by a call to getStructure then the method should do so before processing the rest of the data set.
        Specified by:
        getDataSet in interface weka.core.converters.Loader
        Specified by:
        getDataSet in class weka.core.converters.AbstractLoader
        Returns:
        the full data set as an Instances object
        Throws:
        IOException - if there is an error during parsing or if getNextInstance has been called on this source (either incremental or batch loading can be used, not both).
      • getNextInstance

        public weka.core.Instance getNextInstance​(weka.core.Instances structure)
                                           throws IOException
        CALSpectrumLoader is unable to process a data set incrementally.
        Specified by:
        getNextInstance in interface weka.core.converters.Loader
        Specified by:
        getNextInstance in class weka.core.converters.AbstractLoader
        Parameters:
        structure - ignored
        Returns:
        never returns without throwing an exception
        Throws:
        IOException - always. CALSpectrumLoader is unable to process a data set incrementally.
      • getRevision

        public String getRevision()
        Returns the revision string.
        Specified by:
        getRevision in interface weka.core.RevisionHandler
        Returns:
        the revision
      • main

        public static void main​(String[] args)
        Main method.
        Parameters:
        args - should contain the name of an input file.