Package weka.core.converters
Class CALSpectrumLoader
- java.lang.Object
-
- weka.core.converters.AbstractLoader
-
- weka.core.converters.AbstractFileLoader
-
- weka.core.converters.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
-
-
Field Summary
Fields Modifier and Type Field Description protected adams.core.base.BaseRegExp
m_RefRegExp
the references to load.static String
REF_REGEXP
-
Constructor Summary
Constructors Constructor Description CALSpectrumLoader()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description weka.core.Instances
getDataSet()
Return the full data set.protected adams.core.base.BaseRegExp
getDefaultRefRegExp()
Returns the default regexp for the references.String
getFileDescription()
Get a one line description of the type of fileString
getFileExtension()
Get the file extension used for this type of fileString[]
getFileExtensions()
Gets all the file extensions used for this type of fileweka.core.Instance
getNextInstance(weka.core.Instances structure)
CALSpectrumLoader is unable to process a data set incrementally.String[]
getOptions()
Gets the current option settings for the OptionHandler.adams.core.base.BaseRegExp
getRefRegExp()
Returns the regexp to use for matching the reference names to include in the dataset.String
getRevision()
Returns the revision string.weka.core.Instances
getStructure()
Determines and returns (if possible) the structure (internally the header) of the data set as an empty set of instances.String
globalInfo()
Returns a string describing the object.Enumeration
listOptions()
Returns an enumeration describing the available options.static void
main(String[] args)
Main method.String
refRegExpTipText()
Returns the tip text for this property.void
setOptions(String[] options)
Sets the OptionHandler's options using the given list.void
setRefRegExp(adams.core.base.BaseRegExp value)
Sets the regexp to use for matching the reference names to include in the dataset.void
setSource(InputStream input)
Does nothing.
-
-
-
Field Detail
-
REF_REGEXP
public static final String REF_REGEXP
- See Also:
- Constant Field Values
-
m_RefRegExp
protected adams.core.base.BaseRegExp m_RefRegExp
the references to load.
-
-
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 interfaceweka.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 interfaceweka.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 interfaceweka.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 interfaceweka.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 interfaceweka.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 interfaceweka.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 interfaceweka.core.converters.Loader
- Overrides:
setSource
in classweka.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 togetDataSet()
.- Specified by:
getStructure
in interfaceweka.core.converters.Loader
- Specified by:
getStructure
in classweka.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 interfaceweka.core.converters.Loader
- Specified by:
getDataSet
in classweka.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 interfaceweka.core.converters.Loader
- Specified by:
getNextInstance
in classweka.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 interfaceweka.core.RevisionHandler
- Returns:
- the revision
-
main
public static void main(String[] args)
Main method.- Parameters:
args
- should contain the name of an input file.
-
-