@Override
  public int cost(Stack<Node> stack) throws SemanticException {
    if (stack == null) {
      return -1;
    }
    if (nodeClass.isInstance(stack.peek())) {
      return 1;
    }
    return -1;
  }
Rule that matches a particular type of node.
ql/src/java/org/apache/hadoop/hive/ql/lib/TypeRule.java