nz.ac.waikato.mcennis.rat.graph.algorithm.reusablecores.datavector
Class InstanceDataVector

java.lang.Object
  extended by nz.ac.waikato.mcennis.rat.graph.algorithm.reusablecores.datavector.InstanceDataVector
All Implemented Interfaces:
DataVector

public class InstanceDataVector
extends java.lang.Object
implements DataVector

Data vector backed by a weka Instance object


Constructor Summary
InstanceDataVector(weka.core.Instance s)
          Creates a data vector backed by a weka instance object stored by reference.
 
Method Summary
 java.lang.Object getCurrentIndex()
          return the index at the current position of the iterator
 double getCurrentValue()
          return the value at the current position of the iterator.
 double getValue(java.lang.Object index)
          Get the value at the given index.
 boolean hasNext()
          Does the vector contain any additional non-zero values?
 void next()
          Move the iterator to the next non-zero index-value pair
 void reset()
          Reset the iterator to the first index of the function, potentially creating a new ordering of objects on some data vectors (i.e.
 void setSize(int s)
          Set the dimensionality of this vector
 int size()
          Returns the number of dimensions of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstanceDataVector

public InstanceDataVector(weka.core.Instance s)
Creates a data vector backed by a weka instance object stored by reference.

Parameters:
s - Instance object to be stored
Method Detail

size

public int size()
Description copied from interface: DataVector
Returns the number of dimensions of this object. This is frequently not the number of non-zero entries.

Specified by:
size in interface DataVector
Returns:
dimension of the vector.

setSize

public void setSize(int s)
Description copied from interface: DataVector
Set the dimensionality of this vector

Specified by:
setSize in interface DataVector
Parameters:
s - dimensionality of the vector

getValue

public double getValue(java.lang.Object index)
Description copied from interface: DataVector
Get the value at the given index. Note that this need not be an integer. Some classes require integer values and will throw an exception if the object does not convert into an integer.

Specified by:
getValue in interface DataVector
Parameters:
index - index of the desired value
Returns:
value at the given index

reset

public void reset()
Description copied from interface: DataVector
Reset the iterator to the first index of the function, potentially creating a new ordering of objects on some data vectors (i.e. HashMap objects).

Specified by:
reset in interface DataVector

getCurrentValue

public double getCurrentValue()
Description copied from interface: DataVector
return the value at the current position of the iterator.

Specified by:
getCurrentValue in interface DataVector
Returns:
current value

getCurrentIndex

public java.lang.Object getCurrentIndex()
Description copied from interface: DataVector
return the index at the current position of the iterator

Specified by:
getCurrentIndex in interface DataVector
Returns:

next

public void next()
Description copied from interface: DataVector
Move the iterator to the next non-zero index-value pair

Specified by:
next in interface DataVector

hasNext

public boolean hasNext()
Description copied from interface: DataVector
Does the vector contain any additional non-zero values?

Specified by:
hasNext in interface DataVector
Returns:
are there values left.