wpi.filters
Class AddWithValueFilter

java.lang.Object
  extended byweka.filters.Filter
      extended byweka.filters.AddFilter
          extended bywpi.filters.AddWithValueFilter
All Implemented Interfaces:
weka.core.OptionHandler, java.io.Serializable

public class AddWithValueFilter
extends weka.filters.AddFilter
implements weka.core.OptionHandler

An instance filter that adds a new attribute to the dataset and assigns the given value to all the instances. Uses weka.filters.AddFilter

Version:
$Revision: 0.9 $
Author:
Keith A. Pray (kap@wpi.edu)
See Also:
Serialized Form

Field Summary
protected  java.lang.String value
          The value to assign
 
Fields inherited from class weka.filters.AddFilter
m_AttributeType, m_Insert, m_Labels, m_Name
 
Fields inherited from class weka.filters.Filter
m_NewBatch
 
Constructor Summary
AddWithValueFilter()
           
 
Method Summary
 java.lang.String[] getOptions()
          Gets the current settings of the filter.
 java.lang.String getValue()
          Returns the value to be assigned the attribute
 java.lang.String globalInfo()
          Returns a string decribing this filter.
 boolean input(weka.core.Instance instance)
          Input an instance for filtering.
 java.util.Enumeration listOptions()
          Returns an enumeration describing the available options
static void main(java.lang.String[] argv)
          Main method for testing this class.
 void setOptions(java.lang.String[] options)
          Parses a list of options for this object.
 void setValue(java.lang.String v)
          Sets the value to be assigned the attribute
 java.lang.String valueTextTip()
           
 
Methods inherited from class weka.filters.AddFilter
attributeIndexTipText, attributeNameTipText, getAttributeIndex, getAttributeName, getNominalLabels, nominalLabelsTipText, setAttributeIndex, setAttributeName, setInputFormat, setNominalLabels
 
Methods inherited from class weka.filters.Filter
batchFilterFile, batchFinished, bufferInput, copyStringValues, copyStringValues, filterFile, flushInput, getInputFormat, getInputStringIndex, getOutputFormat, getOutputStringIndex, getStringIndices, inputFormat, isOutputFormatDefined, numPendingOutput, output, outputFormat, outputFormatPeek, outputPeek, push, resetQueue, setOutputFormat, useFilter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

value

protected java.lang.String value
The value to assign

Constructor Detail

AddWithValueFilter

public AddWithValueFilter()
Method Detail

setValue

public void setValue(java.lang.String v)
Sets the value to be assigned the attribute

Parameters:
v - the value

getValue

public java.lang.String getValue()
Returns the value to be assigned the attribute

Returns:
the value

valueTextTip

public java.lang.String valueTextTip()

input

public boolean input(weka.core.Instance instance)
Input an instance for filtering. Filter requires all instances be read before producing output.

Parameters:
instance - the input instance
Returns:
true if the filtered instance may now be collected with output().
Throws:
java.lang.IllegalStateException - if no input format has been defined.

globalInfo

public java.lang.String globalInfo()
Returns a string decribing this filter.

Returns:
a description of the filter suitable for displaying in the explorer/experimenter gui

listOptions

public java.util.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(java.lang.String[] options)
                throws java.lang.Exception
Parses a list of options for this object. Valid options are:

Specified by:
setOptions in interface weka.core.OptionHandler
Parameters:
options - the list of options as an array of strings -V value
Specify the value to assign to the new attribute (default unknown)

Throws:
java.lang.Exception - if an option is not supported

getOptions

public java.lang.String[] getOptions()
Gets the current settings of the filter.

Specified by:
getOptions in interface weka.core.OptionHandler
Returns:
an array of strings suitable for passing to setOptions

main

public static void main(java.lang.String[] argv)
Main method for testing this class.

Parameters:
argv - should contain arguments to the filter: use -h for help