Ejemplo n.º 1
0
  /**
   * 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);
  }
Ejemplo n.º 2
0
  /**
   * 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);
  }