it.unimi.dsi.sux4j.util
Class TwoSizesLongBigList

java.lang.Object
  extended by it.unimi.dsi.fastutil.longs.AbstractLongCollection
      extended by it.unimi.dsi.fastutil.longs.AbstractLongList
          extended by it.unimi.dsi.util.AbstractLongBigList
              extended by it.unimi.dsi.sux4j.util.TwoSizesLongBigList
All Implemented Interfaces:
LongCollection, LongIterable, LongList, LongStack, Stack<java.lang.Long>, LongBigList, java.io.Serializable, java.lang.Comparable<java.util.List<? extends java.lang.Long>>, java.lang.Iterable<java.lang.Long>, java.util.Collection<java.lang.Long>, java.util.List<java.lang.Long>

public class TwoSizesLongBigList
extends AbstractLongBigList
implements java.io.Serializable

A compressed big list of longs; small elements and large elements are stored separately, using two different, optimally chosen bit sizes.

Instances of this class store in a compacted form a list of natural numbers. Values are provided either through an iterable object. You will obtain a reduction in size only if the distribution of the values of the list is skewed towards small values.

Implementation details

Instances of this class store elements in two different LongArrayBitVector-based lists—one for large values and one for small values. The threshold between large and small is established by measuring at construction time the most proficuous choice. A ranking structure built on a marker array (recording which elements are stored in the large list) provides access of the correct element in each array.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class it.unimi.dsi.util.AbstractLongBigList
AbstractLongBigList.LongSubBigList
 
Nested classes/interfaces inherited from class it.unimi.dsi.fastutil.longs.AbstractLongList
AbstractLongList.LongSubList
 
Constructor Summary
TwoSizesLongBigList(ByteIterable elements)
          Builds a new two-sizes long big list using a given iterable object.
TwoSizesLongBigList(IntIterable elements)
          Builds a new two-sizes long big list using a given iterable object.
TwoSizesLongBigList(LongIterable elements)
          Builds a new two-sizes long big list using a given iterable object.
TwoSizesLongBigList(ShortIterable elements)
          Builds a new two-sizes long big list using a given iterable object.
 
Method Summary
 long getLong(long index)
           
 long length()
           
 long numBits()
           
 
Methods inherited from class it.unimi.dsi.util.AbstractLongBigList
add, ensureIndex, ensureRestrictedIndex, getLong, length, removeLong, set, size, subList
 
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 class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface it.unimi.dsi.fastutil.longs.LongList
add, addAll, addAll, addAll, addElements, addElements, getElements, indexOf, iterator, lastIndexOf, listIterator, listIterator, longListIterator, longListIterator, longSubList, removeElements, removeLong, set, size, subList
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, lastIndexOf, remove, remove, removeAll, retainAll, set, toArray, toArray
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface it.unimi.dsi.fastutil.longs.LongCollection
add, addAll, contains, containsAll, longIterator, rem, removeAll, retainAll, toArray, toArray, toLongArray, toLongArray
 
Methods inherited from interface it.unimi.dsi.fastutil.Stack
isEmpty
 

Constructor Detail

TwoSizesLongBigList

public TwoSizesLongBigList(IntIterable elements)
Builds a new two-sizes long big list using a given iterable object.

Parameters:
elements - an iterable object.

TwoSizesLongBigList

public TwoSizesLongBigList(ShortIterable elements)
Builds a new two-sizes long big list using a given iterable object.

Parameters:
elements - an iterable object.

TwoSizesLongBigList

public TwoSizesLongBigList(ByteIterable elements)
Builds a new two-sizes long big list using a given iterable object.

Parameters:
elements - an iterable object.

TwoSizesLongBigList

public TwoSizesLongBigList(LongIterable elements)
Builds a new two-sizes long big list using a given iterable object.

Parameters:
elements - an iterable object.
Method Detail

getLong

public long getLong(long index)
Specified by:
getLong in interface LongBigList

length

public long length()
Specified by:
length in interface LongBigList

numBits

public long numBits()