Class BitSetPlus

java.lang.Object
java.util.BitSet
org.pentaho.aggdes.util.BitSetPlus
All Implemented Interfaces:
Serializable, Cloneable

public class BitSetPlus extends BitSet
Extension to BitSet.
See Also:
  • Constructor Details

    • BitSetPlus

      public BitSetPlus()
    • BitSetPlus

      public BitSetPlus(int bitCount)
  • Method Details

    • getBitCount

      public int getBitCount()
    • supersetCardinality

      public BigInteger supersetCardinality()
      Returns the number of bitsets which are supersets of bitSet.

      For example, supersetCardinality(4, {0, 1, 1, 0}) is 4, because the supersets are {{0, 1, 1, 0}, {0, 1, 1, 1}, {1, 1, 1, 0}, {1, 1, 1, 1}}.

      The formula is 2 ^ number of zero bits.

      Returns:
      the number of bitsets which are supersets of bitSet (including the bitset itself and the full set).
    • countSupersetDiff

      public BigInteger countSupersetDiff(List<BitSetPlus> minusBitSets)
      Returns the number of bitsets which are supersets of this BitSetPlus but which are not supersets of any of the sets in minusBitSets.

      This method takes time and space exponential in the cardinality of minusBitSets.

      Parameters:
      minusBitSets - List of bit sets to subtract
      Returns:
      Cardinality
    • contains

      public boolean contains(BitSet bitSet)
      Returns true if every bit in this set is also set in bitSet.
    • countSupersetIntersectionOld

      public static BigInteger countSupersetIntersectionOld(int bitCount, BitSetPlus[] bitSets)
      Returns the number of sets which are supersets of at least one of the members of bitSets.

      Example 1. Consider bitset0 = {0, 1, 1, 0}, bitset1 = {1, 0, 1, 1}. The supersets look like {0 or 1, 0 or 1, 1, 0 or 1}.

      Parameters:
      bitCount - Number of bits in each bitset
      bitSets - List of bitsets
      Returns:
      Number of sets in superset
    • countSupersetIntersection

      public static BigInteger countSupersetIntersection(int bitCount, BitSetPlus[] bitSets)
      Returns the number of sets which are supersets of every member of bitSets.

      Example 1. Consider bitset0 = {0, 1, 1, 0}, bitset1 = {1, 0, 1, 1}. The supersets look like {0 or 1, 0 or 1, 1, 0 or 1}.

      Parameters:
      bitCount - Number of bits in each bitset
      bitSets - List of bitsets
      Returns:
      Number of sets in superset