fr.umlv.tatoo.runtime.ast
Interface Node

All Known Subinterfaces:
Node.NoParent
All Known Implementing Classes:
CompositeNode, FlatNode

public interface Node

Represents the interface of all Abstract Syntax Tree. This generic Node represents a production of the grammar and has the following properties :

The node default implementations of Node, FlatNode and CompositeNode supports :

Author:
Remi

Nested Class Summary
static interface Node.NoParent
          A node type used as return type of the method getParent() to indicates that the node is a root node without parent.
static interface Node.NoValue
          An attribute value type used as return type of the method attributeList() and attributeMap() to indicates that the node has no attribute value.
 
Method Summary
<R,P,D,E extends Throwable>
R
accept(NodeVisitor<R,P,D,E> visitor, P param)
          call a visitor method depending of the real type of the current node.
 List<?> attributeList()
          A read-only list of all attribute values of the current node.
 Map<String,?> attributeMap()
          A read-only map containing couples of attribute name/attribute value.
 String getName()
          Returns the name of the current node.
 Node getParent()
          Returns the parent of the current node.
 List<? extends Node> nodeList()
          A read-only list of all sub nodes of the current node.
 

Method Detail

getName

String getName()
Returns the name of the current node.

Returns:
the name of the current node.

getParent

Node getParent()
Returns the parent of the current node.

Returns:
the parent of the current node or null if the node has no parent.

nodeList

List<? extends Node> nodeList()
A read-only list of all sub nodes of the current node. This list provides access in constant time to each of its element. Subclass methods are free to return a read/write list.

Returns:
a list of all sub nodes.

attributeList

List<?> attributeList()
A read-only list of all attribute values of the current node. This list is fixed size and provides access in constant time to each of its element. Subclass methods are free to return a read/write list.

Returns:
a list of attribute values.
See Also:
attributeMap()

attributeMap

Map<String,?> attributeMap()
A read-only map containing couples of attribute name/attribute value. This map is fixed size and access time could be a function of the number of attribute. Subclass methods are free to return a read/write map.

Returns:
a map of attribute name/value.

accept

<R,P,D,E extends Throwable> R accept(NodeVisitor<R,P,D,E> visitor,
                                     P param)
         throws E extends Throwable
call a visitor method depending of the real type of the current node.

Type Parameters:
R - type of the return value.
P - type of the argument.
D - type of the data attached to each node.
E - type of the exception possibly raised by a visit method.
Parameters:
visitor - visitor to call.
param - parameter send to the visitor.
Returns:
the return value of the selected visitor method.
Throws:
E - could propagate a generice exception raised by the visitor.
E extends Throwable