Class SemiExternalGammaBigList

  • All Implemented Interfaces:
    it.unimi.dsi.fastutil.BigList<java.lang.Long>, it.unimi.dsi.fastutil.longs.LongBigList, it.unimi.dsi.fastutil.longs.LongCollection, it.unimi.dsi.fastutil.longs.LongIterable, it.unimi.dsi.fastutil.longs.LongStack, it.unimi.dsi.fastutil.Size64, it.unimi.dsi.fastutil.Stack<java.lang.Long>, java.lang.Comparable<it.unimi.dsi.fastutil.BigList<? extends java.lang.Long>>, java.lang.Iterable<java.lang.Long>, java.util.Collection<java.lang.Long>

    public class SemiExternalGammaBigList
    extends it.unimi.dsi.fastutil.longs.AbstractLongBigList
    Provides semi-external random access to a big list of γ-encoded integers.

    This class is a semi-external LongBigList 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.

    Since:
    2.0
    Author:
    Fabien Campagne, Sebastiano Vigna
    • Nested Class Summary

      • Nested classes/interfaces inherited from class it.unimi.dsi.fastutil.longs.AbstractLongBigList

        it.unimi.dsi.fastutil.longs.AbstractLongBigList.LongRandomAccessSubList, it.unimi.dsi.fastutil.longs.AbstractLongBigList.LongSubList
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int DEFAULT_STEP  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long getLong​(long index)  
      long size64()  
      • Methods inherited from class it.unimi.dsi.fastutil.longs.AbstractLongBigList

        add, add, add, addAll, addAll, addAll, addAll, addElements, addElements, clear, compareTo, contains, ensureIndex, ensureRestrictedIndex, equals, forEach, get, getElements, hashCode, indexOf, indexOf, iterator, lastIndexOf, lastIndexOf, listIterator, listIterator, peek, peekLong, pop, popLong, push, push, rem, remove, removeElements, removeLong, set, set, setElements, size, size, subList, top, topLong, toString
      • Methods inherited from class it.unimi.dsi.fastutil.longs.AbstractLongCollection

        add, contains, containsAll, containsAll, forEach, remove, removeAll, removeAll, removeIf, retainAll, retainAll, toArray, toLongArray, toLongArray
      • Methods inherited from class java.util.AbstractCollection

        isEmpty, toArray, toArray
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        containsAll, isEmpty, removeAll, retainAll, toArray, toArray, toArray
      • Methods inherited from interface it.unimi.dsi.fastutil.longs.LongBigList

        addAll, addAll, addAll, addAll, getElements, setElements, setElements, spliterator
      • Methods inherited from interface it.unimi.dsi.fastutil.longs.LongCollection

        add, contains, containsAll, longIterator, longParallelStream, longSpliterator, longStream, parallelStream, remove, removeAll, removeIf, removeIf, removeIf, retainAll, stream, toArray, toLongArray, toLongArray
      • Methods inherited from interface it.unimi.dsi.fastutil.longs.LongIterable

        forEach, forEach
      • Methods inherited from interface it.unimi.dsi.fastutil.Stack

        isEmpty
    • Constructor Detail

      • SemiExternalGammaBigList

        public SemiExternalGammaBigList​(InputBitStream longs,
                                        int step,
                                        long numLongs)
                                 throws java.io.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, or -1 to get DEFAULT_STEP; note that a step causing more than 231 slots will be silently increased.
        numLongs - the overall number of offsets (i.e., the number of terms).
        Throws:
        java.io.IOException
      • SemiExternalGammaBigList

        public SemiExternalGammaBigList​(InputBitStream longs)
                                 throws java.io.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:
        java.io.IOException
    • Method Detail

      • getLong

        public final long getLong​(long index)
      • size64

        public long size64()