/** * Perform the intersection of two diffsets for itemsets containing more than one item. * * @param tidsetI the first diffset * @param tidsetJ the second diffset * @return the resulting diffset and its support */ BitSetSupport performAND(BitSetSupport tidsetI, BitSetSupport tidsetJ) { // Create the new diffset BitSetSupport bitsetSupportIJ = new BitSetSupport(); // Calculate the diffset bitsetSupportIJ.bitset = (BitSet) tidsetJ.bitset.clone(); bitsetSupportIJ.bitset.andNot(tidsetI.bitset); // Calculate the support bitsetSupportIJ.support = tidsetI.support - bitsetSupportIJ.bitset.cardinality(); // return the new diffset return bitsetSupportIJ; }
/** * Perform the intersection of two diffsets representing single items. * * @param tidsetI the first diffset * @param tidsetJ the second diffset * @param supportIJ the support of the intersection (already known) so it does not need to be * calculated again * @return the resulting diffset and its support */ BitSetSupport performANDFirstTime(BitSetSupport tidsetI, BitSetSupport tidsetJ, int supportIJ) { // Create the new diffset and perform the logical AND to intersect the diffsets BitSetSupport bitsetSupportIJ = new BitSetSupport(); // Calculate the diffset bitsetSupportIJ.bitset = (BitSet) tidsetJ.bitset.clone(); bitsetSupportIJ.bitset.andNot(tidsetI.bitset); // Calculate the support bitsetSupportIJ.support = tidsetI.support - bitsetSupportIJ.bitset.cardinality(); // return the new tidset return bitsetSupportIJ; }