/* * Combine two item sets of size k into an item set of size k+1 * The maximum k is set to 5 at the moment */ private void combineItemSet() { ArrayList<AttributeItemSet> tempItemSet = new ArrayList<AttributeItemSet>(); for (int k = 1; k < this.ITEMSET_SIZE; k++) { for (int i = 0; i < this._itemSet.size() - 1; i++) { for (int j = i + 1; j < this._itemSet.size(); j++) { if (this._itemSet.get(i).differentInLastAttribute(this._itemSet.get(j))) { AttributeItemSet tempAttrItemSet1 = (AttributeItemSet) this._itemSet.get(i).clone(); System.out.println(tempAttrItemSet1.toString()); AttributeItemSet tempAttrItemSet2 = (AttributeItemSet) this._itemSet.get(j).clone(); System.out.println(tempAttrItemSet2.toString()); tempAttrItemSet1.addCandidateItemSet( tempAttrItemSet2 .getCandidateItemSet() .get(tempAttrItemSet2.getCandidateItemSet().size() - 1)); tempAttrItemSet1.resetCoverage(); tempItemSet.add((AttributeItemSet) tempAttrItemSet1); } else { // do nothing when all the attributes are similar or when there // are more than one difference (not only the last) in the two sets ; } } } this.findFrequentItemSets(tempItemSet); this._itemSet = (ArrayList<AttributeItemSet>) tempItemSet.clone(); tempItemSet.clear(); } }