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.OptionHandlerLoads 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.BaseRegExpm_RefRegExpthe references to load.static StringREF_REGEXP
-
Constructor Summary
Constructors Constructor Description CALSpectrumLoader()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description weka.core.InstancesgetDataSet()Return the full data set.protected adams.core.base.BaseRegExpgetDefaultRefRegExp()Returns the default regexp for the references.StringgetFileDescription()Get a one line description of the type of fileStringgetFileExtension()Get the file extension used for this type of fileString[]getFileExtensions()Gets all the file extensions used for this type of fileweka.core.InstancegetNextInstance(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.BaseRegExpgetRefRegExp()Returns the regexp to use for matching the reference names to include in the dataset.StringgetRevision()Returns the revision string.weka.core.InstancesgetStructure()Determines and returns (if possible) the structure (internally the header) of the data set as an empty set of instances.StringglobalInfo()Returns a string describing the object.EnumerationlistOptions()Returns an enumeration describing the available options.static voidmain(String[] args)Main method.StringrefRegExpTipText()Returns the tip text for this property.voidsetOptions(String[] options)Sets the OptionHandler's options using the given list.voidsetRefRegExp(adams.core.base.BaseRegExp value)Sets the regexp to use for matching the reference names to include in the dataset.voidsetSource(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:
getFileExtensionin 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:
getFileExtensionsin interfaceweka.core.converters.FileSourcedConverter- Returns:
- the file extensions
-
getFileDescription
public String getFileDescription()
Get a one line description of the type of file- Specified by:
getFileDescriptionin 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:
listOptionsin 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:
setOptionsin 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:
getOptionsin 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:
setSourcein interfaceweka.core.converters.Loader- Overrides:
setSourcein classweka.core.converters.AbstractLoader- Parameters:
input- the input stream- Throws:
IOException- never
-
getStructure
public weka.core.Instances getStructure() throws IOExceptionDetermines 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:
getStructurein interfaceweka.core.converters.Loader- Specified by:
getStructurein 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 IOExceptionReturn 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:
getDataSetin interfaceweka.core.converters.Loader- Specified by:
getDataSetin 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 IOExceptionCALSpectrumLoader is unable to process a data set incrementally.- Specified by:
getNextInstancein interfaceweka.core.converters.Loader- Specified by:
getNextInstancein 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:
getRevisionin 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.
-
-