Void for visitors that do not need to return results.
Void for visitors that do not need an
additional parameter.
Here is an example to count the number of identifier nodes in a tree:
class CountIdentifiers extends TreeScanner<Integer,Void> {
@Override
public Integer visitIdentifier(IdentifierTree node, Void p) {
return 1;
}
@Override
public Integer reduce(Integer r1, Integer r2) {
return (r1 == null ? 0 : r1) + (r2 == null ? 0 : r2);
}
}
Implementation Specification
The default implementation of the visitXYZ methods will determine a result as follows:
null.
scan with that child. The child may be a simple node
or itself a list of nodes.
scan with each child in turn, and then combining the
result of each scan after the first with the cumulative result
so far, as determined by the reduce method. Each child may be either
a simple node or a list of nodes. The default behavior of the reduce
method is such that the result of the visitXYZ method will be the result of
the last child scanned.
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public R | Returns: the result of combining the two parametersthe first of the values to be combined r1, R the second of the values to be combined r2)Reduces two results into a combined result. |
| public R | |
| public R | |
| private R | |
| private R | |
| public R | Returns: the result of scanningImplements com. Visits an |
| public R | Returns: the result of scanningImplements com. Visits an |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits an |
| public R | Returns: the result of scanningImplements com. Visits an |
| public R | Returns: the result of scanningImplements com. Visits an |
| public R | Returns: the result of scanningImplements com. Visits an |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits an |
| public R | Returns: the result of scanningImplements com. Visits an |
| public R | Returns: the result of scanningImplements com. Visits an |
| public R | Returns: the result of scanningImplements com. Visits an |
| public R | Returns: the result of scanningImplements com. Visits an |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits an |
| public R | Returns: the result of scanningImplements com. Visits an |
| public R | Returns: the result of scanningImplements com. Visits an |
| public R | Returns: the result of scanningImplements com. Visits an |
| public R | Returns: the result of scanningImplements com. Visits an |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits an |
| public R | Returns: the result of scanningImplements com. Visits an unknown type of |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |
| public R | Returns: the result of scanningImplements com. Visits a |