public class DenseBitVectorCellFactory extends Object implements BitVectorCellFactory<DenseBitVectorCell>
DataCell
s holding a DenseBitVector
. As data cells are read only this factory can be
used to initialize the bit vector accordingly and then create a data cell from it. and(BitVectorValue, BitVectorValue)
,
or(BitVectorValue, BitVectorValue)
, etc.) on two data cells holding bit vectors.Constructor and Description 

DenseBitVectorCellFactory(DenseBitVector vector)
A copy of the specified vector is stored in the created bit vector cell.

DenseBitVectorCellFactory(DenseBitVectorCell cell,
long startIdx,
long endIdx)
Initializes the vector from a subsequence of the specified cell.

DenseBitVectorCellFactory(long length)
Initializes the factory to the specified length, all bits cleared.

DenseBitVectorCellFactory(long[] bits,
long length)
Initializes the factory to the specified length, initializing the bits from the passed array.

DenseBitVectorCellFactory(String hexString)
Initializes the created bit vector from the hex representation in the passed string.

Modifier and Type  Method and Description 

static DenseBitVectorCell 
and(BitVectorValue bv1,
BitVectorValue bv2)
Creates a dense bit vector cell containing the result of the AND operation on the passed operands.

long 
cardinality()
Number of bits set in this bit vector.

void 
clear(long bitIndex)
Clears the bit with the specified index in the vector.

DenseBitVectorCell 
createDataCell()
Creates a
DataCell from the currently stored bit vector. 
boolean 
get(long bitIdx)
Returns true if the bit at the specified index is set.

boolean 
isEmpty()
Returns true if no bits are set in this bit vector.

long 
length()
Returns the number of bits stored in this vector.

long 
nextClearBit(long startIdx)
Finds the next bit not set (that is '0') on or after the specified index.

long 
nextSetBit(long startIdx)
Finds the next bit set to one on or after the specified index.

static DenseBitVectorCell 
or(BitVectorValue bv1,
BitVectorValue bv2)
Creates a dense bit vector cell containing the result of the OR operation on the passed operands.

void 
set(long bitIndex)
Sets the bit with the specified index in the vector.

void 
set(long bitIdx,
boolean value)
Sets the bit at the specified index to the new value.

void 
set(long startIdx,
long endIdx)
Sets all bits in the specified range.

String 
toBinaryString()
Returns the binary string representation of the bits in this vector.

String 
toHexString()
Returns the hex representation of the bits in this vector.

static DenseBitVectorCell 
xor(BitVectorValue bv1,
BitVectorValue bv2)
Creates a dense bit vector cell containing the result of the XOR operation on the passed operands.

public DenseBitVectorCellFactory(long length)
length
 of the vector in the cell to createpublic DenseBitVectorCellFactory(long[] bits, long length)
DenseBitVector.getAllBits()
method.bits
 the array containing the initial values of the vectorlength
 the number of bits to use from the array. If the array is too long (i.e. contains more than length
bits) the additional bits are ignored. If the array is too short, an exception is thrown.IllegalArgumentException
 if length is negative or MAX_VALUE, or if the length of the argument array is
less than (length  1) >> 6) + 1public DenseBitVectorCellFactory(DenseBitVector vector)
vector
 used to initialize the bits.public DenseBitVectorCellFactory(DenseBitVectorCell cell, long startIdx, long endIdx)
startIdx
to endIdx  1
. The length of the resulting vector is
startIdx  endIdx
.cell
 the bit vector cell to take the subsequence from.startIdx
 the first bit to include in the created bit vectorendIdx
 the first bit NOT to include in the result vectorpublic DenseBitVectorCellFactory(String hexString)
'0'  '9'
and 'A'  'F'
are allowed. The character at string position
(length  1)
represents the bits with index 0 to 3 in the vector. The character at position 0
represents the bits with the highest indices. The length of the vector created is the length of the string times
4 (as each character represents four bits).hexString
 containing the hex value to initialize the vector withIllegalArgumentException
 if hexString
contains characters other then the hex characters
(i.e. 0  9, A  F
)public void set(long bitIndex)
public void set(long startIdx, long endIdx)
startIdx
 the index of the first bit to set to oneendIdx
 the index of the last bit to set to onepublic void set(long bitIdx, boolean value)
set
in interface BitVector
bitIdx
 the index of the bit to set or clearvalue
 if true, the specified bit will be set, otherwise it will be cleared.ArrayIndexOutOfBoundsException
 if the index is negative or larger than the size of the vectorpublic void clear(long bitIndex)
public DenseBitVectorCell createDataCell()
DataCell
from the currently stored bit vector.createDataCell
in interface BitVectorCellFactory<DenseBitVectorCell>
DataCell
containing the current value of the vectorpublic static DenseBitVectorCell and(BitVectorValue bv1, BitVectorValue bv2)
DenseBitVectorCell
s. All other
implementations need to access the bits through get/set methods which probably performs very poorly. SparseBitVectorCellFactory.and(BitVectorValue, BitVectorValue)
for ANDing sparse bit vector
cells.bv1
 the first operand to AND with the otherbv2
 the other operand to AND with the first onepublic static DenseBitVectorCell or(BitVectorValue bv1, BitVectorValue bv2)
DenseBitVectorCell
s. All other
implementations need to access the bits through get/set methods which probably performs very poorly. SparseBitVectorCellFactory.and(BitVectorValue, BitVectorValue)
for ORing sparse bit vector
cells.bv1
 the first operand to OR with the otherbv2
 the other operand to OR with the first onepublic static DenseBitVectorCell xor(BitVectorValue bv1, BitVectorValue bv2)
SparseBitVectorCell
s. All other
implementations need to access the bits through get/set methods which probably performs very poorly. SparseBitVectorCellFactory.and(BitVectorValue, BitVectorValue)
for XORing sparse bit vector
cells.bv1
 the first operand to XOR with the otherbv2
 the other operand to XOR with the first onepublic long length()
public boolean get(long bitIdx)
public long nextSetBit(long startIdx)
nextSetBit
in interface BitVector
startIdx
 the first index to look for '1's. (It is allowed to pass
an index larger then the vector's length.)public long nextClearBit(long startIdx)
nextClearBit
in interface BitVector
startIdx
 the first index to look for '0's.public long cardinality()
cardinality
in interface BitVector
public boolean isEmpty()
public String toHexString()
'0'

'9'
and 'A'
 'F'
). The
character at string position (length  1)
holds the lowest
bits (bit 0 to 3), the character at position 0 represents the bits with
the largest index in the vector. If the length of the vector is larger
than BitVectorValue.MAX_DISPLAY_BITS
, the result is truncated (and ends with ...).toHexString
in interface BitVector
public String toBinaryString()
(length  1)
holds the bit with index 0, the character at position 0 represents the bits with the
largest index in the vector. If the length of the vector is larger than BitVectorValue.MAX_DISPLAY_BITS
,
the result is truncated (and ends with ...).toBinaryString
in interface BitVector