Package org.pentaho.aggdes.util
Class BitSetPlus
java.lang.Object
java.util.BitSet
org.pentaho.aggdes.util.BitSetPlus
- All Implemented Interfaces:
Serializable
,Cloneable
Extension to
BitSet
.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns true if every bit in this set is also set inbitSet
.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 inminusBitSets
.static BigInteger
countSupersetIntersection
(int bitCount, BitSetPlus[] bitSets) Returns the number of sets which are supersets of every member ofbitSets
.static BigInteger
countSupersetIntersectionOld
(int bitCount, BitSetPlus[] bitSets) Returns the number of sets which are supersets of at least one of the members ofbitSets
.int
Returns the number of bitsets which are supersets ofbitSet
.Methods inherited from class java.util.BitSet
and, andNot, cardinality, clear, clear, clear, clone, equals, flip, flip, get, get, hashCode, intersects, isEmpty, length, nextClearBit, nextSetBit, or, previousClearBit, previousSetBit, set, set, set, set, size, stream, toByteArray, toLongArray, toString, valueOf, valueOf, valueOf, valueOf, xor
-
Constructor Details
-
BitSetPlus
public BitSetPlus() -
BitSetPlus
public BitSetPlus(int bitCount)
-
-
Method Details
-
getBitCount
public int getBitCount() -
supersetCardinality
Returns the number of bitsets which are supersets ofbitSet
.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
Returns the number of bitsets which are supersets of this BitSetPlus but which are not supersets of any of the sets inminusBitSets
.This method takes time and space exponential in the cardinality of
minusBitSets
.- Parameters:
minusBitSets
- List of bit sets to subtract- Returns:
- Cardinality
-
contains
Returns true if every bit in this set is also set inbitSet
. -
countSupersetIntersectionOld
Returns the number of sets which are supersets of at least one of the members ofbitSets
.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 bitsetbitSets
- List of bitsets- Returns:
- Number of sets in superset
-
countSupersetIntersection
Returns the number of sets which are supersets of every member ofbitSets
.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 bitsetbitSets
- List of bitsets- Returns:
- Number of sets in superset
-