|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object fr.umlv.tatoo.runtime.ast.NodeVisitor<R,P,D,E>
R
- return type of the visitor methods.P
- parameter type of the visitor methods.D
- type of the data associated with the node hold by the visitor.E
- type of the exception throws by the visitor,
if no exception thrown, E could be typed using a RuntimeException.public abstract class NodeVisitor<R,P,D,E extends Throwable>
Abstract implementation of a visitor on the AST node.
This class provide a mechanism to access to the
data associated with a node.
The methods getData(Node)
and
setData(node,data)
get/set
the data of a specified node.
Constructor Summary | |
---|---|
protected |
NodeVisitor()
Creates a visitor with an hashmap to store data associated to each node. |
protected |
NodeVisitor(Map<Node,D> dataMap)
Creates a visitor that use the argument as map to store data associated with a node. |
Method Summary | |
---|---|
protected D |
getData(Node node)
Returns the data associated to a node. |
Map<Node,D> |
getDataMap()
Returns the map that contains the data for each node. |
protected D |
setData(Node node,
D data)
Set the data associated to a node and returns the old value. |
protected R |
visit(Node node,
P param)
Defined a visit method called by default if no visit method is overridden. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected NodeVisitor()
protected NodeVisitor(Map<Node,D> dataMap)
dataMap
- Method Detail |
---|
public Map<Node,D> getDataMap()
protected D getData(Node node)
node
- the node.
getDataMap()
protected D setData(Node node, D data)
node
- the node.data
- the new data associated with the node.
protected R visit(Node node, P param) throws E extends Throwable, UnsupportedOperationException
node
- param
-
E
- this exception is never thrown.
UnsupportedOperationException
- always
E extends Throwable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |