Class BooleanListBitVector

  • All Implemented Interfaces:
    BitVector, it.unimi.dsi.fastutil.BigList<java.lang.Boolean>, it.unimi.dsi.fastutil.booleans.BooleanBigList, it.unimi.dsi.fastutil.booleans.BooleanCollection, it.unimi.dsi.fastutil.booleans.BooleanIterable, it.unimi.dsi.fastutil.booleans.BooleanStack, it.unimi.dsi.fastutil.Size64, it.unimi.dsi.fastutil.Stack<java.lang.Boolean>, java.io.Serializable, java.lang.Comparable<it.unimi.dsi.fastutil.BigList<? extends java.lang.Boolean>>, java.lang.Iterable<java.lang.Boolean>, java.util.Collection<java.lang.Boolean>, java.util.RandomAccess

    public class BooleanListBitVector
    extends AbstractBitVector
    implements java.io.Serializable
    A boolean-list based implementation of BitVector.
    See Also:
    Serialized Form
    Implementation Notes:
    This implementation of a bit vector is based on a backing list of booleans. It is rather inefficient, but useful for wrapping purposes, for covering completely the code in AbstractBitVector and for creating mock objects.
    • Constructor Detail

      • BooleanListBitVector

        protected BooleanListBitVector​(it.unimi.dsi.fastutil.booleans.BooleanBigList list)
      • BooleanListBitVector

        protected BooleanListBitVector​(int capacity)
    • Method Detail

      • ensureIntegerIndex

        protected static final void ensureIntegerIndex​(long index)
      • of

        public static BooleanListBitVector of​(int... bit)
        Creates a new bit vector with given bits.
      • wrap

        public static BooleanListBitVector wrap​(it.unimi.dsi.fastutil.booleans.BooleanList list)
      • wrap

        public static BooleanListBitVector wrap​(it.unimi.dsi.fastutil.booleans.BooleanBigList list)
      • length

        public long length()
        Description copied from interface: BitVector
        Returns the number of bits in this bit vector.

        If the number of bits in this bit vector is smaller than or equal to Integer.MAX_VALUE, this method is semantically equivalent to List.size(). In any case, this method is semantically equivalent to Size64.size64(), but it is prefererred.

        Specified by:
        length in interface BitVector
        Returns:
        the number of bits in this bit vector.
      • set

        public boolean set​(long index,
                           boolean value)
        Specified by:
        set in interface it.unimi.dsi.fastutil.booleans.BooleanBigList
        Overrides:
        set in class AbstractBitVector
      • getBoolean

        public boolean getBoolean​(long index)
        Specified by:
        getBoolean in interface it.unimi.dsi.fastutil.booleans.BooleanBigList
      • add

        public void add​(long index,
                        boolean value)
        Specified by:
        add in interface it.unimi.dsi.fastutil.booleans.BooleanBigList
        Overrides:
        add in class AbstractBitVector
      • removeBoolean

        public boolean removeBoolean​(long index)
        Specified by:
        removeBoolean in interface it.unimi.dsi.fastutil.booleans.BooleanBigList
        Overrides:
        removeBoolean in class AbstractBitVector
      • copy

        public BooleanListBitVector copy​(long from,
                                         long to)
        Description copied from interface: BitVector
        Returns a copy of a part of this bit vector.
        Specified by:
        copy in interface BitVector
        Overrides:
        copy in class AbstractBitVector
        Parameters:
        from - the starting bit, inclusive.
        to - the ending bit, not inclusive.
        Returns:
        a copy of the part of this bit vector going from bit from (inclusive) to bit to (not inclusive)
      • ensureCapacity

        public BitVector ensureCapacity​(long numBits)
      • length

        public BitVector length​(long numBits)
        Description copied from interface: BitVector
        Sets the number of bits in this bit vector.

        It is expected that this method will try to allocate exactly the necessary space.

        If the argument fits an integer, this method has the same side effects of BooleanList.size(int). In any case, this method has the same side effects of BigList.size(long), but it is preferred, as it has the advantage of returning this bit vector, thus making it possible to chain methods.

        Specified by:
        length in interface BitVector
        Overrides:
        length in class AbstractBitVector
        Parameters:
        numBits - the new length in bits for this bit vector.
        Returns:
        this bit vector.