private int costPatternWithoutWildCardChar(Stack<Node> stack) throws SemanticException {
    int numElems = (stack != null ? stack.size() : 0);

    // No elements
    if (numElems == 0) {
      return -1;
    }

    int patLen = patternWithoutWildCardChar.length();
    StringBuilder name = new StringBuilder(patLen + numElems);
    for (int pos = numElems - 1; pos >= 0; pos--) {
      String nodeName = stack.get(pos).getName() + "%";
      name.insert(0, nodeName);
      if (name.length() >= patLen) {
        if (patternWithoutWildCardChar.contentEquals(name)) {
          return patLen;
        }
        break;
      }
    }
    return -1;
  }
This function returns the cost of the rule for the specified stack when the pattern
matched for has no wildcard character in it. The function expects patternWithoutWildCardChar
to be not null.
@param stack
         Node stack encountered so far
@return cost of the function
@throws SemanticException
ql/src/java/org/apache/hadoop/hive/ql/lib/RuleRegExp.java