class SparseSegmentDataset extends Object implements SegmentDataset
SparseSegmentDataset
is a means of storing segment values
which is suitable when few of the combinations of keys have a value present.
The storage requirements are as follows. Key is 1 word for each dimension. Hashtable entry is 3 words. Value is 1 word. Total space is (4 + d) * v. (May also need hash table to ensure that values are only stored once.)
NOTE: This class is not synchronized.
Constructor and Description |
---|
SparseSegmentDataset()
Creates an empty SparseSegmentDataset.
|
SparseSegmentDataset(Map<CellKey,Object> values)
Creates a SparseSegmentDataset with a given value map.
|
Modifier and Type | Method and Description |
---|---|
SegmentBody |
createSegmentBody(List<Pair<SortedSet<Comparable>,Boolean>> axes)
Return an immutable, final and serializable implementation
of a SegmentBody in order to cache this dataset.
|
boolean |
exists(CellKey pos)
Returns whether there is a value at a given coordinate.
|
double |
getBytes()
Returns the number of bytes occupied by this dataset.
|
double |
getDouble(CellKey pos)
Returns the value at a given coordinate, as a
double . |
int |
getInt(CellKey pos)
Returns the value at a given coordinate, as an
int . |
Object |
getObject(CellKey pos)
Returns the value at a given coordinate, as an
Object . |
SqlStatement.Type |
getType()
Returns the SQL type of the data contained in this dataset.
|
boolean |
isNull(CellKey pos)
Returns whether the cell at a given coordinate is null.
|
Iterator<Map.Entry<CellKey,Object>> |
iterator() |
void |
populateFrom(int[] pos,
SegmentDataset data,
CellKey key) |
void |
populateFrom(int[] pos,
SegmentLoader.RowList rowList,
int column)
Sets the value a given ordinal.
|
void |
put(CellKey key,
Object value) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
SparseSegmentDataset()
SparseSegmentDataset(Map<CellKey,Object> values)
values
- Value mappublic Object getObject(CellKey pos)
SegmentDataset
Object
.getObject
in interface SegmentDataset
pos
- Coordinate positionpublic boolean isNull(CellKey pos)
SegmentDataset
isNull
in interface SegmentDataset
pos
- Coordinate positionpublic int getInt(CellKey pos)
SegmentDataset
int
.getInt
in interface SegmentDataset
pos
- Coordinate positionpublic double getDouble(CellKey pos)
SegmentDataset
double
.getDouble
in interface SegmentDataset
pos
- Coordinate positionpublic boolean exists(CellKey pos)
SegmentDataset
exists
in interface SegmentDataset
pos
- Coordinate positionpublic double getBytes()
SegmentDataset
getBytes
in interface SegmentDataset
public void populateFrom(int[] pos, SegmentDataset data, CellKey key)
populateFrom
in interface SegmentDataset
public void populateFrom(int[] pos, SegmentLoader.RowList rowList, int column)
SegmentDataset
populateFrom
in interface SegmentDataset
pos
- OrdinalrowList
- Row listcolumn
- Column of row listpublic SqlStatement.Type getType()
SegmentDataset
getType
in interface SegmentDataset
public SegmentBody createSegmentBody(List<Pair<SortedSet<Comparable>,Boolean>> axes)
SegmentDataset
createSegmentBody
in interface SegmentDataset
axes
- An array with, for each axis, the set of axis values, sorted
in natural order, and a flag saying whether the null value is also
present.
This is supplied by the SegmentLoader
.SegmentBody
.