eece496.parsetree
Class ParseTree

java.lang.Object
  extended byeece496.parsetree.ParseTree

public class ParseTree
extends java.lang.Object

Parse Tree class.

$Source: K:/cvsrepo/ee496/codes/jbuilder/src/TestCaseGenerator/src/eece496/parsetree/ParseTree.java,v $
Last updated by $Author: kcai $
$Date: 2003/08/04 06:41:52 $
$Revision: 1.15 $
$State: Exp $

Author:
Kelvin Cai

Field Summary
static int AND
           
static int FALSE
           
static int NOT
           
static int OR
           
static int TEXT
           
static int TRUE
           
 
Constructor Summary
ParseTree()
          Default constructor
ParseTree(ParseTree p)
          Constructor: Copy a ParseTree object to self
ParseTree(java.lang.String kind, int type, ParseTree child1, ParseTree child2, java.lang.Double ROID, java.lang.String text)
          Constructor: Create a ParseTree with give parameters
 
Method Summary
 void clone(ParseTree p)
          clone the contents from a Parse Tree node
 boolean equals(ParseTree p)
          compare whether this Parse Tree equal the contents of the node specified
 ParseTree getChild(int i)
          retrieve the node pointed by the child
 java.lang.String getKind()
          retrieve the kind of the node
 java.lang.Double getRoid()
          retrieve the Roid of the node
 java.lang.String getText()
          retrieve the text of the node
 int getType()
          retrieve the type of the node
 void print()
          recursively print the Parse Tree (for debug purpose only)
 void setChild(int i, ParseTree p)
          set the value of child
 void setType(int i)
          set the type of the node
static ParseTree T_condition(int thisType, java.lang.Object T1, java.lang.Object T2, java.lang.String T3)
          construct a Condition node
static ParseTree T_conditions(int thisType, java.lang.String T1, java.lang.Object T2, java.lang.Object T3)
          construct a Conditions node
static ParseTree T_req(int thisType, java.lang.Object T1, java.lang.Object T2, java.lang.Object T3, java.lang.String T4)
          construct a Requirement node
static ParseTree T_reqs(java.lang.Object T1, java.lang.Object T2)
          construct a Requirements node
static ParseTree T_stimOrResp(int thisType, java.lang.Object T1)
          construct a StimulusOrResponse node
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AND

public static final int AND
See Also:
Constant Field Values

OR

public static final int OR
See Also:
Constant Field Values

NOT

public static final int NOT
See Also:
Constant Field Values

TEXT

public static final int TEXT
See Also:
Constant Field Values

TRUE

public static final int TRUE
See Also:
Constant Field Values

FALSE

public static final int FALSE
See Also:
Constant Field Values
Constructor Detail

ParseTree

public ParseTree(ParseTree p)
Constructor: Copy a ParseTree object to self

Parameters:
p - - a ParseTree object

ParseTree

public ParseTree(java.lang.String kind,
                 int type,
                 ParseTree child1,
                 ParseTree child2,
                 java.lang.Double ROID,
                 java.lang.String text)
Constructor: Create a ParseTree with give parameters

Parameters:
kind - - kind of the node
type - - type of the specific kind of node
child1 - - one child of the node which point to another node
child2 - - the other child of the node which point to another node
ROID - - Roid number of the node
text - - Text of the node

ParseTree

public ParseTree()
Default constructor

Method Detail

T_condition

public static ParseTree T_condition(int thisType,
                                    java.lang.Object T1,
                                    java.lang.Object T2,
                                    java.lang.String T3)
construct a Condition node

Parameters:
thisType - - one type of Condition
T1 - - child one
T2 - - childe two
T3 - - text
Returns:
a newly constructed Condition node

T_conditions

public static ParseTree T_conditions(int thisType,
                                     java.lang.String T1,
                                     java.lang.Object T2,
                                     java.lang.Object T3)
construct a Conditions node

Parameters:
thisType - - one type of Conditions
T1 - - text
T2 - - child one
T3 - - child two
Returns:
a newly constructed Conditions node

T_req

public static ParseTree T_req(int thisType,
                              java.lang.Object T1,
                              java.lang.Object T2,
                              java.lang.Object T3,
                              java.lang.String T4)
construct a Requirement node

Parameters:
thisType - - one type of Requirement
T1 - - child one
T2 - - child two
T3 - - Roid
T4 - - text
Returns:
a newly constructed Requirement node

T_reqs

public static ParseTree T_reqs(java.lang.Object T1,
                               java.lang.Object T2)
construct a Requirements node

Parameters:
T1 - - child one
T2 - - child two
Returns:
a newly constructed Requirements node

T_stimOrResp

public static ParseTree T_stimOrResp(int thisType,
                                     java.lang.Object T1)
construct a StimulusOrResponse node

Parameters:
thisType - - one type of StimulusOrResponse
T1 - - text
Returns:
a newly constructed StimulusOrResponse node

print

public void print()
recursively print the Parse Tree (for debug purpose only)


getType

public int getType()
retrieve the type of the node

Returns:
the type of the node

getChild

public ParseTree getChild(int i)
retrieve the node pointed by the child

Parameters:
i - - one of the children
Returns:
the node pointed by the child

setType

public void setType(int i)
set the type of the node

Parameters:
i - - type

setChild

public void setChild(int i,
                     ParseTree p)
set the value of child

Parameters:
i - - index for the child
p - - the node which is pointed by the child

equals

public boolean equals(ParseTree p)
compare whether this Parse Tree equal the contents of the node specified

Parameters:
p - - the node to be compared
Returns:
true if equal, false if not equal

getKind

public java.lang.String getKind()
retrieve the kind of the node

Returns:
the kind of the node

clone

public void clone(ParseTree p)
clone the contents from a Parse Tree node

Parameters:
p - the Parse Tree want to be cloned

getText

public java.lang.String getText()
retrieve the text of the node

Returns:
the text of the node

getRoid

public java.lang.Double getRoid()
retrieve the Roid of the node

Returns:
the Roid of the node