Class BitVectorImpl
java.lang.Object
org.wikidata.wdtk.storage.datastructures.BitVectorImpl
Default implementation of
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:
- it is always possible to store a bit in any non-negative position without explicitly resizing the vector,
- any non-negative position outside the bit vector can be retrieved and
contains a
false.
- Author:
- Julian Mendez
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor of a bit vector of size 0.BitVectorImpl(long initialSize) Constructor of a bit vector of size initialSize.BitVectorImpl(BitVector bitVector) Copy constructor of a bit vector. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddBit(boolean bit) Appends a bit to this bit vector.booleanReturnstrueif and only if the specified object is also a BitVector and both contain the same bits in the same order.booleangetBit(long position) This is the "access" method of bit vectors.inthashCode()iterator()voidsetBit(long position, boolean bit) Sets a bit at a particular position.longsize()toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
BitVectorImpl
public BitVectorImpl()Constructor of a bit vector of size 0. -
BitVectorImpl
Copy constructor of a bit vector.- Parameters:
bitVector- bit vector
-
BitVectorImpl
public BitVectorImpl(long initialSize) Constructor of a bit vector of size initialSize. The bit vector containsfalseat all indexes.- Parameters:
initialSize- initial size of this bit vector
-
-
Method Details
-
addBit
public boolean addBit(boolean bit) Description copied from interface:BitVectorAppends a bit to this bit vector. -
equals
Description copied from interface:BitVectorReturnstrueif and only if the specified object is also a BitVector and both contain the same bits in the same order. -
getBit
public boolean getBit(long position) Description copied from interface:BitVectorThis is the "access" method of bit vectors. -
hashCode
public int hashCode() -
iterator
-
setBit
public void setBit(long position, boolean bit) Description copied from interface:BitVectorSets a bit at a particular position. -
size
public long size() -
toString
-