Class SemiExternalGammaBigList

All Implemented Interfaces:
BigList<Long>, LongBigList, LongCollection, LongIterable, LongStack, Size64, Stack<Long>, Comparable<BigList<? extends Long>>, Iterable<Long>, Collection<Long>

public class SemiExternalGammaBigList extends 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
  • Field Details

  • Constructor Details

    • SemiExternalGammaBigList

      public SemiExternalGammaBigList(InputBitStream longs, int step, long 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, 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:
      IOException
    • SemiExternalGammaBigList

      public SemiExternalGammaBigList(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
  • Method Details

    • getLong

      public final long getLong(long index)
    • size64

      public long size64()