Class TreeMatchResult<V>

java.lang.Object
io.jenetics.ext.rewriting.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:
  • Method Details

    • 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
    • vars

      public Map<TreePattern.Var<V>,Tree<V,?>> vars()
      The variables involved while matching the tree tree().
      Returns:
      variables involved while matching the tree tree().
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object