edu.ksu.cis.projects.bogor.ast
Class ConditionalExp

java.lang.Object
  extended by edu.ksu.cis.projects.bogor.ast.Node
      extended by edu.ksu.cis.projects.bogor.ast.Exp
          extended by edu.ksu.cis.projects.bogor.ast.ConditionalExp
All Implemented Interfaces:
IExpParent, Disposable, Serializable, Cloneable

public final class ConditionalExp
extends Exp

Binary exp AST.

Version:
CVS $Revision: 1.5 $ $Date: 2005/01/13 23:40:08 $
Author:
Robby
See Also:
Serialized Form

Field Summary
 
Fields inherited from class edu.ksu.cis.projects.bogor.ast.Exp
TYPE
 
Fields inherited from class edu.ksu.cis.projects.bogor.ast.Node
ILLEGAL_LOCAL_ID_CHAR
 
Constructor Summary
ConditionalExp(Exp cond, Exp exp1, Exp exp2)
          Default constructor.
 
Method Summary
 ConditionalExp clone()
          Clones this object (deep clone); including location info.
 void dispose()
          Disposes cond, exp1, and exp2.
 Exp getCondition()
          Gets the condition exp.
 Exp getExp1()
          Gets the first exp.
 Exp getExp2()
          Gets the second exp.
 void setCondition(Exp newCond)
          Sets the conditione exp.
 void setExp1(Exp newExp1)
          Sets the first exp.
 void setExp2(Exp newExp2)
          Sets the second exp.
 String toString()
          Returns the string representation of this object.
 void visit(ASTVisitor visitor)
           
 
Methods inherited from class edu.ksu.cis.projects.bogor.ast.Exp
getParent, setParent
 
Methods inherited from class edu.ksu.cis.projects.bogor.ast.Node
getLocationInfo, getProperty, putProperty, setLocationInfo
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConditionalExp

public ConditionalExp(Exp cond,
                      Exp exp1,
                      Exp exp2)
Default constructor. Sets this object as the cond exp's, first exp's and second exp's parent.

Parameters:
cond - The condition exp. Must be non-null.
exp1 - The first exp. Must be non-null.
exp2 - The second exp. Must be non-null.
Method Detail

setCondition

public void setCondition(Exp newCond)
Sets the conditione exp.

Parameters:
newCond - The new condition exp. Must be non-null.

getCondition

public Exp getCondition()
Gets the condition exp.

Returns:
The condition exp. Non-null.

setExp1

public void setExp1(Exp newExp1)
Sets the first exp. Sets this object as the first exp's parent.

Parameters:
newExp1 - The new first exp. Must be non-null.

getExp1

public Exp getExp1()
Gets the first exp.

Returns:
The first exp. Non-null.

setExp2

public void setExp2(Exp newExp2)
Sets the second exp. Sets this object as the second exp's parent.

Parameters:
newExp2 - The new second exp. Must be non-null.

getExp2

public Exp getExp2()
Gets the second exp.

Returns:
The second exp. Non-null.

clone

public ConditionalExp clone()
Clones this object (deep clone); including location info.

Specified by:
clone in class Exp
Returns:
The clone of this object. Non-null.

dispose

public void dispose()
Disposes cond, exp1, and exp2. Can be called repeatedly. Once called, avoid using this object.

Specified by:
dispose in interface Disposable
Overrides:
dispose in class Exp

toString

public String toString()
Returns the string representation of this object.

Specified by:
toString in class Node
Returns:
"cond? exp1 : exp2".

visit

public void visit(ASTVisitor visitor)
Specified by:
visit in class Node