wpi.timesequence
Class AppendInstances

java.lang.Object
  extended bywpi.timesequence.AppendInstances
All Implemented Interfaces:
weka.core.OptionHandler

public class AppendInstances
extends java.lang.Object
implements weka.core.OptionHandler

Appends instances to a target data set. Any attributes existing in the append data set that do not appear in the target data set are added. All instances in the target are set to unknown for those attributes.

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

Field Summary
private  weka.core.Instances append
          Append Instances
private  java.lang.String appendName
          Name of the append file last used
private  weka.core.Instances target
          Target Instances
private  java.lang.String targetName
          Name of the target file used
 
Constructor Summary
AppendInstances()
          Constructor.
AppendInstances(java.lang.String[] options)
          Constructor - uses options to initialize
 
Method Summary
private  boolean add(weka.core.Instances instances)
          Adds the given instances to target.
 boolean append(weka.core.Instances instances)
          Appends instances to the target.
 boolean append(java.lang.String name)
          Appends instances to the target.
static weka.core.Instances appendInstances(weka.core.Instances i1, weka.core.Instances i2)
          Returns a new data set that has all the attributes from both data sets and all data from both data sets.
 weka.core.Instances getAppend()
          Returns the last instances appended.
 java.lang.String getAppendName()
          Returns the file name of the last data set appended.
 java.lang.String[] getOptions()
          Gets the current settings of the filter.
 weka.core.Instances getTarget()
          Returns the target instances.
 java.lang.String getTargetName()
          Returns the target file name.
 java.lang.String globalInfo()
          Returns a string decribing this filter.
private  void init()
          Initializes data members
 java.util.Enumeration listOptions()
          Returns an enumeration describing the available options
static void main(java.lang.String[] argv)
          Main method for testing this class.
 boolean ready()
          Checks if we are ready to appendinstances to the target.
 void setOptions(java.lang.String[] options)
          Parses a list of options for this object.
 boolean setTarget(weka.core.Instances instances)
          Set the target instances
 boolean setTarget(java.lang.String name)
          Sets the target instances to use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

targetName

private java.lang.String targetName
Name of the target file used


appendName

private java.lang.String appendName
Name of the append file last used


target

private weka.core.Instances target
Target Instances


append

private weka.core.Instances append
Append Instances

Constructor Detail

AppendInstances

public AppendInstances()
Constructor.


AppendInstances

public AppendInstances(java.lang.String[] options)
                throws java.lang.Exception
Constructor - uses options to initialize

Parameters:
options - the list of options as an array of strings
Throws:
java.lang.Exception - if an option is not supported
Method Detail

init

private void init()
Initializes data members


setTarget

public boolean setTarget(java.lang.String name)
                  throws java.lang.Exception
Sets the target instances to use.

Parameters:
name - name of the data file containing the instances
Returns:
true if all set to append instances
Throws:
java.lang.Exception

setTarget

public boolean setTarget(weka.core.Instances instances)
Set the target instances

Parameters:
instances - instances to use as target
Returns:
true if all set to append instances

append

public boolean append(java.lang.String name)
               throws java.lang.Exception
Appends instances to the target.

Parameters:
name - name of the data file containing the instances to append
Returns:
true if instances were appended successfully
Throws:
java.lang.Exception

append

public boolean append(weka.core.Instances instances)
               throws java.lang.Exception
Appends instances to the target.

Parameters:
instances - instances to append
Returns:
true if instances were appended successfully
Throws:
java.lang.Exception

appendInstances

public static weka.core.Instances appendInstances(weka.core.Instances i1,
                                                  weka.core.Instances i2)
                                           throws java.lang.Exception
Returns a new data set that has all the attributes from both data sets and all data from both data sets. Attributes apearing in both input data sets occur only once in the returned data set. When attributes with the same name are found to differ they are combined as follows:
If both are nominal the valid values lists are combined.
If their types differ a string attribute with the same name is created.
Instance values are copied from the original data sets and transformed if necessary based on the return data set's attribute types.
The new data set retains the relation name of the first or target data set.

Parameters:
i1 - data set to append instances on to
i2 - data set to be appended
Returns:
the new data set
Throws:
java.lang.Exception

add

private boolean add(weka.core.Instances instances)
Adds the given instances to target.


getTargetName

public java.lang.String getTargetName()
Returns the target file name.

Returns:
name of the file

getTarget

public weka.core.Instances getTarget()
Returns the target instances.

Returns:
the target instances

getAppendName

public java.lang.String getAppendName()
Returns the file name of the last data set appended.

Returns:
name of the file

getAppend

public weka.core.Instances getAppend()
Returns the last instances appended.

Returns:
the last appended instances

ready

public boolean ready()
Checks if we are ready to appendinstances to the target.


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
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. Result is sent to standard out.

Parameters:
argv - should contain arguments.