org.jacorb.notification.filter.etcl

Class AbstractTCLNode

Implemented Interfaces:
TCLParserTokenTypes
Known Direct Subclasses:
AndOperator, ArrayOperator, AssocOperator, BoolValue, ComponentPositionOperator, DefaultOperator, DivOperator, DotOperator, EqOperator, ETCLComponentName, ExistOperator, GteOperator, GtOperator, IdentValue, ImplicitOperatorNode, InOperator, LteOperator, LtOperator, MinusOperator, MultOperator, NeqOperator, NotOperator, NumberValue, OrOperator, PlusOperator, PropertyShorthandNode, RuntimeVariableNode, StringValue, SubstrOperator, UnionPositionOperator

public abstract class AbstractTCLNode
extends BaseAST
implements TCLParserTokenTypes

Base Class for TCLTree Nodes.

Version:
$Id: AbstractTCLNode.java,v 1.4 2004/05/06 12:39:59 nicolas Exp $

Author:
Alphonse Bendt

Fields inherited from interface org.jacorb.notification.filter.etcl.TCLParserTokenTypes

AND, ARRAY, ASSOC, DEFAULT, DISCRIM, DIV, DOLLAR, DOT, EOF, EQ, EXIST, FALSE, FIRST, GT, GTE, IDENTIFIER, IMPLICIT, IN, LBRACKET, LENGTH, LPAREN, LT, LTE, MAX, MIN, MINUS, MULT, NEQ, NOT, NULL_TREE_LOOKAHEAD, NUMBER, NUM_FLOAT, OR, PLUS, RANDOM, RBRACKET, REPO_ID, RPAREN, RUNTIME_VAR, STRING, SUBSTR, TRUE, TYPE, TYPE_ID, UNARY_MINUS, UNARY_PLUS, UNION_POS, WITH, WS

Constructor Summary

AbstractTCLNode()
AbstractTCLNode(Token tok)

Method Summary

void
acceptInOrder(AbstractTCLVisitor visitor)
accept a visitor for traversal Inorder
void
acceptPostOrder(AbstractTCLVisitor visitor)
accept a visitor for traversal in Postorder.
void
acceptPreOrder(AbstractTCLVisitor visitor)
accept a visitor for traversal in Preorder.
EvaluationResult
evaluate(EvaluationContext context)
Evaluate this Node.
TCKind
getKind()
Return the Runtimetype of this node.
String
getName()
static String
getNameForType(int t)
converts an int tree token type to a name.
int
getNextType()
get the AST Token Type of this nodes sibling
int
getType()
Get the AST Token Type for this node.
boolean
hasNextSibling()
Check wether this node has a Sibling.
void
initialize(AST t)
satisfy abstract method from BaseAST.
void
initialize(Token tok)
satisfy abstract method from BaseAST.
void
initialize(int t, String txt)
satisfy abstract method from BaseAST.
boolean
isBoolean()
boolean
isNumber()
boolean
isStatic()
boolean
isString()
AbstractTCLNode
left()
Access the left child.
void
printToStringBuffer(StringBuffer buffer)
AbstractTCLNode
right()
Access the right child.
protected void
setKind(TCKind kind)
void
setType(int type)
Set AST Token Type for this node.
String
toStringTree()
create a visualization of this node and all its children.

Constructor Details

AbstractTCLNode

protected AbstractTCLNode()


AbstractTCLNode

public AbstractTCLNode(Token tok)

Method Details

acceptInOrder

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

Parameters:
visitor -


acceptPostOrder

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

Parameters:
visitor -


acceptPreOrder

public void acceptPreOrder(AbstractTCLVisitor visitor)
            throws VisitorException
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)
            throws EvaluationException
Evaluate this Node.

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

Returns:
an EvaluationResult value

Throws:
EvaluationException - these errors mostly occur 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


getKind

public TCKind getKind()
Return the Runtimetype of this node. If the Runtime type cannot be guessed statically this Method returns null.

Returns:
a TCKind value or null if the Runtimetype cannot be determined statically.


getName

public 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 stolen from http://www.codetransform.com/


getNextType

public int getNextType()
get the AST Token Type of this nodes sibling

Returns:
a AST Token Type


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 void initialize(AST t)
satisfy abstract method from BaseAST. Not used.


initialize

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


initialize

public void initialize(int t,
                       String txt)
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.


setKind

protected void setKind(TCKind kind)


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