com.rapidminer.example.table
Class BooleanSparseArrayDataRow

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

public class BooleanSparseArrayDataRow
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 boolean arrays instead of double arrays which will reduce the used memory even more.

Author:
Ingo Mierswa
See Also:
Serialized Form

Constructor Summary
BooleanSparseArrayDataRow()
          Creates an empty sparse array data row with size 0.
BooleanSparseArrayDataRow(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)
          Swaps x[a] with x[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

BooleanSparseArrayDataRow

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


BooleanSparseArrayDataRow

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

Method Detail

swapValues

protected void swapValues(int a,
                          int b)
Swaps x[a] with x[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