check whether the hierarchy of current node match the matchList
195777
private boolean checkMatch() {
        if (matchList == null) {
            return true;
        }
        final int matchSize = matchList.size();
        final int ancestorSize = topicIdList.size();
        final List<String> tail = topicIdList.subList(ancestorSize - matchSize, ancestorSize);
        return matchList.equals(tail);
    }
386585
def _first_step_to_match(match_step):
    """"""
    parts = []

    if match_step.root_block is not None:
        if not isinstance(match_step.root_block, QueryRoot):
            raise AssertionError(u'Expected None or QueryRoot root block, received: '
                                 u'{} {}'.format(match_step.root_block, match_step))

        match_step.root_block.validate()

        start_class = get_only_element_from_collection(match_step.root_block.start_class)
        parts.append(u'class: %s' % (start_class,))

    # MATCH steps with a QueryRoot root block shouldn't have a 'coerce_type_block'.
    if match_step.coerce_type_block is not None:
        raise AssertionError(u'Invalid MATCH step: {}'.format(match_step))

    if match_step.where_block:
        match_step.where_block.validate()
        parts.append(u'where: (%s)' % (match_step.where_block.predicate.to_match(),))

    if match_step.as_block is None:
        raise AssertionError(u'Found a MATCH step without a corresponding Location. '
                             u'This should never happen: {}'.format(match_step))
    else:
        match_step.as_block.validate()
        parts.append(u'as: %s' % (_get_vertex_location_name(match_step.as_block.location),))

    return u'{{ %s }}' % (u', '.join(parts),)
79126
public static boolean nodeMatchesStep(Step s,
				  String uri,
				  String localName,
				  String qName,
				  Attributes a) {
	// if the name doesn't match, then we've got a loser
	if (!s.isMatchingName(uri, localName))
	    return false;

	// it's still in the game; check the predicates
	List l = s.getPredicates();
	for (int i = 0; l != null && i < l.size(); i++) {
	    Predicate p = (Predicate) l.get(i);
	    if (!(p instanceof AttributePredicate))
		throw new UnsupportedOperationException
		    ("only attribute predicates are supported by filter");
	    if (!((AttributePredicate) p).isMatchingAttribute(a))
		return false;		// all predicates must match
	}

	// it's survived
	return true;
    }
159324
def get_matches(self, text, cache=None, conflict_resolver=resolve_using_maximal_coverage):
        """"""
        is_root_node = False
        if cache is None:
            cache = {}
            is_root_node = True
        if id(self) in cache:
            return cache[id(self)]
        matches = self.get_matches_without_cache(text, cache=cache)
        cache[id(self)] = matches

        # if this is the root node, resolve the matches
        if is_root_node and conflict_resolver is not None:
            return conflict_resolver(matches)
        return matches
217683
function matches(node, query) {
  return (node.matches =
    node.matchesSelector ||
    node.mozMatchesSelector ||
    node.msMatchesSelector ||
    node.oMatchesSelector ||
    node.webkitMatchesSelector ||
    function(s) {
      const matches = (this.document || this.ownerDocument).querySelectorAll(s);
      let i = matches.length;
      while (--i >= 0 && matches.item(i) !== this) {}
      return i > -1;
    }).call(node, query);
}
633580
def match?(str, parser=nil)
      node = self.class.parse(str.to_s, parser) rescue (return false)
      self == node
    end
1091875
def check_list(self, node_list, pattern_list):
        
        if len(node_list) != len(pattern_list):
            return False
        else:
            return all(Check(node_elt,
                             self.placeholders).visit(pattern_list[i])
                       for i, node_elt in enumerate(node_list))
1182084
def find(self, node, list):
        
        if self.matcher.match(node):
            list.append(node)
            self.limit -= 1
            if self.limit == 0:
                return
        for c in node.rawchildren:
            self.find(c, list)
        return self
370630
def is_ancestor(self, node):
        
        if self.level <= node.level or self.key[:len(node.key)] != node.key:
            return None
        return self.level - node.level
1240839
def find_best_matching_node(self, new, old_nodes):
        
        name = new.__class__.__name__
        #: TODO: We should pick the BEST one from this list
        #: based on some "matching" criteria (such as matching ref name or params)
        matches = [c for c in old_nodes if name == c.__class__.__name__]
        if self.debug:
            print("Found matches for {}: {} ".format(new, matches))
        return matches[0] if matches else None
390442
private int getMatchingLevelForNodes(Node n1, Node n2) {
    int count = 0;
    do {
      if (n1.equals(n2)) {
        return count;
      }
      ++count;
      n1 = n1.getParent();
      n2 = n2.getParent();
    } while (n1 != null && n2 != null);
    return this.maxLevel;
  }
862693
private boolean matchLemmaList(AnalyzedTokenReadings aToken,
      List<String> list) {
    boolean matches = false;
    for (AnalyzedToken analyzedToken : aToken) {
      if (list.contains(analyzedToken.getLemma())) {
          matches = true;
          break;
      }
    }
    return matches;
  }
1143543
def subtree(self, matcher, create = False):
        '''
        
        '''
        if matcher is None:
            return self
        current = self
        for i in range(self.depth, len(matcher.indices)):
            ind = matcher.indices[i]
            if ind is None:
                # match Any
                if hasattr(current, 'any'):
                    current = current.any
                else:
                    if create:
                        cany = MatchTree(current)
                        cany.parentIndex = None
                        current.any = cany
                        current = cany
                    else:
                        return None
            else:
                current2 = current.index.get(ind)
                if current2 is None:
                    if create:
                        cind = MatchTree(current)
                        cind.parentIndex = ind 
                        current.index[ind] = cind
                        current = cind
                    else:
                        return None
                else:
                    current = current2
        return current
895623
def _matches_node_set_props(type_info, node_set_props):
    
    matches = None
    for key in node_set_props:
        ns_val = node_set_props[key]
        if key in type_info:
            if ns_val==type_info[key]:
                if matches:
                    matches = matches and True
                else:
                    matches = True
            else:
                matches = False
    return matches
145798
private Long tokenMatch(SNode tok) {
		// check if the span is a matched node
		SFeature featMatched = tok.getFeature(ANNIS_NS, FEAT_MATCHEDNODE);
		Long matchRaw = featMatched == null ? null : featMatched.getValue_SNUMERIC();
		return matchRaw;
	}
730416
function matchDescendant(nodes, predicate) {
  return uniqueReduce(
    (matches, node) => matches.concat(treeFilter(node, predicate)),
    flat(nodes.map(childrenOfNode)),
  );
}
124865
def check_node(node)
      checkers = @checks[node.sexp_type]
      if checkers
        checkers.each { |checker| checker.node_start(node) if checker.parse_file?(node.file) }
      end
      node.children.each { |child_node|
        child_node.file = node.file
        check_node(child_node)
      }
      if checkers
        checkers.each { |checker| checker.node_end(node) if checker.parse_file?(node.file) }
      end
    end