All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class lib.Node

java.lang.Object
   |
   +----lib.Node

public class Node
extends Object
The class Node is used to represent the syntex tree. Every node consists of an ID, a type, a list of children, a reference to its parent and some further data corresponding to its type. The types a node can have are defined in class Types.


Variable Index

 o access
how to access a variable or method
 o children
the children of the node are stored here
 o classNode
pointer to the associated ClassNode
 o data
any data to be stored in the node
 o decl
a reference to the declaration
 o etype
if this node is part of an expression, the type is store here
 o id
the node's ID
 o limitLocals
the number of local variables in a method; only valid for T_METHDEC nodes
 o limitStack
the maximum number of stack cells needed while executing the method; only valid for T_METHDEC nodes
 o lineNo
line number in source program
 o nextID
next usable free ID
 o offset
address of local variable relative to stack frame
 o parent
the parent
 o type
the type of the node as defines in Types

Constructor Index

 o Node(int)
The constructor creates a new instance of the object Node of type type and initializes some fields.
 o Node(int, int)
The constructor creates a new instance of the object Node of type type and initializes some fields.
 o Node(int, Object)
The constructor creates a new instance of the object Node of type type and initializes some fields, especially the data-member is set to data.
 o Node(int, Object, int)
The constructor creates a new instance of the object Node of type type and initializes some fields, especially the data-member is set to data.

Method Index

 o addEdge(Node)
This method adds an edge from this node to dest.
 o getChild(int)
Returns idxth child of the node.
 o getChildren()
Returns an enumeration for the children.
 o getChildrenCount()
Returns the number of children.
 o getID()
Returns the unique ID of the node.

Variables

 o nextID
 protected static int nextID
next usable free ID

 o id
 protected int id
the node's ID

 o children
 protected Vector children
the children of the node are stored here

 o parent
 public Node parent
the parent

 o classNode
 public ClassNode classNode
pointer to the associated ClassNode

 o data
 public Object data
any data to be stored in the node

 o type
 public int type
the type of the node as defines in Types

 o offset
 public int offset
address of local variable relative to stack frame

 o access
 public int access
how to access a variable or method

 o decl
 public Node decl
a reference to the declaration

 o etype
 public String etype
if this node is part of an expression, the type is store here

 o lineNo
 public int lineNo
line number in source program

 o limitLocals
 public int limitLocals
the number of local variables in a method; only valid for T_METHDEC nodes

 o limitStack
 public int limitStack
the maximum number of stack cells needed while executing the method; only valid for T_METHDEC nodes

Constructors

 o Node
 public Node(int type)
The constructor creates a new instance of the object Node of type type and initializes some fields.

Parameters:
type - the type of the node
 o Node
 public Node(int type,
             int lineNo)
The constructor creates a new instance of the object Node of type type and initializes some fields.

Parameters:
type - the type of the node
lineNo - line number associated with this node
 o Node
 public Node(int type,
             Object data)
The constructor creates a new instance of the object Node of type type and initializes some fields, especially the data-member is set to data.

Parameters:
type - the type of the node
data - the object to be stored in the node's data-member
 o Node
 public Node(int type,
             Object data,
             int lineNo)
The constructor creates a new instance of the object Node of type type and initializes some fields, especially the data-member is set to data.

Parameters:
type - the type of the node
data - the object to be stored in the node's data-member
lineNo - line number associated with this node

Methods

 o addEdge
 public int addEdge(Node dest)
This method adds an edge from this node to dest. NOTE: The order in which the edges are added is significant.

Parameters:
dest - the destination node the edge leads to
Returns:
the index of the edge/child, or -1 if an error occured
 o getID
 public int getID()
Returns the unique ID of the node.

Returns:
the node's ID
 o getChildrenCount
 public int getChildrenCount()
Returns the number of children.

Returns:
number of children
 o getChild
 public Node getChild(int idx)
Returns idxth child of the node.

Parameters:
idx - index in children list
Returns:
the desired child
 o getChildren
 public Enumeration getChildren()
Returns an enumeration for the children.

Returns:
an Enumeration object

All Packages  Class Hierarchy  This Package  Previous  Next  Index