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