agg.attribute.parser.javaExpr
Class SimpleNode

java.lang.Object
  extended by agg.attribute.parser.javaExpr.SimpleNode
All Implemented Interfaces:
Node, java.io.Serializable
Direct Known Subclasses:
ASTAddNode, ASTAllocationExpression, ASTArrayAllocation, ASTArrayIndex, ASTCharConstNode, ASTClassName, ASTCondExpr, ASTEmptyDimension, ASTExpression, ASTFloatConstNode, ASTId, ASTIntConstNode, ASTMemberName, ASTModNode, ASTNullLiteral, ASTPrimaryExpression, ASTStringConstNode, BoolNode, BOOLtoBOOLnode, BOOLxBOOLtoBOOLnode, MemberNode, NUMtoNUMnode, NUMxNUMtoBOOLnode, NUMxNUMtoNUMnode, ObjectConstNode, TYPE1xTYPE1toBOOL

public class SimpleNode
extends java.lang.Object
implements Node

See Also:
Serialized Form

Field Summary
protected  java.util.Vector<Node> children
           
protected static ClassResolver classResolver
           
protected  java.lang.String identifier
           
protected  java.lang.Object info
           
protected static boolean neverCalled
          Initialization flag
protected static java.util.Hashtable<java.lang.Class<?>,java.lang.Integer> numberTypes
          Widening order for numeric types
protected static java.lang.Class<?> objectClass
          Object class handle for frequent comparison
protected  Node parent
           
protected static java.lang.Object[] stack
          Stack for calculations.
protected static java.lang.Class<?> stringClass
          String class handle for frequent comparison
protected static SymbolTable symtab
          Symbol table
protected static int top
           
 
Constructor Summary
SimpleNode(java.lang.String id)
           
 
Method Summary
 void checkContext()
          Obtaining the node type and checking for consistency.
protected  java.lang.Class<?> commonNumberType(SimpleNode n1, SimpleNode n2)
          Widening a number type as necessary.
 Node copy()
          Copys the abstract syntax tree.
 void dump(java.lang.String prefix)
           
 void getAllVariablesinExpression(java.util.Vector<java.lang.String> v)
          fills the vector with the names of all variables which occur in this abstract syntax tree
 java.lang.String getError()
          This method returns an error string, if interpretting is failed
 java.lang.String getIdentifier()
           
 java.lang.Object getInfo()
           
 java.lang.Class<?> getNodeClass()
          Getting the node class.
 java.lang.Object getRootResult()
           
 java.lang.String getString()
          returns this node as a string with all children.
static SymbolTable getSymbolTable()
           
 boolean hasNumberType()
          Checking if node's type is a number type.
 boolean hasStringType()
          Checking if node's type is a number type.
 void interpret()
          Interpret method
 boolean isAction()
          Checking if the node represents a member (method or field).
 boolean isArrayIndex()
          Checking if the node represents an array index).
protected  boolean isConstantExpr()
           
 boolean isMember()
          Checking if the node represents a member (method or field).
 void jjtAddChild(Node n)
          This method tells the node to add its argument to the node's list of children.
 void jjtClose()
          This method is called after all the child nodes have been added.
static Node jjtCreate(java.lang.String id)
           
 Node jjtGetChild(int i)
          This method returns a child node.
 int jjtGetNumChildren()
          Return the number of children the node has.
 Node jjtGetParent()
           
 void jjtOpen()
          This method is called after the node has been made the current node.
 void jjtSetParent(Node n)
          This pair of methods are used to inform the node of its parent.
 void replaceChildWith(Node old, Node newNode)
          Replaces a child
 void rewrite()
          Rewrites all children.
static void setClassResolver(ClassResolver cr)
           
 void setInfo(java.lang.Object i)
           
protected  void setNodeClass(java.lang.Class<?> nodeClass)
          Setting the node class.
static void setSymbolTable(SymbolTable st)
           
protected  void takeNodeClassFrom(SimpleNode node)
          Setting the node class to that of the parameter node.
 java.lang.String toString()
           
 java.lang.String toString(java.lang.String prefix)
           
protected  int typeCode()
          Getting the number type code of this node object
protected static int typeCode(java.lang.Class<?> cls)
          Getting the number type code of a primitive number type
protected static void typeInit()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

parent

protected Node parent

children

protected java.util.Vector<Node> children

identifier

protected java.lang.String identifier

info

protected java.lang.Object info

stack

protected static java.lang.Object[] stack
Stack for calculations.


top

protected static int top

neverCalled

protected static boolean neverCalled
Initialization flag


symtab

protected static SymbolTable symtab
Symbol table


numberTypes

protected static java.util.Hashtable<java.lang.Class<?>,java.lang.Integer> numberTypes
Widening order for numeric types


stringClass

protected static java.lang.Class<?> stringClass
String class handle for frequent comparison


objectClass

protected static java.lang.Class<?> objectClass
Object class handle for frequent comparison


classResolver

protected static ClassResolver classResolver
Constructor Detail

SimpleNode

public SimpleNode(java.lang.String id)
Method Detail

jjtCreate

public static Node jjtCreate(java.lang.String id)

jjtOpen

public void jjtOpen()
Description copied from interface: Node
This method is called after the node has been made the current node. It indicates that child nodes can now be added to it.

Specified by:
jjtOpen in interface Node

jjtClose

public void jjtClose()
Description copied from interface: Node
This method is called after all the child nodes have been added.

Specified by:
jjtClose in interface Node

jjtSetParent

public void jjtSetParent(Node n)
Description copied from interface: Node
This pair of methods are used to inform the node of its parent.

Specified by:
jjtSetParent in interface Node

jjtGetParent

public Node jjtGetParent()
Specified by:
jjtGetParent in interface Node

jjtAddChild

public void jjtAddChild(Node n)
Description copied from interface: Node
This method tells the node to add its argument to the node's list of children.

Specified by:
jjtAddChild in interface Node

jjtGetChild

public Node jjtGetChild(int i)
Description copied from interface: Node
This method returns a child node. The children are numbered from zero, left to right.

Specified by:
jjtGetChild in interface Node

jjtGetNumChildren

public int jjtGetNumChildren()
Description copied from interface: Node
Return the number of children the node has.

Specified by:
jjtGetNumChildren in interface Node

setInfo

public void setInfo(java.lang.Object i)

getInfo

public java.lang.Object getInfo()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(java.lang.String prefix)

dump

public void dump(java.lang.String prefix)
Specified by:
dump in interface Node

interpret

public void interpret()
Description copied from interface: Node
Interpret method

Specified by:
interpret in interface Node

getError

public java.lang.String getError()
Description copied from interface: Node
This method returns an error string, if interpretting is failed

Specified by:
getError in interface Node

typeInit

protected static void typeInit()

getNodeClass

public java.lang.Class<?> getNodeClass()
Getting the node class.


setNodeClass

protected void setNodeClass(java.lang.Class<?> nodeClass)
Setting the node class.


takeNodeClassFrom

protected void takeNodeClassFrom(SimpleNode node)
Setting the node class to that of the parameter node.


isAction

public boolean isAction()
Checking if the node represents a member (method or field).


isMember

public boolean isMember()
Checking if the node represents a member (method or field).


isArrayIndex

public boolean isArrayIndex()
Checking if the node represents an array index).


hasStringType

public boolean hasStringType()
Checking if node's type is a number type.


hasNumberType

public boolean hasNumberType()
Checking if node's type is a number type.


typeCode

protected int typeCode()
Getting the number type code of this node object


typeCode

protected static int typeCode(java.lang.Class<?> cls)
Getting the number type code of a primitive number type


commonNumberType

protected java.lang.Class<?> commonNumberType(SimpleNode n1,
                                              SimpleNode n2)
Widening a number type as necessary.


isConstantExpr

protected boolean isConstantExpr()

checkContext

public void checkContext()
Obtaining the node type and checking for consistency.

Specified by:
checkContext in interface Node

setSymbolTable

public static void setSymbolTable(SymbolTable st)

getSymbolTable

public static SymbolTable getSymbolTable()

setClassResolver

public static void setClassResolver(ClassResolver cr)

getRootResult

public java.lang.Object getRootResult()
Specified by:
getRootResult in interface Node

getString

public java.lang.String getString()
returns this node as a string with all children. Subclasses must override this.

Specified by:
getString in interface Node

rewrite

public void rewrite()
Rewrites all children. This method must be overridden if any special handling is needed.

Specified by:
rewrite in interface Node
See Also:
special rewriting at class ASTId

replaceChildWith

public void replaceChildWith(Node old,
                             Node newNode)
Replaces a child

Specified by:
replaceChildWith in interface Node

getAllVariablesinExpression

public void getAllVariablesinExpression(java.util.Vector<java.lang.String> v)
fills the vector with the names of all variables which occur in this abstract syntax tree

Specified by:
getAllVariablesinExpression in interface Node

getIdentifier

public java.lang.String getIdentifier()

copy

public Node copy()
Copys the abstract syntax tree. The information object won't be copied.

Specified by:
copy in interface Node