|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knime.core.data.DataCell
org.knime.core.data.vector.bitvector.DenseBitVectorCell
public class DenseBitVectorCell
Stores Zeros and Ones in a vector, i.e. with fixed positions. The vector has
a fixed length.
Implementation stores the bits in a collection of longs (64 bit words). Thus
it can be used for well populated vectors. Its length is restricted to (Integer.MAX_VALUE
-
1) * 64 (i.e. 137438953344, in which case it uses around 16GigaByte of
memory).
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.knime.core.data.vector.bitvector.BitVectorValue |
---|
BitVectorValue.BitVectorUtilityFactory |
Nested classes/interfaces inherited from interface org.knime.core.data.DataValue |
---|
DataValue.UtilityFactory |
Field Summary | |
---|---|
static DataType |
TYPE
Convenience access member for DataType.getType(DenseBitVectorCell.class) . |
Fields inherited from interface org.knime.core.data.vector.bitvector.BitVectorValue |
---|
UTILITY |
Constructor Summary | |
---|---|
DenseBitVectorCell(DenseBitVector bitVector)
Use the DenseBitVectorCellFactory to create instances of this
cell. |
Method Summary | |
---|---|
long |
cardinality()
Returns the number of set bits (bits with value '1') in the vector. |
protected boolean |
equalsDataCell(DataCell dc)
Derived classes implement their specific equals function here. |
boolean |
get(long index)
Returns the value of the specified bit. |
DenseBitVector |
getBitVectorCopy()
Returns a clone of the internal dense bit vector. |
static DataCellSerializer<DenseBitVectorCell> |
getCellSerializer()
Returns the factory to read/write DataCells of this class from/to a DataInput/DataOutput. |
static Class<? extends DataValue> |
getPreferredValueClass()
Returns the preferred value class of this cell implementation. |
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. |
Methods inherited from class org.knime.core.data.DataCell |
---|
equals, getType, isMissing |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final DataType TYPE
DataType.getType(DenseBitVectorCell.class)
.
DataType.getType(Class)
Constructor Detail |
---|
DenseBitVectorCell(DenseBitVector bitVector)
DenseBitVectorCellFactory
to create instances of this
cell.
bitVector
- the bit vector to store in this cell.Method Detail |
---|
public static final Class<? extends DataValue> getPreferredValueClass()
public static final DataCellSerializer<DenseBitVectorCell> getCellSerializer()
DataCell
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 to
true
if this is equal to the argument,
false
if notpublic int hashCode()
DataCell
objects return the same hash code.
hashCode
in class DataCell
DataCell
Object.hashCode()
,
DataCell.equals(java.lang.Object)
public String toString()
toString
in class DataCell
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 DenseBitVector getBitVectorCopy()
public long cardinality()
cardinality
in interface BitVectorValue
public boolean get(long index)
get
in interface BitVectorValue
index
- the index of the bit to test
public 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.)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |