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.
AbstractBitVector.LongBigListView, AbstractBitVector.LongSetView, AbstractBitVector.SubBitVectorAbstractBooleanBigList.BooleanSubList| Modifier | Constructor and Description |
|---|---|
protected |
BooleanListBitVector(BooleanBigList list) |
protected |
BooleanListBitVector(int capacity) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(long index,
boolean value)
Adds a bit with specified value at the specified index (optional operation).
|
BooleanListBitVector |
copy()
Returns a copy of this bit vector.
|
BooleanListBitVector |
copy(long from,
long to)
Returns a copy of a part of this bit vector.
|
BitVector |
ensureCapacity(long numBits) |
protected static void |
ensureIntegerIndex(long index) |
boolean |
getBoolean(long index)
Returns the value of the specified bit.
|
static BooleanListBitVector |
getInstance()
Creates a new empty bit vector.
|
static BooleanListBitVector |
getInstance(long capacity) |
long |
length()
Returns the number of bits in this bit vector.
|
BitVector |
length(long numBits)
Sets the number of bits in this bit vector.
|
static BooleanListBitVector |
of(int... bit)
Creates a new bit vector with given bits.
|
boolean |
removeBoolean(long index)
Removes a bit with specified index (optional operation).
|
boolean |
set(long index,
boolean value)
Sets the value of the specified bit (optional operation).
|
static BooleanListBitVector |
wrap(BooleanBigList list) |
static BooleanListBitVector |
wrap(BooleanList list) |
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, size, size64, subList, subVector, subVector, toString, xoradd, addAll, addAll, addAll, addAll, addAll, addAll, addAll, addElements, addElements, contains, get, getElements, indexOf, indexOf, iterator, lastIndexOf, lastIndexOf, listIterator, listIterator, listIterator, peek, peekBoolean, pop, popBoolean, push, push, rem, remove, remove, removeElements, set, subList, top, topBooleanadd, booleanIterator, contains, containsAll, containsAll, isEmpty, rem, remove, removeAll, removeAll, retainAll, retainAll, toArray, toArray, toArray, toBooleanArray, toBooleanArrayclone, finalize, getClass, notify, notifyAll, wait, wait, waitaddAll, addAll, addAll, addElements, addElements, getElements, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeElements, subListadd, addAll, get, indexOf, lastIndexOf, remove, setaddAll, booleanIterator, contains, containsAll, rem, removeAll, retainAll, toArray, toArray, toBooleanArray, toBooleanArrayadd, addAll, contains, containsAll, isEmpty, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, stream, toArrayprotected BooleanListBitVector(BooleanBigList list)
protected BooleanListBitVector(int capacity)
protected static final void ensureIntegerIndex(long index)
public static BooleanListBitVector getInstance(long capacity)
public static BooleanListBitVector getInstance()
public static BooleanListBitVector of(int... bit)
public static BooleanListBitVector wrap(BooleanList list)
public static BooleanListBitVector wrap(BooleanBigList list)
public long length()
BitVectorIf the number of bits in this 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().
public boolean set(long index,
boolean value)
BitVectorThis method is semantically equivalent to BooleanList.set(int,boolean),
but it gives access to long indices.
set in interface BitVectorset in interface BooleanBigListset in class AbstractBitVectorindex - the index of a bit.value - the new value.public boolean getBoolean(long index)
BitVectorThis method is semantically equivalent to BooleanList.getBoolean(int),
but it gives access to long indices.
getBoolean in interface BitVectorgetBoolean in interface BooleanBigListindex - the index of a bit.public void add(long index,
boolean value)
BitVectorThis method is semantically equivalent to BooleanList.add(int,boolean),
but it gives access to long indices.
add in interface BitVectoradd in interface BooleanBigListadd in class AbstractBitVectorindex - the index of a bit.value - the value that will be inserted at position index.public boolean removeBoolean(long index)
BitVectorThis method is semantically equivalent to BooleanList.removeBoolean(int),
but it gives access to long indices.
removeBoolean in interface BitVectorremoveBoolean in interface BooleanBigListremoveBoolean in class AbstractBitVectorindex - the index of a bit.public BooleanListBitVector copy(long from, long to)
BitVectorcopy in interface BitVectorcopy in class AbstractBitVectorfrom - the starting bit, inclusive.to - the ending bit, not inclusive.from (inclusive) to bit to
(not inclusive)public BooleanListBitVector copy()
BitVectorcopy in interface BitVectorcopy in class AbstractBitVectorpublic BitVector ensureCapacity(long numBits)
public BitVector length(long numBits)
BitVectorIt is expected that this method will try to allocate exactly the necessary space.
If the number of bits in this vector is smaller than
or equal to Integer.MAX_VALUE, this
method is semantically equivalent to BooleanList.size(int). In any case, this method is semantically
essentially equivalent to BigList.size(long).
length in interface BitVectorlength in class AbstractBitVector