code: public static Rule getRule(final Stack stack) {
        if (stack.size() < 1) {
            throw new IllegalArgumentException(
                    "Invalid NOT rule - expected one rule but received "
                            + stack.size());
        }
        Object o1 = stack.pop();
        if (o1 instanceof Rule) {
          Rule p1 = (Rule) o1;
          return new NotRule(p1);
        }
        throw new IllegalArgumentException(
                "Invalid NOT rule: - expected rule but received " + o1);
    }
docs: Create new instance from top element of stack.
  @param stack stack
  @return new rule.