it.unimi.dsi.util
Class SemiExternalGammaList
java.lang.Object
it.unimi.dsi.fastutil.longs.AbstractLongCollection
it.unimi.dsi.fastutil.longs.AbstractLongList
it.unimi.dsi.util.SemiExternalGammaList
- All Implemented Interfaces:
- LongCollection, LongIterable, LongList, LongStack, Stack<Long>, Comparable<List<? extends Long>>, Iterable<Long>, Collection<Long>, List<Long>
public class SemiExternalGammaList
- extends AbstractLongList
Provides semi-external random access to a list of γ-encoded integers.
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.
- Author:
- Fabien Campagne, Sebastiano Vigna
Methods inherited from class it.unimi.dsi.fastutil.longs.AbstractLongList |
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 |
Methods inherited from class it.unimi.dsi.fastutil.longs.AbstractLongCollection |
add, clear, contains, containsAll, containsAll, isEmpty, longIterator, rem, removeAll, removeAll, retainAll, retainAll, toArray, toArray, toArray, toLongArray, toLongArray |
Methods inherited from interface it.unimi.dsi.fastutil.Stack |
isEmpty |
DEFAULT_STEP
public static final int DEFAULT_STEP
- See Also:
- Constant Field Values
SemiExternalGammaList
public SemiExternalGammaList(InputBitStream longs,
int step,
int numLongs)
throws IOException
- Creates a new semi-external list.
- Parameters:
longs
- a bit stream containing γ-encoded longs.step
- the step used to build random-access entry points.numLongs
- the overall number of offsets (i.e., the number of terms).
- Throws:
IOException
SemiExternalGammaList
public SemiExternalGammaList(InputBitStream longs)
throws IOException
- Creates a new semi-external list.
This quick-and-dirty constructor estimates the number of longs by checking
for an EOFException
.
- Parameters:
longs
- a bit stream containing γ-encoded longs.
- Throws:
IOException
getLong
public final long getLong(int index)
size
public int size()