public static Rule getRule(final Stack<Object> stack) {
    if (stack.size() < 2) {
      throw new IllegalArgumentException("Invalid AND rule - expected two rules but received " + stack.size());
    }
    Object o2 = stack.pop();
    Object o1 = stack.pop();
    if ((o2 instanceof Rule) && (o1 instanceof Rule)) {
      Rule p2 = (Rule) o2;
      Rule p1 = (Rule) o1;
      return new AndRule(p1, p2);
    }
    throw new IllegalArgumentException("Invalid AND rule: " + o2 + "..." + o1);
  }
Create rule from top two elements of stack.

@param stack stack of rules.
@return Rule that evaluates true only if both rules are true.
olv-core/src/main/java/pl/otros/logview/accept/query/org/apache/log4j/rule/AndRule.java