Package it.unimi.dsi.sux4j.io
Class ChunkedHashStore.Chunk
java.lang.Object
it.unimi.dsi.sux4j.io.ChunkedHashStore.Chunk
- All Implemented Interfaces:
Iterable<long[]>
- Enclosing class:
- ChunkedHashStore<T>
A chunk returned by a
ChunkedHashStore
.-
Constructor Summary
ConstructorDescriptionChunk()
Creates a chunk with all field set to zero or null.Chunk
(ChunkedHashStore.Chunk chunk) Copy constructor for multi-threaded chunk analysis. -
Method Summary
Modifier and TypeMethodDescriptionlong
data
(long k) Returns the data of thek
-th triple returned by this chunk.int
index()
The index of this chunk.Iterator<long[]>
iterator()
Returns an iterator over the quadruples associated with this chunk; the returned array of longs is reused at each call.int
size()
The number of triples in this chunk.valueList
(LongIterable values) Commodity methods that exposes transparently either the data contained in the chunk, or the data obtained by using the chunk to index a list.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
Chunk
Copy constructor for multi-threaded chunk analysis.- Parameters:
chunk
- a chunk to be copied.
-
Chunk
public Chunk()Creates a chunk with all field set to zero or null. Mainly useful to create marker objects.
-
-
Method Details
-
size
public int size()The number of triples in this chunk.- Returns:
- the number of triples in this chunk.
-
index
public int index()The index of this chunk.- Returns:
- the index of this chunk.
-
data
public long data(long k) Returns the data of thek
-th triple returned by this chunk.This method provides an alternative random access to data (w.r.t. indexing the fourth element of the quadruples returned by
iterator()
).- Parameters:
k
- the index (in iteration order) of a triple.- Returns:
- the corresponding data.
-
iterator
Returns an iterator over the quadruples associated with this chunk; the returned array of longs is reused at each call. -
valueList
Commodity methods that exposes transparently either the data contained in the chunk, or the data obtained by using the chunk to index a list.- Parameters:
values
- a list of values. Must be either an instance ofLongList
, or an instance ofLongBigList
. If it is notnull
, the data in the chunk is used to index this list and return a value. Otherwise, the data in the chunk is returned directly.- Returns:
- a big list of longs representing the values associated with each element in the chunk.
-