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.SubBitVector
Modifier | Constructor and Description |
---|---|
protected |
BooleanListBitVector(it.unimi.dsi.fastutil.booleans.BooleanList 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).
|
BitVector |
copy()
Returns a copy of this bit vector.
|
BitVector |
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(it.unimi.dsi.fastutil.booleans.BooleanList list) |
add, add, add, add, and, append, append, asLongBigList, asLongSet, bits, clear, clear, clear, compareTo, compareTo, count, ensureIndex, ensureRestrictedIndex, equals, fast, fill, fill, fill, fill, firstOne, firstZero, flip, flip, flip, flip, getBoolean, getInt, getLong, hashCode, lastOne, lastZero, longestCommonPrefixLength, nextOne, nextZero, or, previousOne, previousZero, removeBoolean, replace, set, set, set, set, size, size, subList, subVector, subVector, toString, xor
add, addAll, addAll, addAll, addAll, addAll, addAll, addElements, addElements, booleanListIterator, booleanListIterator, booleanSubList, contains, ensureIndex, ensureRestrictedIndex, get, getElements, indexOf, indexOf, iterator, lastIndexOf, lastIndexOf, listIterator, listIterator, peek, peekBoolean, pop, popBoolean, push, push, rem, remove, remove, removeElements, set, top, topBoolean
add, booleanIterator, contains, containsAll, containsAll, isEmpty, rem, removeAll, removeAll, retainAll, retainAll, toArray, toArray, toArray, toBooleanArray, toBooleanArray
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addAll, addAll, addAll, addElements, addElements, booleanListIterator, booleanListIterator, booleanSubList, getElements, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeElements
add, add, addAll, addAll, contains, containsAll, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeAll, retainAll, set, toArray, toArray
protected BooleanListBitVector(it.unimi.dsi.fastutil.booleans.BooleanList 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(it.unimi.dsi.fastutil.booleans.BooleanList list)
public long length()
BitVector
If the number of bits in this vector is smaller than or equal to Integer.MAX_VALUE
, this
method is semantically equivalent to List.size()
.
public boolean set(long index, boolean value)
BitVector
This method is semantically equivalent to BooleanList.set(int,boolean)
,
but it gives access to long indices.
set
in interface BitVector
set
in class AbstractBitVector
index
- the index of a bit.value
- the new value.public boolean getBoolean(long index)
BitVector
This method is semantically equivalent to BooleanList.getBoolean(int)
,
but it gives access to long indices.
getBoolean
in interface BitVector
index
- the index of a bit.public void add(long index, boolean value)
BitVector
This method is semantically equivalent to BooleanList.add(int,boolean)
,
but it gives access to long indices.
add
in interface BitVector
add
in class AbstractBitVector
index
- the index of a bit.value
- the value that will be inserted at position index
.public boolean removeBoolean(long index)
BitVector
This method is semantically equivalent to BooleanList.removeBoolean(int)
,
but it gives access to long indices.
removeBoolean
in interface BitVector
removeBoolean
in class AbstractBitVector
index
- the index of a bit.public BitVector copy(long from, long to)
BitVector
copy
in interface BitVector
copy
in class AbstractBitVector
from
- the starting bit, inclusive.to
- the ending bit, not inclusive.from
(inclusive) to bit to
(not inclusive)public BitVector copy()
BitVector
copy
in interface BitVector
copy
in class AbstractBitVector
public BitVector ensureCapacity(long numBits)
public BitVector length(long numBits)
BitVector
It 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)
.
length
in interface BitVector
length
in class AbstractBitVector
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.