Package it.unimi.dsi.sux4j.io
Class BucketedHashStore.Bucket
java.lang.Object
it.unimi.dsi.sux4j.io.BucketedHashStore.Bucket
- All Implemented Interfaces:
Iterable<long[]>
- Enclosing class:
- BucketedHashStore<T>
A bucket returned by a
BucketedHashStore
.-
Constructor Summary
ConstructorDescriptionBucket()
Creates a bucket with all field set to zero or null.Bucket
(BucketedHashStore.Bucket bucket) Copy constructor for multi-threaded bucket analysis. -
Method Summary
Modifier and TypeMethodDescriptionlong
data
(long k) Returns the data of thek
-th signature returned by this bucket.long
index()
The index of this bucket.Iterator<long[]>
iterator()
Returns an iterator over the triples associated with this bucket; the returned array of longs is reused at each call.int
size()
The number of signatures in this bucket.valueList
(LongIterable values) Commodity methods that exposes transparently either the data contained in the bucket, or the data obtained by using the bucket 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
-
Bucket
Copy constructor for multi-threaded bucket analysis.- Parameters:
bucket
- a bucket to be copied.
-
Bucket
public Bucket()Creates a bucket with all field set to zero or null. Mainly useful to create marker objects.
-
-
Method Details
-
size
public int size()The number of signatures in this bucket.- Returns:
- the number of signatures in this bucket.
-
index
public long index()The index of this bucket.- Returns:
- the index of this bucket.
-
data
public long data(long k) Returns the data of thek
-th signature returned by this bucket.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 signature.- Returns:
- the corresponding data.
-
iterator
Returns an iterator over the triples associated with this bucket; the returned array of longs is reused at each call. -
valueList
Commodity methods that exposes transparently either the data contained in the bucket, or the data obtained by using the bucket 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 bucket is used to index this list and return a value. Otherwise, the data in the bucket is returned directly.- Returns:
- a big list of longs representing the values associated with each element in the bucket.
-