org.jacorb.notification.filter.etcl
Class AbstractTCLNode

java.lang.Object
  extended byantlr.BaseAST
      extended byorg.jacorb.notification.filter.etcl.AbstractTCLNode
All Implemented Interfaces:
antlr.collections.AST, java.io.Serializable, TCLParserTokenTypes
Direct Known Subclasses:
ArrayOperator, AssocOperator, BoolValue, DotOperator, ETCLComponentName, ExistOperator, IdentValue, ImplicitOperatorNode, NumberValue, PropertyShorthandNode, RuntimeVariableNode, StringValue, org.jacorb.notification.filter.etcl.UnaryOperator, UnionPositionOperator

public abstract class AbstractTCLNode
extends antlr.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
See Also:
Serialized Form

Field Summary
 
Fields inherited from class antlr.BaseAST
down, right
 
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, NUM_FLOAT, NUMBER, 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
protected AbstractTCLNode()
           
  AbstractTCLNode(antlr.Token tok)
           
 
Method Summary
abstract  void acceptInOrder(AbstractTCLVisitor visitor)
          accept a visitor for traversal Inorder
abstract  void acceptPostOrder(AbstractTCLVisitor visitor)
          accept a visitor for traversal in Postorder.
abstract  void acceptPreOrder(AbstractTCLVisitor visitor)
          accept a visitor for traversal in Preorder.
 EvaluationResult evaluate(EvaluationContext context)
          Evaluate this Node.
 java.lang.String getName()
           
static java.lang.String getNameForType(int t)
          converts an int tree token type to a name.
 int getType()
          Get the AST Token Type for this node.
 boolean hasNextSibling()
          Check wether this node has a Sibling.
 void initialize(antlr.collections.AST t)
          satisfy abstract method from BaseAST.
 void initialize(int t, java.lang.String txt)
          satisfy abstract method from BaseAST.
 void initialize(antlr.Token tok)
          satisfy abstract method from BaseAST.
 boolean isBoolean()
           
 boolean isNumber()
           
 boolean isStatic()
           
 boolean isString()
           
 AbstractTCLNode left()
          Access the left child.
 void printToStringBuffer(java.lang.StringBuffer buffer)
           
 AbstractTCLNode right()
          Access the right child.
 void setType(int type)
          Set AST Token Type for this node.
 java.lang.String toStringTree()
          create a visualization of this node and all its children.
 
Methods inherited from class antlr.BaseAST
addChild, decode, encode, equals, equalsList, equalsListPartial, equalsTree, equalsTreePartial, findAll, findAllPartial, getColumn, getFirstChild, getLine, getNextSibling, getNumberOfChildren, getText, getTokenNames, removeChildren, setFirstChild, setNextSibling, setText, setVerboseStringConversion, toString, toStringList, xmlSerialize, xmlSerializeNode, xmlSerializeRootClose, xmlSerializeRootOpen
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractTCLNode

public AbstractTCLNode(antlr.Token tok)

AbstractTCLNode

protected AbstractTCLNode()
Method Detail

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 - 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

acceptInOrder

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

Parameters:
visitor -
Throws:
VisitorException

acceptPreOrder

public abstract 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 -
Throws:
VisitorException

acceptPostOrder

public abstract 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 -
Throws:
VisitorException

getName

public final java.lang.String getName()

hasNextSibling

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

Returns:
true, if this node has a Sibling

printToStringBuffer

public void printToStringBuffer(java.lang.StringBuffer buffer)

toStringTree

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

Specified by:
toStringTree in interface antlr.collections.AST
Returns:
a String representation of this Node and all its children

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.

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.

isStatic

public boolean isStatic()

isNumber

public boolean isNumber()

isString

public boolean isString()

isBoolean

public boolean isBoolean()

getType

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

Specified by:
getType in interface antlr.collections.AST
Returns:
the AST Token Type value
See Also:
TCLParserTokenTypes

setType

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

Specified by:
setType in interface antlr.collections.AST
Parameters:
type - must be a valid TCLTokenType.
See Also:
TCLParserTokenTypes

getNameForType

public static java.lang.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/


initialize

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

Specified by:
initialize in interface antlr.collections.AST

initialize

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

Specified by:
initialize in interface antlr.collections.AST

initialize

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

Specified by:
initialize in interface antlr.collections.AST