openjava.ptree
Class AssignmentExpression

java.lang.Object
  |
  +--openjava.ptree.ParseTreeObject
        |
        +--openjava.ptree.NonLeaf
              |
              +--openjava.ptree.AssignmentExpression
All Implemented Interfaces:
Cloneable, Expression, ParseTree, VariableInitializer

public class AssignmentExpression
extends NonLeaf
implements Expression

The AssignmentExpression class represents an assignment expression with an assignment operator.

See Also:
Expression

Field Summary
static int ADD
           
static int AND
           
static int DIVIDE
           
static int EQUALS
           
static int MOD
           
static int MULT
           
private  int opr
           
(package private) static String[] opr_string
           
static int OR
           
static int SHIFT_L
           
static int SHIFT_R
           
static int SHIFT_RR
           
static int SUB
           
static int XOR
           
 
Fields inherited from class openjava.ptree.NonLeaf
 
Fields inherited from class openjava.ptree.ParseTreeObject
debugFlag, debugLevel, LN, out, writerStack
 
Constructor Summary
AssignmentExpression()
           
AssignmentExpression(Expression lexp, int opr, Expression rexp)
          Allocates a new object.
AssignmentExpression(Expression lexp, String opr, Expression rexp)
           
 
Method Summary
 void accept(ParseTreeVisitor v)
          Accepts a ParseTreeVisitor object as the role of a Visitor in the Visitor pattern, as the role of an Element in the Visitor pattern.
 Expression getLeft()
          Gets the expression of the left operand.
 int getOperator()
          Gets the id number of the operator.
 Expression getRight()
          Gets the expression of the right operand.
 OJClass getType(Environment env)
           
 ParseTree makeCopy()
          Makes a new copy of this nonleaf-node as a ptree-node.
 ParseTree makeRecursiveCopy()
          Makes a new copy (another object) of this nonleaf-node recursively.
 String operatorString()
           
 void setLeft(Expression lexpr)
          Sets the expression of the left operand.
 void setOperator(int opr)
          Sets the id number of the operator.
 void setRight(Expression rexpr)
          Sets the expression of the right operand.
 void writeCode()
          Writes the code this parse-tree presents for.
 
Methods inherited from class openjava.ptree.NonLeaf
childrenAccept, childrenAreEqual, elementAt, equals, getComment, getContents, getLength, getRowType, replaceChildWith, set, set, set, set, set, set, set, set, set, setComment, setElementAt
 
Methods inherited from class openjava.ptree.ParseTreeObject
clone, eq, eq, equal, flushPrintWriter, getDebugFlag, getNest, getObjectID, getParent, getPrintWriter, getTab, hashCode, lastObjectID, popNest, popPrintWriter, pushNest, pushPrintWriter, replace, setDebugFlag, setDebugLevel, setNest, setParent, setPrintStream, setTab, toFlattenString, toString, writeDebug, writeDebugL, writeDebugLln, writeDebugln, writeDebugLR, writeDebugR, writeDebugRln, writeTab
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface openjava.ptree.Expression
getRowType
 
Methods inherited from interface openjava.ptree.ParseTree
childrenAccept, eq, equals, getObjectID, replace, toFlattenString, toString
 

Field Detail

EQUALS

public static final int EQUALS
See Also:
Constant Field Values

MULT

public static final int MULT
See Also:
Constant Field Values

DIVIDE

public static final int DIVIDE
See Also:
Constant Field Values

MOD

public static final int MOD
See Also:
Constant Field Values

ADD

public static final int ADD
See Also:
Constant Field Values

SUB

public static final int SUB
See Also:
Constant Field Values

SHIFT_L

public static final int SHIFT_L
See Also:
Constant Field Values

SHIFT_R

public static final int SHIFT_R
See Also:
Constant Field Values

SHIFT_RR

public static final int SHIFT_RR
See Also:
Constant Field Values

AND

public static final int AND
See Also:
Constant Field Values

XOR

public static final int XOR
See Also:
Constant Field Values

OR

public static final int OR
See Also:
Constant Field Values

opr_string

static final String[] opr_string

opr

private int opr
Constructor Detail

AssignmentExpression

public AssignmentExpression(Expression lexp,
                            int opr,
                            Expression rexp)
Allocates a new object.

Parameters:
lexp - the left expression.
opr - the id number of the operator.
rexp - the right expression.

AssignmentExpression

public AssignmentExpression(Expression lexp,
                            String opr,
                            Expression rexp)

AssignmentExpression

public AssignmentExpression()
Method Detail

makeRecursiveCopy

public ParseTree makeRecursiveCopy()
Description copied from interface: ParseTree
Makes a new copy (another object) of this nonleaf-node recursively. The objects contained by this object will also be copied.

Specified by:
makeRecursiveCopy in interface ParseTree
Overrides:
makeRecursiveCopy in class NonLeaf
Returns:
the copy of this nonleaf-node as a ptree-node.

makeCopy

public ParseTree makeCopy()
Description copied from interface: ParseTree
Makes a new copy of this nonleaf-node as a ptree-node. The objects contained by the new object are same as these contained by the original object.

Specified by:
makeCopy in interface ParseTree
Overrides:
makeCopy in class ParseTreeObject
Returns:
the copy of this nonleaf-node as a ptree-node.

writeCode

public void writeCode()
Description copied from class: NonLeaf
Writes the code this parse-tree presents for.

Specified by:
writeCode in interface ParseTree
Overrides:
writeCode in class NonLeaf

getLeft

public Expression getLeft()
Gets the expression of the left operand.

Returns:
the left expression.

setLeft

public void setLeft(Expression lexpr)
Sets the expression of the left operand.

Parameters:
lexpr - the left expression.

getRight

public Expression getRight()
Gets the expression of the right operand.

Returns:
the right expression.

setRight

public void setRight(Expression rexpr)
Sets the expression of the right operand.

Parameters:
rexpr - the right expression.

getOperator

public int getOperator()
Gets the id number of the operator.

Returns:
the id number of the operator.

setOperator

public void setOperator(int opr)
Sets the id number of the operator.

Parameters:
opr - the id number of the operator.

operatorString

public String operatorString()

accept

public void accept(ParseTreeVisitor v)
            throws ParseTreeException
Description copied from interface: ParseTree
Accepts a ParseTreeVisitor object as the role of a Visitor in the Visitor pattern, as the role of an Element in the Visitor pattern.

This invoke an appropriate visit() method on the accepted visitor.

Specified by:
accept in interface ParseTree
Specified by:
accept in class ParseTreeObject
Parameters:
v - a visitor
ParseTreeException

getType

public OJClass getType(Environment env)
                throws Exception
Specified by:
getType in interface Expression
Exception

SourceForge.net_Logo