/** * Function to check if the antecedent of our itemset is equal to another given * * @param a Itemset which antecedents we are going to compare with ours * @return boolean true = they are equal, false = they aren't. */ public boolean isEqualAnt(Itemset a) { int i; Item item; if (this.itemset.size() != a.size()) return (false); for (i = 0; i < this.itemset.size(); i++) { item = this.itemset.get(i); if (!item.isEqual(a.get(i))) return (false); } return (true); }
/** Clone function */ public Itemset clone() { Itemset d = new Itemset(this.clas); for (int i = 0; i < this.itemset.size(); i++) d.add((itemset.get(i)).clone()); d.clas = this.clas; d.support = this.support; d.supportRule = this.supportRule; d.per = this.per; d.hits = this.hits; d.misses = this.misses; return (d); }
/** * Function to check if our itemset is Subitemset (can be contained) of a given itemset * * @param a Itemset to check if can contain ours * @return boolean true = our itemset is subitemset of a, false = it isn't. */ public boolean isSubItemset(Itemset a) { int i, j; Item itemi, itemj; boolean stop; if (this.clas != a.getClas()) return (false); for (i = 0; i < this.itemset.size(); i++) { itemi = this.itemset.get(i); stop = false; for (j = 0; j < a.itemset.size() && !stop; j++) { itemj = a.itemset.get(j); if (itemi.isEqual(itemj)) stop = true; else if (itemj.getVariable() >= itemi.getVariable()) return (false); } if (!stop) return (false); } return (true); }