org.exolab.castor.jdo.oql
Class ParseTreeNode
java.lang.Object
org.exolab.castor.jdo.oql.ParseTreeNode
public final class ParseTreeNode
extends java.lang.Object
A Node in the Parse tree which is generated by the
Parser
as the tree
representation of the OQL Query. Each node has a link back to the parent node
(null for the root node), and a vector of children. Each node contains the
Token
which represents that part of the tree.
$Revision: 5951 $ $Date: 2006-04-25 15:08:23 -0600 (Tue, 25 Apr 2006) $
ParseTreeNode
public ParseTreeNode(ParseTreeNode parent,
Token token)
Creates a new Node with supplied parent and token.
parent
- The parent of this node (null for root)token
- The token data in this node
ParseTreeNode
public ParseTreeNode(Token token)
Creates a new root Node with supplied token.
token
- The token data in this node
addChild
public void addChild(ParseTreeNode child)
Adds a new node as a child of this node. Changes the nodes parent to
this.
children
public Iterator children()
Accessor method for an iteration of this nodes children.
getChild
public ParseTreeNode getChild(int index)
Accessor method for individual children of this node.
index
- the index of the child to retrieve.
- the index child of this node.
getChildCount
public int getChildCount()
Accessor method for the number of children of this node.
- the number of children of this node.
getParent
public ParseTreeNode getParent()
Accessor method for the parent of this node.
getToken
public Token getToken()
Accessor method for the token.
- The token which is the datum of this node.
isLeaf
public boolean isLeaf()
Specifies whether this node is a leaf.
- True if the node does not have any children, otherwise false.
isRoot
public boolean isRoot()
Specifies whether this node is the root of a tree.
- True if the node does not have a parent, otherwise false.
setParent
public void setParent(ParseTreeNode parent)
Changes the parent of this node.
toString
public String toString()
toStringEx
public String toStringEx()
Intalio Inc. (C) 1999-2006. All rights reserved http://www.intalio.com