org.knime.core.data.vector.bitvector
Class BitVectorUtil

java.lang.Object
  extended by org.knime.core.data.vector.bitvector.BitVectorUtil

public final class BitVectorUtil
extends Object

A utility class providing methods to apply set operations like "AND", "OR", and "XOR" on different kind of BitVectorValues, such as SparseBitVectorCells or DenseBitVectorCells in a convenient way.

Author:
Kilian Thiel, University of Konstanz

Method Summary
static BitVectorValue and(BitVectorValue bv1, BitVectorValue bv2)
          Creates a sparse bit vector cell, in case that one or both given values are sparse bit vector cells (otherwise a dense bit vector cell).
static BitVectorValue or(BitVectorValue bv1, BitVectorValue bv2)
          Creates a sparse bit vector cell, in case that both given values are sparse bit vector cells (otherwise a dense bit vector cell).
static BitVectorValue xor(BitVectorValue bv1, BitVectorValue bv2)
          Creates a sparse bit vector cell, in case that both given values are sparse bit vector cells (otherwise a dense bit vector cell).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

and

public static BitVectorValue and(BitVectorValue bv1,
                                 BitVectorValue bv2)
Creates a sparse bit vector cell, in case that one or both given values are sparse bit vector cells (otherwise a dense bit vector cell). The returned cell contains the result of the AND operation on the passed operands. The length of the result vector is the maximum of the lengths of the operands.
NOTE: This method performs best if the two arguments are both SparseBitVectorCells or DenseBitVectorCells. All other implementations need to access the bits through get/set methods which probably performs very poorly.
To perform the AND operation the sparse implementation SparseBitVectorCellFactory.and(BitVectorValue, BitVectorValue), or the dense implementation DenseBitVectorCellFactory.and(BitVectorValue, BitVectorValue) is called.

Parameters:
bv1 - the first operand to AND with the other
bv2 - the other operand to AND with the first one
Returns:
the result of the AND operation

or

public static BitVectorValue or(BitVectorValue bv1,
                                BitVectorValue bv2)
Creates a sparse bit vector cell, in case that both given values are sparse bit vector cells (otherwise a dense bit vector cell). The returned cell contains the result of the OR operation on the passed operands. The length of the result vector is the maximum of the lengths of the operands.
NOTE: This method performs best if the two arguments are both SparseBitVectorCells or DenseBitVectorCells. All other implementations need to access the bits through get/set methods which probably performs very poorly.
To perform the OR operation the sparse implementation SparseBitVectorCellFactory.or(BitVectorValue, BitVectorValue), or the dense implementation DenseBitVectorCellFactory.or(BitVectorValue, BitVectorValue) is called.

Parameters:
bv1 - the first operand to OR with the other
bv2 - the other operand to OR with the first one
Returns:
the result of the OR operation

xor

public static BitVectorValue xor(BitVectorValue bv1,
                                 BitVectorValue bv2)
Creates a sparse bit vector cell, in case that both given values are sparse bit vector cells (otherwise a dense bit vector cell). The returned cell contains the result of the XOR operation on the passed operands. The length of the result vector is the maximum of the lengths of the operands.
NOTE: This method performs best if the two arguments are both SparseBitVectorCells or DenseBitVectorCells. All other implementations need to access the bits through get/set methods which probably performs very poorly.
To perform the XOR operation the sparse implementation SparseBitVectorCellFactory.xor(BitVectorValue, BitVectorValue), or the dense implementation DenseBitVectorCellFactory.xor(BitVectorValue, BitVectorValue) is called.

Parameters:
bv1 - the first operand to XOR with the other
bv2 - the other operand to XOR with the first one
Returns:
the result of the XOR operation


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
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.