Class SemiExternalGammaList
java.lang.Object
java.util.AbstractCollection<Long>
it.unimi.dsi.fastutil.longs.AbstractLongCollection
it.unimi.dsi.fastutil.longs.AbstractLongList
it.unimi.dsi.util.SemiExternalGammaList
- All Implemented Interfaces:
it.unimi.dsi.fastutil.longs.LongCollection, it.unimi.dsi.fastutil.longs.LongIterable, it.unimi.dsi.fastutil.longs.LongList, it.unimi.dsi.fastutil.longs.LongStack, it.unimi.dsi.fastutil.Stack<Long>, Comparable<List<? extends Long>>, Iterable<Long>, Collection<Long>, List<Long>, SequencedCollection<Long>
public class SemiExternalGammaList
extends it.unimi.dsi.fastutil.longs.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
-
Nested Class Summary
Nested classes/interfaces inherited from class it.unimi.dsi.fastutil.longs.AbstractLongList
it.unimi.dsi.fastutil.longs.AbstractLongList.LongRandomAccessSubList, it.unimi.dsi.fastutil.longs.AbstractLongList.LongSubList -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new semi-external list.SemiExternalGammaList(InputBitStream longs, int step, int numLongs) Creates a new semi-external list. -
Method Summary
Methods inherited from class it.unimi.dsi.fastutil.longs.AbstractLongList
add, add, addAll, addAll, addAll, addAll, addElements, addElements, clear, compareTo, contains, ensureIndex, ensureRestrictedIndex, equals, forEach, getElements, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, peekLong, popLong, push, rem, removeElements, removeLong, replaceAll, set, setElements, size, subList, toArray, toLongArray, topLong, toStringMethods inherited from class it.unimi.dsi.fastutil.longs.AbstractLongCollection
add, contains, containsAll, containsAll, forEach, remove, removeAll, removeAll, removeIf, retainAll, retainAll, toLongArrayMethods inherited from class AbstractCollection
isEmpty, toArray, toArrayMethods inherited from interface Collection
toArrayMethods inherited from interface List
addFirst, addLast, containsAll, getFirst, getLast, isEmpty, removeAll, removeFirst, removeLast, retainAll, reversed, toArray, toArrayMethods inherited from interface it.unimi.dsi.fastutil.longs.LongCollection
containsAll, longIterator, longParallelStream, longSpliterator, longStream, parallelStream, removeAll, removeIf, removeIf, removeIf, retainAll, spliterator, stream, toLongArrayMethods inherited from interface it.unimi.dsi.fastutil.longs.LongIterable
forEach, forEachMethods inherited from interface it.unimi.dsi.fastutil.longs.LongList
add, add, addAll, addAll, contains, get, indexOf, lastIndexOf, remove, remove, replaceAll, replaceAll, set, setElements, setElements, sort, sort, spliterator, unstableSort, unstableSortMethods inherited from interface it.unimi.dsi.fastutil.longs.LongStack
peek, pop, push, topMethods inherited from interface it.unimi.dsi.fastutil.Stack
isEmpty
-
Field Details
-
DEFAULT_STEP
public static final int DEFAULT_STEP- See Also:
-
-
Constructor Details
-
SemiExternalGammaList
Creates a new semi-external list.- Parameters:
longs- a bit stream containing γ-encoded longs.step- the step used to build random-access entry points, or -1 to getDEFAULT_STEP.numLongs- the overall number of offsets (i.e., the number of terms).- Throws:
IOException
-
SemiExternalGammaList
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
-
-
Method Details
-
getLong
public final long getLong(int index) -
size
public int size()- Specified by:
sizein interfaceCollection<Long>- Specified by:
sizein interfaceList<Long>- Specified by:
sizein classAbstractCollection<Long>
-