org.jacorb.notification.filter.etcl

Class AbstractTCLNode

public abstract class AbstractTCLNode extends BaseAST implements TCLParserTokenTypes

Base Class for TCLTree Nodes.

Version: $Id: AbstractTCLNode.java,v 1.8 2005/08/21 13:22:57 alphonse.bendt Exp $

Author: Alphonse Bendt

Constructor Summary
AbstractTCLNode(Token tok)
protected AbstractTCLNode()
Method Summary
abstract voidacceptInOrder(AbstractTCLVisitor visitor)
accept a visitor for traversal Inorder
abstract voidacceptPostOrder(AbstractTCLVisitor visitor)
accept a visitor for traversal in Postorder. the right and left subtrees are visited before the root node is visited.
abstract voidacceptPreOrder(AbstractTCLVisitor visitor)
accept a visitor for traversal in Preorder. the root node is visited before the left and the right subtrees are visited.
EvaluationResultevaluate(EvaluationContext context)
Evaluate this Node.
StringgetName()
static StringgetNameForType(int t)
converts an int tree token type to a name.
intgetType()
Get the AST Token Type for this node.
booleanhasNextSibling()
Check wether this node has a Sibling.
voidinitialize(int t, String txt)
satisfy abstract method from BaseAST.
voidinitialize(AST t)
satisfy abstract method from BaseAST.
voidinitialize(Token tok)
satisfy abstract method from BaseAST.
booleanisBoolean()
booleanisNumber()
booleanisStatic()
booleanisString()
AbstractTCLNodeleft()
Access the left child.
voidprintToStringBuffer(StringBuffer buffer)
AbstractTCLNoderight()
Access the right child.
voidsetType(int type)
Set AST Token Type for this node.
StringtoStringTree()
create a visualization of this node and all its children.

Constructor Detail

AbstractTCLNode

public AbstractTCLNode(Token tok)

AbstractTCLNode

protected AbstractTCLNode()

Method Detail

acceptInOrder

public abstract void acceptInOrder(AbstractTCLVisitor visitor)
accept a visitor for traversal Inorder

Parameters: visitor

acceptPostOrder

public abstract void acceptPostOrder(AbstractTCLVisitor visitor)
accept a visitor for traversal in Postorder. the right and left subtrees are visited before the root node is visited.

Parameters: visitor

acceptPreOrder

public abstract void acceptPreOrder(AbstractTCLVisitor visitor)
accept a visitor for traversal in Preorder. the root node is visited before the left and the right subtrees are visited.

Parameters: visitor

evaluate

public EvaluationResult evaluate(EvaluationContext context)
Evaluate this Node.

Parameters: context an EvaluationContext value contains all context information necessary for the evaluation

Returns: an EvaluationResult value

Throws: EvaluationException occurs if e.g. an expression contains a reference to a non-existent struct member or if it is tried to add a string and a number

getName

public final String getName()

getNameForType

public static String getNameForType(int t)
converts an int tree token type to a name. Does this by reflecting on nsdidl.IDLTreeTokenTypes, and is dependent on how ANTLR 2.00 outputs that class. this snippet was taken from http://www.codetransform.com/

getType

public int getType()
Get the AST Token Type for this node.

Returns: the AST Token Type value

See Also: TCLParserTokenTypes

hasNextSibling

public boolean hasNextSibling()
Check wether this node has a Sibling.

Returns: true, if this node has a Sibling

initialize

public final void initialize(int t, String txt)
satisfy abstract method from BaseAST. Not used.

initialize

public final void initialize(AST t)
satisfy abstract method from BaseAST. Not used.

initialize

public final void initialize(Token tok)
satisfy abstract method from BaseAST. Not used.

isBoolean

public boolean isBoolean()

isNumber

public boolean isNumber()

isStatic

public boolean isStatic()

isString

public boolean isString()

left

public AbstractTCLNode left()
Access the left child. This method returns null if this node has no left child

Returns: the left Child or null.

printToStringBuffer

public void printToStringBuffer(StringBuffer buffer)

right

public AbstractTCLNode right()
Access the right child. This method returns null if this node has no right child

Returns: the right Child or null.

setType

public void setType(int type)
Set AST Token Type for this node.

Parameters: type must be a valid TCLTokenType.

See Also: TCLParserTokenTypes

toStringTree

public String toStringTree()
create a visualization of this node and all its children.

Returns: a String representation of this Node and all its children