Class BooleanListBitVector
- All Implemented Interfaces:
BitVector,BigList<Boolean>,BooleanBigList,BooleanCollection,BooleanIterable,BooleanStack,Size64,Stack<Boolean>,Serializable,Comparable<BigList<? extends Boolean>>,Iterable<Boolean>,Collection<Boolean>,RandomAccess
public class BooleanListBitVector extends AbstractBitVector implements Serializable
BitVector.
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.
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class it.unimi.dsi.bits.AbstractBitVector
AbstractBitVector.LongBigListView, AbstractBitVector.LongSetView, AbstractBitVector.SubBitVectorNested classes/interfaces inherited from class it.unimi.dsi.fastutil.booleans.AbstractBooleanBigList
AbstractBooleanBigList.BooleanSubList -
Constructor Summary
Constructors Modifier Constructor Description protectedBooleanListBitVector(int capacity)protectedBooleanListBitVector(BooleanBigList list) -
Method Summary
Modifier and Type Method Description voidadd(long index, boolean value)BooleanListBitVectorcopy()Returns a copy of this bit vector.BooleanListBitVectorcopy(long from, long to)Returns a copy of a part of this bit vector.BitVectorensureCapacity(long numBits)protected static voidensureIntegerIndex(long index)booleangetBoolean(long index)static BooleanListBitVectorgetInstance()Creates a new empty bit vector.static BooleanListBitVectorgetInstance(long capacity)longlength()Returns the number of bits in this bit vector.BitVectorlength(long numBits)Sets the number of bits in this bit vector.static BooleanListBitVectorof(int... bit)Creates a new bit vector with given bits.booleanremoveBoolean(long index)booleanset(long index, boolean value)static BooleanListBitVectorwrap(BooleanBigList list)static BooleanListBitVectorwrap(BooleanList list)Methods inherited from class it.unimi.dsi.bits.AbstractBitVector
add, add, add, add, and, append, append, asLongBigList, asLongSet, bits, clear, clear, clear, compareTo, compareTo, count, ensureIndex, ensureRestrictedIndex, equals, equals, fast, fill, fill, fill, fill, firstOne, firstZero, flip, flip, flip, flip, getBoolean, getInt, getLong, hashCode, isPrefix, isProperPrefix, lastOne, lastZero, longestCommonPrefixLength, nextOne, nextZero, or, previousOne, previousZero, removeBoolean, replace, set, set, set, set, size, size, size64, subVector, subVector, toString, xorMethods inherited from class it.unimi.dsi.fastutil.booleans.AbstractBooleanBigList
add, addAll, addAll, addAll, addAll, addAll, addAll, addElements, addElements, contains, get, getElements, indexOf, indexOf, iterator, lastIndexOf, lastIndexOf, listIterator, listIterator, peek, peekBoolean, pop, popBoolean, push, push, rem, remove, removeElements, set, subList, top, topBooleanMethods inherited from class it.unimi.dsi.fastutil.booleans.AbstractBooleanCollection
add, contains, containsAll, remove, removeAll, retainAll, toArray, toBooleanArray, toBooleanArrayMethods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll, toArray, toArrayMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface it.unimi.dsi.fastutil.booleans.BooleanBigList
add, addAll, addAll, addAll, addElements, addElements, get, getElements, indexOf, indexOf, iterator, lastIndexOf, lastIndexOf, listIterator, listIterator, remove, removeElements, set, subListMethods inherited from interface it.unimi.dsi.fastutil.booleans.BooleanCollection
add, addAll, contains, contains, containsAll, rem, remove, removeAll, retainAll, toArray, toBooleanArray, toBooleanArrayMethods inherited from interface java.util.Collection
addAll, containsAll, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray, toArray
-
Constructor Details
-
BooleanListBitVector
-
BooleanListBitVector
protected BooleanListBitVector(int capacity)
-
-
Method Details
-
ensureIntegerIndex
protected static final void ensureIntegerIndex(long index) -
getInstance
-
getInstance
Creates a new empty bit vector. -
of
Creates a new bit vector with given bits. -
wrap
-
wrap
-
length
public long length()Description copied from interface:BitVectorReturns the number of bits in this bit vector.If the number of bits in this vector is smaller than or equal to
Integer.MAX_VALUE, this method is semantically equivalent toList.size(). In any case, this method is semantically equivalent toSize64.size64(), but it is prefererred. -
set
public boolean set(long index, boolean value)- Specified by:
setin interfaceBooleanBigList- Overrides:
setin classAbstractBitVector
-
getBoolean
public boolean getBoolean(long index)- Specified by:
getBooleanin interfaceBooleanBigList
-
add
public void add(long index, boolean value)- Specified by:
addin interfaceBooleanBigList- Overrides:
addin classAbstractBitVector
-
removeBoolean
public boolean removeBoolean(long index)- Specified by:
removeBooleanin interfaceBooleanBigList- Overrides:
removeBooleanin classAbstractBitVector
-
copy
Description copied from interface:BitVectorReturns a copy of a part of this bit vector.- Specified by:
copyin interfaceBitVector- Overrides:
copyin classAbstractBitVector- 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 bitto(not inclusive)
-
copy
Description copied from interface:BitVectorReturns a copy of this bit vector.- Specified by:
copyin interfaceBitVector- Overrides:
copyin classAbstractBitVector- Returns:
- a copy of this bit vector.
-
ensureCapacity
-
length
Description copied from interface:BitVectorSets 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 ofBigList.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:
lengthin interfaceBitVector- Overrides:
lengthin classAbstractBitVector- Returns:
- this bit vector.
-