Class TreeMatchResult<V>


  • public final class TreeMatchResult<V>
    extends Object
    The result of a tree match operation. It contains the matching tree and the tree variables which matches the matching tree.
    final Tree<String, ?> tree = ...; final TreePattern<String> pattern = ...; final Optional<TreeMatchResult<String>> result = pattern.match(tree); result.ifPresent(r -> {assert r.tree() == tree;});
    Since:
    5.0
    Version:
    5.0
    See Also:
    TreePattern.match(Tree)
    • Method Detail

      • tree

        public Tree<V,​?> tree()
        The node (tree), which has been matched by some pattern. This tree is the argument of the TreePattern.match(Tree) call, in the case of a match.
        final Tree<String, ?> tree = ...; final TreePattern<String> pattern = ...; final Optional<TreeMatchResult<String>> result = pattern.match(tree); result.ifPresent(r -> {assert r.tree() == tree;});
        Returns:
        node (tree), which has been matched by some pattern