public class SemiExternalGammaList
extends it.unimi.dsi.fastutil.longs.AbstractLongList
This class is a semi-external LongList
that
MG4J uses to access files containing frequencies.
Instead, this class accesses frequencies in their compressed forms, and provides entry points for random access to each long. At construction time, entry points are computed with a certain step, which is the number of longs accessible from each entry point, or, equivalently, the maximum number of longs that will be necessary to read to access a given long.
Warning: This class is not thread safe, and needs to be synchronised to be used in a multithreaded environment.
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_STEP |
Constructor and Description |
---|
SemiExternalGammaList(InputBitStream longs)
Creates a new semi-external list.
|
SemiExternalGammaList(InputBitStream longs,
int step,
int numLongs)
Creates a new semi-external list.
|
Modifier and Type | Method and Description |
---|---|
long |
getLong(int index) |
int |
size() |
add, add, add, addAll, addAll, addAll, addAll, addAll, addAll, addElements, addElements, compareTo, contains, ensureIndex, ensureRestrictedIndex, equals, get, getElements, hashCode, indexOf, indexOf, iterator, lastIndexOf, lastIndexOf, listIterator, listIterator, longListIterator, longListIterator, longSubList, peek, peekLong, pop, popLong, push, push, rem, remove, remove, removeElements, removeLong, set, set, size, subList, top, topLong, toString
add, contains, containsAll, containsAll, isEmpty, longIterator, rem, removeAll, removeAll, retainAll, retainAll, toArray, toArray, toArray, toLongArray, toLongArray
clear
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
add, clear, contains, containsAll, isEmpty, removeAll, retainAll, toArray, toArray
public static final int DEFAULT_STEP
public SemiExternalGammaList(InputBitStream longs, int step, int numLongs) throws IOException
longs
- a bit stream containing γ-encoded longs.step
- the step used to build random-access entry points, or -1 to get DEFAULT_STEP
.numLongs
- the overall number of offsets (i.e., the number of terms).IOException
public SemiExternalGammaList(InputBitStream longs) throws IOException
This quick-and-dirty constructor estimates the number of longs by checking
for an EOFException
.
longs
- a bit stream containing γ-encoded longs.IOException
public final long getLong(int index)
public int size()
size
in interface Collection<Long>
size
in interface List<Long>
size
in class AbstractCollection<Long>
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.