Package it.unimi.dsi.sux4j.io
Class ChunkedHashStore.Chunk
- java.lang.Object
-
- it.unimi.dsi.sux4j.io.ChunkedHashStore.Chunk
-
- All Implemented Interfaces:
java.lang.Iterable<long[]>
- Enclosing class:
- ChunkedHashStore<T>
public static final class ChunkedHashStore.Chunk extends java.lang.Object implements java.lang.Iterable<long[]>
A chunk returned by aChunkedHashStore
.
-
-
Constructor Summary
Constructors Constructor Description Chunk()
Creates a chunk with all field set to zero or null.Chunk(ChunkedHashStore.Chunk chunk)
Copy constructor for multi-threaded chunk analysis.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
data(long k)
Returns the data of thek
-th triple returned by this chunk.int
index()
The index of this chunk.java.util.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.it.unimi.dsi.fastutil.longs.LongBigList
valueList(it.unimi.dsi.fastutil.longs.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.
-
-
-
Constructor Detail
-
Chunk
public Chunk(ChunkedHashStore.Chunk 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 Detail
-
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
public java.util.Iterator<long[]> iterator()
Returns an iterator over the quadruples associated with this chunk; the returned array of longs is reused at each call.- Specified by:
iterator
in interfacejava.lang.Iterable<long[]>
- Returns:
- an iterator over quadruples formed by a triple (indices 0, 1, 2) and the associated data (index 3).
-
valueList
public it.unimi.dsi.fastutil.longs.LongBigList valueList(it.unimi.dsi.fastutil.longs.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.- 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.
-
-