public class BitVectorImpl extends Object implements BitVector, Iterable<Boolean>
BitVector
. This implementation contains an
array of long, and each long stores 64 bits. When more space is
needed, the internal array grows exponentially. This bit vector is
flexible, which means that:
false
.Constructor and Description |
---|
BitVectorImpl()
Constructor of a bit vector of size 0.
|
BitVectorImpl(BitVector bitVector)
Copy constructor of a bit vector.
|
BitVectorImpl(long initialSize)
Constructor of a bit vector of size initialSize.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addBit(boolean bit)
Appends a bit to this bit vector.
|
boolean |
equals(Object obj)
Returns
true if and only if the specified object is also a
BitVector and both contain the same bits in the same order. |
boolean |
getBit(long position)
This is the "access" method of bit vectors.
|
int |
hashCode() |
Iterator<Boolean> |
iterator() |
void |
setBit(long position,
boolean bit)
Sets a bit at a particular position.
|
long |
size() |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
public BitVectorImpl()
public BitVectorImpl(BitVector bitVector)
bitVector
- bit vectorpublic BitVectorImpl(long initialSize)
false
at all indexes.initialSize
- initial size of this bit vectorpublic boolean addBit(boolean bit)
BitVector
public boolean equals(Object obj)
BitVector
true
if and only if the specified object is also a
BitVector and both contain the same bits in the same order.public boolean getBit(long position)
BitVector
public void setBit(long position, boolean bit)
BitVector
Copyright © 2014–2024 Wikidata Toolkit Developers. Generated from source code published under the Apache License 2.0. For more information, see the Wikidata Toolkit homepage