org.objectweb.fractal.adl

Interface Node

Known Implementing Classes:
AbstractNode, XMLNode

public interface Node

An Abstract Syntax Tree (AST) node. Each node has a type (which can be though of as the tag of an XML element), and can have attributes as well as sub nodes (which can be though of as XML attributes and XML sub elements).

Method Summary

void
astAddNode(Node node)
Adds a sub node to this node.
Map
astGetAttributes()
Returns the attributes of this node.
Object
astGetDecoration(String name)
Returns a decoration of this node.
Map
astGetDecorations()
Returns the decorations of this node.
String[]
astGetNodeTypes()
Returns the types of the sub nodes that this node can have.
Node[]
astGetNodes(String type)
Returns the sub nodes of this node that are of the given type.
String
astGetSource()
Returns the source of this node.
String
astGetType()
Returns the type of this node.
Node
astNewInstance()
Creates a new, empty AST node of the same type as this node.
void
astRemoveNode(Node node)
Removes a sub node from this node.
void
astSetAttributes(Map attributes)
Sets the attributes of this node.
void
astSetDecoration(String name, Object decoration)
Sets a decoration of this node.
void
astSetDecorations(Map decorations)
Sets the decorations of this node.
void
astSetSource(String source)
Sets the source of this node.

Method Details

astAddNode

public void astAddNode(Node node)
Adds a sub node to this node.

Parameters:
node - the sub node to be added to this node.


astGetAttributes

public Map astGetAttributes()
Returns the attributes of this node.

Returns:
the attributes of this node.


astGetDecoration

public Object astGetDecoration(String name)
Returns a decoration of this node.

Parameters:
name - the decoration's name.

Returns:
a decoration of this node. May be null if this node does not have a decoration with the specified name.


astGetDecorations

public Map astGetDecorations()
Returns the decorations of this node.

Returns:
the decorations of this node.


astGetNodeTypes

public String[] astGetNodeTypes()
Returns the types of the sub nodes that this node can have.

Returns:
the types of the sub nodes that this node can have.


astGetNodes

public Node[] astGetNodes(String type)
Returns the sub nodes of this node that are of the given type.

Parameters:
type - a node type.

Returns:
the sub nodes of this node that are of the given type.


astGetSource

public String astGetSource()
Returns the source of this node.

Returns:
the source of this node (such as a file name).


astGetType

public String astGetType()
Returns the type of this node.

Returns:
the type of this node.


astNewInstance

public Node astNewInstance()
Creates a new, empty AST node of the same type as this node.

Returns:
a new, empty AST node of the same type as this node.


astRemoveNode

public void astRemoveNode(Node node)
Removes a sub node from this node.

Parameters:
node - the sub node to be removed from this node.


astSetAttributes

public void astSetAttributes(Map attributes)
Sets the attributes of this node.

Parameters:
attributes - the attributes of this node that must be changed (attributes that are not defined in this argument are left unchanged).


astSetDecoration

public void astSetDecoration(String name,
                             Object decoration)
Sets a decoration of this node.

Parameters:
name - the decoration's name.
decoration - a decoration.


astSetDecorations

public void astSetDecorations(Map decorations)
Sets the decorations of this node.

Parameters:
decorations - the decorations of this node that must be changed (decorations that are not defined in this argument are left unchanged).


astSetSource

public void astSetSource(String source)
Sets the source of this node.

Parameters:
source - the source of this node (such as a file name).