Пример #1
0
  public static void collectAnd(Expr expr, ExprList list) {
    if (expr instanceof E_LogicalAnd) {
      E_LogicalAnd e = (E_LogicalAnd) expr;

      collectAnd(e.getArg1(), list);
      collectAnd(e.getArg2(), list);
    } else {
      list.add(expr);
    }
  }
Пример #2
0
  public static void collectOr(Expr expr, List<ExprList> list) {
    if (expr instanceof E_LogicalOr) {
      E_LogicalOr e = (E_LogicalOr) expr;

      collectOr(e.getArg1(), list);
      collectOr(e.getArg2(), list);
    } else if (expr instanceof E_LogicalAnd) {
      // List<Expr> ors = new ArrayList<Expr>();
      ExprList ors = new ExprList();
      collectAnd(expr, ors);

      list.add(ors);
    } else {
      list.add(new ExprList(expr));
    }
  }