Package io.jenetics.ext.rewriting
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:
TreePattern.match(Tree)
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
int
hashCode()
String
toString()
Tree<V,?>
tree()
The node (tree), which has been matched by some pattern.Map<TreePattern.Var<V>,Tree<V,?>>
vars()
The variables involved while matching the treetree()
.
-
-
-
Method Detail
-
tree
public Tree<V,?> tree()
The node (tree), which has been matched by some pattern. This tree is the argument of theTreePattern.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 treetree()
.- Returns:
- variables involved while matching the tree
tree()
.
-
-