public class SparseBitVectorCell extends DataCell implements BitVectorValue
DenseBitVector
is more suitable.Long.MAX_VALUE
(i.e.
9223372036854775807). The number of ones that can be stored is limited to
Integer.MAX_VALUE
(which is 2147483647), in which case it uses about
16Gbyte of memory.Modifier and Type | Class and Description |
---|---|
static class |
SparseBitVectorCell.Factory
Factory for
SparseBitVectorCell s. |
static class |
SparseBitVectorCell.SparseBitVectorSerializer
Factory for (de-)serializing a DenseBitVectorCell.
|
BitVectorValue.BitVectorUtilityFactory
DataValue.UtilityFactory
Modifier and Type | Field and Description |
---|---|
static DataType |
TYPE
Convenience access member for
DataType.getType(SparseBitVectorCell.class) . |
MAX_DISPLAY_BITS, UTILITY
Constructor and Description |
---|
SparseBitVectorCell(SparseBitVector bitVector)
Use the
SparseBitVectorCellFactory to create instances of this
cell. |
Modifier and Type | Method and Description |
---|---|
long |
cardinality()
Returns the number of set bits (bits with value '1') in the vector.
|
(package private) long |
cardinalityOfIntersection(SparseBitVectorCell bitVectorCell) |
(package private) long |
cardinalityOfRelativeComplement(SparseBitVectorCell bitVectorCell) |
protected boolean |
equalContent(DataValue otherValue)
This method is called when two cell of different classes but with the same preferred value are compared (e.g.
|
protected boolean |
equalsDataCell(DataCell dc)
Derived classes implement their specific equals function here.
|
boolean |
get(long index)
Returns the value of the specified bit.
|
SparseBitVector |
getBitVectorCopy()
Returns a clone of the internal dense bit vector.
|
static DataCellSerializer<SparseBitVectorCell> |
getCellSerializer()
Deprecated.
use
DataTypeRegistry.getSerializer(Class) instead |
int |
hashCode()
This method must be implemented in order to ensure that two equal
DataCell objects return the same hash code. |
boolean |
isEmpty()
Returns true, if all bits in the vector are cleared.
|
long |
length()
Returns the length of the bit 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.
|
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.
|
String |
toString()
Returns the String representation of this cell's value.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
equalContent
public static final DataType TYPE
DataType.getType(SparseBitVectorCell.class)
.DataType.getType(Class)
SparseBitVectorCell(SparseBitVector bitVector)
SparseBitVectorCellFactory
to create instances of this
cell.bitVector
- the bit vector to store in this cell.@Deprecated public static final DataCellSerializer<SparseBitVectorCell> getCellSerializer()
DataTypeRegistry.getSerializer(Class)
insteadDataCell
protected boolean equalsDataCell(DataCell dc)
null
or a missing value,
to be of the same class like this.equalsDataCell
in class DataCell
dc
- the cell to compare this totrue
if this is equal to the argument,
false
if notprotected boolean equalContent(DataValue otherValue)
false
.equalContent
in class DataCell
otherValue
- the other data valuetrue
if the content of both cells is the same, false
otherwisepublic int hashCode()
DataCell
objects return the same hash code. Note that two cells can be equal according to
DataCell.equalsDataCell(DataCell)
and DataCell.equalContent(DataValue)
so two different cells implementations
with the same preferred value must have the same hash code.hashCode
in class DataCell
DataCell
Object.hashCode()
,
DataCell.equals(java.lang.Object)
public String toString()
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 (Integer.MAX_VALUE
- 1) * 4 (i.e. 8589934584), the result
is truncated (and ends with ...).toHexString
in interface BitVectorValue
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 (Integer.MAX_VALUE
- 3)
(i.e. 2147483644), the result is truncated (and ends with ...).toBinaryString
in interface BitVectorValue
public SparseBitVector getBitVectorCopy()
public long cardinality()
cardinality
in interface BitVectorValue
public boolean get(long index)
get
in interface BitVectorValue
index
- the index of the bit to testpublic boolean isEmpty()
isEmpty
in interface BitVectorValue
public long length()
length
in interface BitVectorValue
public long nextClearBit(long startIdx)
nextClearBit
in interface BitVectorValue
startIdx
- the first index to look for '0's.public long nextSetBit(long startIdx)
nextSetBit
in interface BitVectorValue
startIdx
- the first index to look for '1's. (It is allowed to pass
an index larger then the vector's length.)long cardinalityOfIntersection(SparseBitVectorCell bitVectorCell)
bitVectorCell
- the other cell containing the operandBitVectorUtil.cardinalityOfIntersection(BitVectorValue, BitVectorValue)
long cardinalityOfRelativeComplement(SparseBitVectorCell bitVectorCell)
bitVectorCell
- the other cell containing the operandBitVectorUtil.cardinalityOfRelativeComplement(BitVectorValue, BitVectorValue)
KNIME GmbH, Konstanz, Germany
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.