com.rapidminer.example.table
Class FloatSparseArrayDataRow

java.lang.Object
  extended by com.rapidminer.example.table.DataRow
      extended by com.rapidminer.example.table.AbstractSparseArrayDataRow
          extended by com.rapidminer.example.table.FloatSparseArrayDataRow
All Implemented Interfaces:
SparseDataRow, java.io.Serializable

public class FloatSparseArrayDataRow
extends AbstractSparseArrayDataRow

Implementation of DataRow that is backed by primitive arrays. Should always be used if more than 50% of the data is sparse. As fast (or even faster than map implementation) but needs considerably less memory. This implementation uses float arrays instead of double arrays which might reduce the used memory even more.

Author:
Ingo Mierswa, Shevek
See Also:
Serialized Form

Constructor Summary
FloatSparseArrayDataRow()
          Creates an empty sparse array data row with size 0.
FloatSparseArrayDataRow(int size)
          Creates a sparse array data row of the given size.
 
Method Summary
protected  double[] getAllValues()
           
 double getValue(int index)
          Returns the desired data for the given attribute.
 void removeValue(int index)
           
 void resizeValues(int length)
           
 void setValue(int index, double v)
          Sets the given data for the given attribute.
protected  void swapValues(int a, int b)
           
 
Methods inherited from class com.rapidminer.example.table.AbstractSparseArrayDataRow
ensureNumberOfColumns, get, getNonDefaultIndices, getNonDefaultValues, set, swap, toString, trim
 
Methods inherited from class com.rapidminer.example.table.DataRow
get, set
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FloatSparseArrayDataRow

public FloatSparseArrayDataRow()
Creates an empty sparse array data row with size 0.


FloatSparseArrayDataRow

public FloatSparseArrayDataRow(int size)
Creates a sparse array data row of the given size.

Method Detail

swapValues

protected void swapValues(int a,
                          int b)
Specified by:
swapValues in class AbstractSparseArrayDataRow

resizeValues

public void resizeValues(int length)
Specified by:
resizeValues in class AbstractSparseArrayDataRow

removeValue

public void removeValue(int index)
Specified by:
removeValue in class AbstractSparseArrayDataRow

getValue

public double getValue(int index)
Returns the desired data for the given attribute.

Specified by:
getValue in class AbstractSparseArrayDataRow

setValue

public void setValue(int index,
                     double v)
Sets the given data for the given attribute.

Specified by:
setValue in class AbstractSparseArrayDataRow

getAllValues

protected double[] getAllValues()
Specified by:
getAllValues in class AbstractSparseArrayDataRow


Copyright © 2001-2009 by Rapid-I