public abstract class Visitor
extends java.lang.Object
iterate(Pair) invokes dispatch() on each
element of the list and ignores any results.map(Pair) invokes dispatch() on each
element of the list while also collecting the results in a new
list.mapInPlace(Pair) invokes dispatch() on
each element of the list while also updating the list with the
results.Node provides helper methods to
dynamically test and cast lists of nodes through Node.isList(Object) and Node.toList(Object) respectively.| Constructor and Description |
|---|
Visitor()
Create a new visitor.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
dispatch(Node n)
Dispatch this visitor on the specified node.
|
boolean |
equals(java.lang.Object o)
Determine whether this visitor equals the specified object.
|
int |
hashCode()
Get a hashcode for this visitor.
|
void |
iterate(Pair<? extends Node> list)
Iterate this visitor over the specified list.
|
<T> Pair<T> |
map(Pair<? extends Node> list)
Map this visitor over the specified list.
|
<T extends Node> |
mapInPlace(Pair<T> list)
Map this visitor over the specified list while also updating the
list.
|
java.lang.Object |
unableToVisit(Node node)
Signal that this visitor has no
visit() method for
the specified node. |
java.lang.Object |
visit(Annotation a)
Visit the specified annotation.
|
public final int hashCode()
hashCode in class java.lang.Objectpublic final boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - The object to compare to.true if the specified object is this visitor.public java.lang.Object visit(Annotation a)
a - The annotation.public final java.lang.Object dispatch(Node n)
visit() method,
invokes it on the specified node, and returns the result. If the
specified node is null or the selected method
returns void, this method returns null.n - The node.VisitorException - Signals that no matching
visit() method could be found.VisitingException - Signals an exceptional condition while
applying the specified visitor on this node.unableToVisit(Node)public java.lang.Object unableToVisit(Node node)
visit() method for
the specified node. The default implementation simply raises a
visitor exception.node - The node.VisitorException - Signals that no matching
visit() method could be found.public void iterate(Pair<? extends Node> list)
list - The list.public <T> Pair<T> map(Pair<? extends Node> list)
list - The list.Copyright © 2014. All Rights Reserved.