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

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.BinaryExp
All Implemented Interfaces:
IExpParent, Disposable, Serializable, Cloneable

public final class BinaryExp
extends Exp

Binary exp AST.

Version:
CVS $Revision: 1.4 $ $Date: 2005/01/13 23:40:09 $
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
BinaryExp(BinaryOp binaryOp, Exp exp1, Exp exp2)
          Default constructor.
 
Method Summary
 BinaryExp clone()
          Clones this object (deep clone); including location info.
 void dispose()
          Disposes exp1 and exp2.
 BinaryOp getBinaryOp()
          Gets the binary operator.
 Exp getExp1()
          Gets the first exp.
 Exp getExp2()
          Gets the second exp.
 void setBinaryOp(BinaryOp newBinaryOp)
          Sets the binary operator.
 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

BinaryExp

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

Parameters:
binaryOp - The binary operator. Must be valid.
exp1 - The first exp. Must be non-null.
exp2 - The second exp. Must be non-null.
Method Detail

setBinaryOp

public void setBinaryOp(BinaryOp newBinaryOp)
Sets the binary operator.

Parameters:
newBinaryOp - The new binary operator. Must be valid.

getBinaryOp

public BinaryOp getBinaryOp()
Gets the binary operator.

Returns:
The binary operator. Valid.

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 BinaryExp 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 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:
"exp1 binaryOp exp2".

visit

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