public static Rule getRule(final Stack<Object> stack) {
    if (stack.size() < 2) {
      throw new IllegalArgumentException("Invalid NOT EQUALS rule - expected two parameters but received " + stack.size());
    }

    String p2 = stack.pop().toString();
    String p1 = stack.pop().toString();

    if (p1.equalsIgnoreCase(LoggingEventFieldResolver.LEVEL_FIELD)) {
      return NotLevelEqualsRule.getRule(p2);
    } else if (p1.equalsIgnoreCase(LoggingEventFieldResolver.MARK_FIELD)) {
      return MarkEqualsRule.getRule(p2);
    } else {
      return new NotEqualsRule(p1, p2);
    }
  }
Get new instance from top two elements of stack.

@param stack stack.
@return new instance.
olv-core/src/main/java/pl/otros/logview/accept/query/org/apache/log4j/rule/NotEqualsRule.java