com.unitesk.atp.tree
Interface Node

All Superinterfaces:
Keyed
All Known Implementing Classes:
TreeClass.NodeClass

public interface Node
extends Keyed

A node of an attributed tree (AT). Each node except root node has parent node. Accessor can be used to work with node attributes. Child of node is an attribute's value or an element of an indexed attribute that implement this interface and have this node as parent.

Implementations of this interface should provide read-only attribute "this" whose value is object itself.

Version:
$Id: Node.java,v 1.9 2005/09/07 14:40:56 all-x Exp $
Author:
Alexey Demakov

Method Summary
 void accept(Visitor visitor)
          Accepts the specified visitor.
 Node getParent()
          Gets the parent of this node.
 void makeChild(String name)
          Makes a value of the specified attribute a child of this node.
 void resetParent()
          Reset parent of this node.
 void setParent(Node parent)
          Sets the parent of this node.
 
Methods inherited from interface com.unitesk.atp.tree.Keyed
key, keyClass
 

Method Detail

getParent

Node getParent()
Gets the parent of this node.

Returns:
The parent of this node. Can be null only for root node.

setParent

void setParent(Node parent)
Sets the parent of this node.

Parameters:
parent - The node to become parent of this node.
Throws:
NullPointerException - If parent is null.
IllegalArgumentException - If parent was already set.
See Also:
resetParent()

resetParent

void resetParent()
Reset parent of this node.

Since:
3.6
See Also:
setParent(Node)

makeChild

void makeChild(String name)
Makes a value of the specified attribute a child of this node. If this attribute is indexed makes each element of its value a child of this node. null an attribute value or an element are allowed.

Parameters:
name - The name of an attribute of this node.
Throws:
IllegalArgumentException - If the specified name is not a name of an attribute of this node.
ClassCastException - If a value of an attribute or an element of indexed attribute does not implement Node interface.

accept

void accept(Visitor visitor)
Accepts the specified visitor. This is an implementation of Visitor design pattern. Each inherited node type NodeType must override this method to call void visitNodeType( NodeType node ) visitor's method.

Parameters:
visitor - The visitor to accept.


Copyright © 2001-2006 ISP RAS, RedVerst Group. All Rights Reserved.