public class DenseDoubleColumnMap extends DoubleColumnMap
DoubleColumnMap assumes that column IDs are
dense, ie. they are contiguous values from 0 to capacity - 1. In general,
this class is more CPU and memory efficient than
SparseDoubleColumnMap.| Constructor and Description |
|---|
DenseDoubleColumnMap(java.nio.ByteBuffer buffer)
Construct an object by de-serializing from a
ByteBuffer object. |
DenseDoubleColumnMap(DenseDoubleColumnMap other)
Copy constructor, constructs a new, deep copy of the argument.
|
DenseDoubleColumnMap(int capacity)
Construct a new object based on a capacity.
|
| Modifier and Type | Method and Description |
|---|---|
double[] |
array()
The backing array of this object, modifying this array will also modify
this object.
|
int |
capacity()
The capacity of the object.
|
void |
clear()
Resets all values.
|
boolean |
contains(int columnId)
Check if this map contains the specified column.
|
double |
get(int columnId)
Returns the value associated with a particular column ID.
|
void |
inc(int columnId,
double value)
Increments the current value associated with a column ID.
|
DoubleColumnIterator |
iterator()
Returns an iterator over the columnId-value pairs contained in this
object.
|
java.nio.ByteBuffer |
serialize()
ByteBuffer object containing the serialized data for this
object. |
void |
set(int columnId,
double value)
Sets the value associated with a particular column ID.
|
incAllpublic DenseDoubleColumnMap(int capacity)
capacity - the capacity of this object, must be strictly positive.public DenseDoubleColumnMap(DenseDoubleColumnMap other)
other - object to construct a deep copy of.public DenseDoubleColumnMap(java.nio.ByteBuffer buffer)
ByteBuffer object.buffer - the ByteBuffer containing the serialized data.public int capacity()
public double[] array()
public java.nio.ByteBuffer serialize()
ByteBuffer object containing the serialized data for this
object.public boolean contains(int columnId)
contains in class DoubleColumnMapcolumnId - the column ID to check.public double get(int columnId)
columnId is
out-of-bounds.get in class DoubleColumnMapcolumnId - the column ID.public void set(int columnId,
double value)
columnId is
out-of-bounds.set in class DoubleColumnMapcolumnId - the column ID.value - the value associated with columnId.public void inc(int columnId,
double value)
columnId is
out-of-bounds.inc in class DoubleColumnMapcolumnId - the column ID.value - the value to increment by.public void clear()
clear in class DoubleColumnMappublic DoubleColumnIterator iterator()
iterator in class DoubleColumnMap