All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home

Interface weka.core.converters.Loader

public interface Loader
extends Serializable
Interface to something that can load Instances from an input source in some format.

Author:
Mark Hall (mhall@cs.waikato.ac.nz)

Method Index

 o getDataSet()
Return the full data set.
 o getNextInstance()
Read the data set incrementally---get the next instance in the data set or returns null if there are no more instances to get.
 o getStructure()
Determines and returns (if possible) the structure (internally the header) of the data set as an empty set of instances.
 o setSource(File)
Resets the Loader object and sets the source of the data set to be the supplied File object.
 o setSource(InputStream)
Resets the Loader object and sets the source of the data set to be the supplied InputStream.

Methods

 o setSource
 public abstract void setSource(File file) throws IOException
Resets the Loader object and sets the source of the data set to be the supplied File object.

Parameters:
file - the File
Throws: IOException
if an error occurs support loading from a File.

    public_normal_behavior
      requires: file != null
                && (* file exists *);
      modifiable: model_sourceSupplied, model_structureDetermined;
      ensures: model_sourceSupplied == true 
               && model_structureDetermined == false;
  also
    public_exceptional_behavior
      requires: file == null
                || (* file does not exist *);
    signals: (IOException);
 
 o setSource
 public abstract void setSource(InputStream input) throws IOException
Resets the Loader object and sets the source of the data set to be the supplied InputStream.

Parameters:
input - the source InputStream
Throws: IOException
if this Loader doesn't support loading from a File.
 o getStructure
 public abstract Instances getStructure() throws IOException
Determines and returns (if possible) the structure (internally the header) of the data set as an empty set of instances.

Returns:
the structure of the data set as an empty set of Instances
Throws: IOException
if there is no source or parsing fails

    public_normal_behavior
      requires: model_sourceSupplied == true
                && model_structureDetermined == false
                && (* successful parse *);
      modifiable: model_structureDetermined;
      ensures: \result != null
               && \result.numInstances() == 0
               && model_structureDetermined == true;
  also
    public_exceptional_behavior
      requires: model_sourceSupplied == false
                || (* unsuccessful parse *);
      signals: (IOException);
 
 o getDataSet
 public abstract 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.

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).

    public_normal_behavior
      requires: model_sourceSupplied == true
                && (* successful parse *);
      modifiable: model_structureDetermined;
      ensures: \result != null
               && \result.numInstances() >= 0
               && model_structureDetermined == true;
  also
    public_exceptional_behavior
      requires: model_sourceSupplied == false
                || (* unsuccessful parse *);
      signals: (IOException);
 
 o getNextInstance
 public abstract Instance getNextInstance() throws IOException
Read the data set incrementally---get the next instance in the data set or returns null if there are no more instances to get. If the structure hasn't yet been determined by a call to getStructure then method should do so before returning the next instance in the data set. If it is not possible to read the data set incrementally (ie. in cases where the data set structure cannot be fully established before all instances have been seen) then an exception should be thrown.

Returns:
the next instance in the data set as an Instance object or null if there are no more instances to be read
Throws: IOException
if there is an error during parsing or if getDataSet has been called on this source (either incremental or batch loading can be used, not both).

    public_normal_behavior
    {|
       requires: model_sourceSupplied == true
                 && (* successful parse *);
       modifiable: model_structureDetermined;
       ensures: model_structureDetermined == true
                && \result != null;
     also
       requires: model_sourceSupplied == true
                 && (* no further input *);
       modifiable: model_structureDetermined;
       ensures: model_structureDetermined == true
                && \result == null;
    |}
  also
    public_exceptional_behavior
    {|
       requires: model_sourceSupplied == false
                 || (* unsuccessful parse *);
       signals: (IOException);
     also
       requires: (* unable to process data set incrementally *);
       signals: (IOException);
    |}
 

All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home