Package weka.experiment

# Class InstancesResultListener

java.lang.Object
weka.experiment.CSVResultListener
weka.experiment.InstancesResultListener

All Implemented Interfaces:
  `Serializable`, `OptionHandler`, `RevisionHandler`, `ResultListener`

public class InstancesResultListener extends CSVResultListener
Outputs the received results in arff format to a Writer. All results must be received before the instances can be written out.

Valid options are:

     -O <file name>
      The filename where output will be stored. Use - for stdout.
      (default temp file)

Version:
  $Revision: 1.11 $
Author:
  Len Trigg (trigg@cs.waikato.ac.nz)
See Also:
  - Serialized Form

## Constructor Summary

Constructors
Constructor
Description
`InstancesResultListener()`
Sets temporary file.

## Method Summary

Modifier and Type
Method
Description
`void`
`acceptResult(ResultProducer rp, Object[] key, Object[] result)`
Collects each instance and adjusts the header information.
`String`
`getRevision()`
Returns the revision string.
`String`
`globalInfo()`
Returns a string describing this result listener
`void`
`postProcess(ResultProducer rp)`
Perform any postprocessing.
`void`
`preProcess(ResultProducer rp)`
Prepare for the results to be received.

### Methods inherited from class weka.experiment.CSVResultListener

`determineColumnConstraints, getOptions, getOutputFile, isResultRequired, listOptions, outputFileName, outputFileTipText, setOptions, setOutputFile, setOutputFileName`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### InstancesResultListener

public InstancesResultListener()
Sets temporary file.

## Method Details

### globalInfo

public String globalInfo()
Returns a string describing this result listener

Overrides:
  `globalInfo` in class `CSVResultListener`
Returns:
  a description of the result listener suitable for displaying in the explorer/experimenter gui

### preProcess

public void preProcess(ResultProducer rp) throws Exception
Prepare for the results to be received.

Specified by:
  `preProcess` in interface `ResultListener`
Overrides:
  `preProcess` in class `CSVResultListener`
Parameters:
  `rp` - the ResultProducer that will generate the results
Throws:
  `Exception` - if an error occurs during preprocessing.

### postProcess

public void postProcess(ResultProducer rp) throws Exception
Perform any postprocessing. When this method is called, it indicates that no more results will be sent that need to be grouped together in any way.

Specified by:
  `postProcess` in interface `ResultListener`
Overrides:
  `postProcess` in class `CSVResultListener`
Parameters:
  `rp` - the ResultProducer that generated the results
Throws:
  `Exception` - if an error occurs

### acceptResult

public void acceptResult(ResultProducer rp, Object[] key, Object[] result) throws Exception
Collects each instance and adjusts the header information.

Specified by:
  `acceptResult` in interface `ResultListener`
Overrides:
  `acceptResult` in class `CSVResultListener`
Parameters:
  `rp` - the ResultProducer that generated the result
  `key` - The key for the results.
  `result` - The actual results.
Throws:
  `Exception` - if the result could not be accepted.

### getRevision

public String getRevision()
Returns the revision string.

Specified by:
  `getRevision` in interface `RevisionHandler`
Overrides:
  `getRevision` in class `CSVResultListener`
Returns:
  the revision