code: private double getPriorityOrScore(TemplateSubPatternAssociation matchPat)
    {
  
      double priority = matchPat.getTemplate().getPriority();
  
      if (priority == XPath.MATCH_SCORE_NONE)
      {
        Expression ex = matchPat.getStepPattern();
  
        if (ex instanceof NodeTest)
        {
          return ((NodeTest) ex).getDefaultScore();
        }
      }
  
      return priority;
    }
docs: Given a match pattern and template association, return the
  score of that match.  This score or priority can always be
  statically calculated.
  
  @param matchPat The match pattern to template association.
  
  @return {@link org.apache.xpath.patterns.NodeTest#SCORE_NODETEST},
  {@link org.apache.xpath.patterns.NodeTest#SCORE_NONE},
  {@link org.apache.xpath.patterns.NodeTest#SCORE_NSWILD},
  {@link org.apache.xpath.patterns.NodeTest#SCORE_QNAME}, or
  {@link org.apache.xpath.patterns.NodeTest#SCORE_OTHER}, or
  the value defined by the priority attribute of the template.