private GenPredicGroup addPredicsToExisting(Rule rul, GenPredicGroup previousConds) {
   List<GenPredicGroup> list = new ArrayList<GenPredicGroup>();
   GenPredicGroup gpg = getGroupConditions(rul.getRootCondition().getConditions(), null);
   list.add(gpg);
   list.add(previousConds);
   GenPredicGroup newGroup = new GenPredicGroup();
   newGroup.setMyGroups(list);
   newGroup.setOperator(EOperator.ANY);
   return newGroup;
 }
  /**
   * recursive method to get all conditions from "condition tree"
   *
   * @param conds - at the beginning root conditions, at lower level conditions under
   *     CompoundCondition
   * @param op - at the beginning null, at lower level operator of Compound Condition
   * @return group of its subgroups and of conditions
   */
  private GenPredicGroup getGroupConditions(Conditions conds, GenPredicGroup.EOperator op) {
    GenPredicGroup myConds = new GenPredicGroup();
    myConds.setOperator((op != null) ? op : GenPredicGroup.EOperator.ALL);
    Iterator<Condition> it = conds.iterator();
    while (it.hasNext()) {
      Condition cond = it.next();
      // if true, a new condition group is created and filled
      if (cond instanceof CompoundCondition) {
        // set group operator
        GenPredicGroup.EOperator actualOp = null;
        if (cond instanceof ConditionAll) {
          actualOp = GenPredicGroup.EOperator.ALL;
        } else if (cond instanceof ConditionAny) {
          actualOp = GenPredicGroup.EOperator.ANY;
        } else if (cond instanceof ConditionNone) {
          actualOp = GenPredicGroup.EOperator.NONE;
        }

        if (myConds.getMyGroups() == null) {
          myConds.setMyGroups(new ArrayList<GenPredicGroup>());
        }
        // call recursively to get conditions of actual group
        myConds
            .getMyGroups()
            .add(getGroupConditions(((CompoundCondition) cond).getConditions(), actualOp));
      } else {
        // get condition
        if (myConds.getGeneratorPredicts() == null) {
          myConds.setGeneratorPredicts(new ArrayList<GeneratorPredicate>());
        }
        myConds.getGeneratorPredicts().add(getGP(cond));
      }
    }

    return myConds;
  }