public class SparseDoubleColumnMap extends DoubleColumnMap
DoubleColumnMap assumes that column IDs are
sparse, ie. they can be any int value. In general, this class is less CPU
and memory efficient than DenseDoubleColumnMap.| Constructor and Description |
|---|
SparseDoubleColumnMap()
Construct a new object, this object initially contains no columns.
|
SparseDoubleColumnMap(java.nio.ByteBuffer buffer)
Construct an object by de-serializing from a
ByteBuffer object. |
SparseDoubleColumnMap(SparseDoubleColumnMap other)
Copy constructor, constructs a new, deep copy of the argument.
|
| Modifier and Type | Method and Description |
|---|---|
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.util.Map<java.lang.Integer,java.lang.Double> |
map()
The backing map of this object, modifying this map will also modify 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.
|
int |
size()
The number of columns this map contains.
|
incAllpublic SparseDoubleColumnMap()
public SparseDoubleColumnMap(SparseDoubleColumnMap other)
other - object to construct a deep copy of.public SparseDoubleColumnMap(java.nio.ByteBuffer buffer)
ByteBuffer object.buffer - the ByteBuffer containing the serialized data.public int size()
public java.util.Map<java.lang.Integer,java.lang.Double> map()
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)
get in class DoubleColumnMapcolumnId - the column ID.public void set(int columnId,
double value)
set in class DoubleColumnMapcolumnId - the column ID.value - the value associated with columnId.public void inc(int columnId,
double value)
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