/** * Determine whether or not a parse tree matches this tree pattern. * * @param tree The parse tree to match against this tree pattern. * @return {@code true} if {@code tree} is a match for the current tree * pattern; otherwise, {@code false}. */ public boolean matches(ParseTree tree) { return matcher.match(tree, this).succeeded(); }
/** * {@inheritDoc} */ @Override public String toString() { return String.format( "Match %s; found %d labels", succeeded() ? "succeeded" : "failed", getLabels().size()); } }
/** * Find all nodes using XPath and then try to match those subtrees against * this tree pattern. * * @param tree The {@link ParseTree} to match against this pattern. * @param xpath An expression matching the nodes * * @return A collection of {@link ParseTreeMatch} objects describing the * successful matches. Unsuccessful matches are omitted from the result, * regardless of the reason for the failure. */ public List<ParseTreeMatch> findAll(ParseTree tree, String xpath) { Collection<ParseTree> subtrees = XPath.findAll(tree, xpath, matcher.getParser()); List<ParseTreeMatch> matches = new ArrayList<ParseTreeMatch>(); for (ParseTree t : subtrees) { ParseTreeMatch match = match(t); if ( match.succeeded() ) { matches.add(match); } } return matches; }
/** * Determine whether or not a parse tree matches this tree pattern. * * @param tree The parse tree to match against this tree pattern. * @return {@code true} if {@code tree} is a match for the current tree * pattern; otherwise, {@code false}. */ public boolean matches(ParseTree tree) { return matcher.match(tree, this).succeeded(); }
/** * Determine whether or not a parse tree matches this tree pattern. * * @param tree The parse tree to match against this tree pattern. * @return {@code true} if {@code tree} is a match for the current tree * pattern; otherwise, {@code false}. */ public boolean matches(ParseTree tree) { return matcher.match(tree, this).succeeded(); }
/** * Determine whether or not a parse tree matches this tree pattern. * * @param tree The parse tree to match against this tree pattern. * @return {@code true} if {@code tree} is a match for the current tree * pattern; otherwise, {@code false}. */ public boolean matches(ParseTree tree) { return matcher.match(tree, this).succeeded(); }
/** * {@inheritDoc} */ @Override public String toString() { return String.format( "Match %s; found %d labels", succeeded() ? "succeeded" : "failed", getLabels().size()); } }
/** * {@inheritDoc} */ @Override public String toString() { return String.format( "Match %s; found %d labels", succeeded() ? "succeeded" : "failed", getLabels().size()); } }
/** * {@inheritDoc} */ @Override public String toString() { return String.format( "Match %s; found %d labels", succeeded() ? "succeeded" : "failed", getLabels().size()); } }
/** * {@inheritDoc} */ @Override public String toString() { return String.format( "Match %s; found %d labels", succeeded() ? "succeeded" : "failed", getLabels().size()); } }
/** * Determine whether or not a parse tree matches this tree pattern. * * @param tree The parse tree to match against this tree pattern. * @return {@code true} if {@code tree} is a match for the current tree * pattern; otherwise, {@code false}. */ public boolean matches(@NotNull ParseTree tree) { return matcher.match(tree, this).succeeded(); }
/** * Find all nodes using XPath and then try to match those subtrees against * this tree pattern. * * @param tree The {@link ParseTree} to match against this pattern. * @param xpath An expression matching the nodes * * @return A collection of {@link ParseTreeMatch} objects describing the * successful matches. Unsuccessful matches are omitted from the result, * regardless of the reason for the failure. */ public List<ParseTreeMatch> findAll(ParseTree tree, String xpath) { Collection<ParseTree> subtrees = XPath.findAll(tree, xpath, matcher.getParser()); List<ParseTreeMatch> matches = new ArrayList<ParseTreeMatch>(); for (ParseTree t : subtrees) { ParseTreeMatch match = match(t); if ( match.succeeded() ) { matches.add(match); } } return matches; }
/** * Find all nodes using XPath and then try to match those subtrees against * this tree pattern. * * @param tree The {@link ParseTree} to match against this pattern. * @param xpath An expression matching the nodes * * @return A collection of {@link ParseTreeMatch} objects describing the * successful matches. Unsuccessful matches are omitted from the result, * regardless of the reason for the failure. */ public List<ParseTreeMatch> findAll(ParseTree tree, String xpath) { Collection<ParseTree> subtrees = XPath.findAll(tree, xpath, matcher.getParser()); List<ParseTreeMatch> matches = new ArrayList<ParseTreeMatch>(); for (ParseTree t : subtrees) { ParseTreeMatch match = match(t); if ( match.succeeded() ) { matches.add(match); } } return matches; }
/** * Find all nodes using XPath and then try to match those subtrees against * this tree pattern. * * @param tree The {@link ParseTree} to match against this pattern. * @param xpath An expression matching the nodes * * @return A collection of {@link ParseTreeMatch} objects describing the * successful matches. Unsuccessful matches are omitted from the result, * regardless of the reason for the failure. */ public List<ParseTreeMatch> findAll(ParseTree tree, String xpath) { Collection<ParseTree> subtrees = XPath.findAll(tree, xpath, matcher.getParser()); List<ParseTreeMatch> matches = new ArrayList<ParseTreeMatch>(); for (ParseTree t : subtrees) { ParseTreeMatch match = match(t); if ( match.succeeded() ) { matches.add(match); } } return matches; }
/** * Find all nodes using XPath and then try to match those subtrees against * this tree pattern. * * @param tree The {@link ParseTree} to match against this pattern. * @param xpath An expression matching the nodes * * @return A collection of {@link ParseTreeMatch} objects describing the * successful matches. Unsuccessful matches are omitted from the result, * regardless of the reason for the failure. */ @NotNull public List<ParseTreeMatch> findAll(@NotNull ParseTree tree, @NotNull String xpath) { Collection<ParseTree> subtrees = XPath.findAll(tree, xpath, matcher.getParser()); List<ParseTreeMatch> matches = new ArrayList<ParseTreeMatch>(); for (ParseTree t : subtrees) { ParseTreeMatch match = match(t); if ( match.succeeded() ) { matches.add(match); } } return matches; }