|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object avrora.core.isdl.ast.Expr avrora.core.isdl.ast.Arith avrora.core.isdl.ast.Arith.UnOp
The UnOp
inner class represents an operation on a single integer value. For example, the
bitwise complement and the negation of an integer are operations on a single integer that produce a
single integer result.
Nested Class Summary |
Nested classes inherited from class avrora.core.isdl.ast.Arith |
Arith.AddExpr, Arith.AndExpr, Arith.BinOp, Arith.CompExpr, Arith.DivExpr, Arith.MulExpr, Arith.NegExpr, Arith.OrExpr, Arith.ShiftLeftExpr, Arith.ShiftRightExpr, Arith.SubExpr, Arith.UnOp, Arith.XorExpr |
Field Summary | |
Expr |
operand
The operand field stores a reference to the expression operand of this operation. |
java.lang.String |
operation
The operation field stores the string name of the operation being performed on the
expression. |
Fields inherited from class avrora.core.isdl.ast.Expr |
PREC_A_ADD, PREC_A_AND, PREC_A_MUL, PREC_A_OR, PREC_A_SHIFT, PREC_A_XOR, PREC_L_AND, PREC_L_EQU, PREC_L_OR, PREC_L_REL, PREC_L_XOR, PREC_TERM, PREC_UN |
Constructor Summary | |
Arith.UnOp(java.lang.String op,
Expr o)
The constructor of the UnOp class initializes the public final fields that form the
structure of this expression. |
Method Summary | |
void |
accept(ExprVisitor v)
The accept() method implements one half of the visitor pattern so that client visitors
can traverse the syntax tree easily and in an extensible way. |
int |
getPrecedence()
The getPrecedence() method gets the binding precedence for this expression. |
boolean |
isConstantExpr()
The isConstantExpr() method tests whether this expression is a constant expression
(i.e. it is reducable to a constant and has no references to variables, maps, etc). |
java.lang.String |
toString()
The toString() method recursively converts this expression to a string. |
Methods inherited from class avrora.core.isdl.ast.Expr |
accept, accept, getBitWidth, innerString, isBitRangeExpr, isLiteral, isMap, isVariable, tokenToBool, tokenToInt |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public final java.lang.String operation
operation
field stores the string name of the operation being performed on the
expression. For example, '~' represents bitwise negation.
public final Expr operand
operand
field stores a reference to the expression operand of this operation.
Constructor Detail |
public Arith.UnOp(java.lang.String op, Expr o)
UnOp
class initializes the public final fields that form the
structure of this expression.
op
- the string name of the operationo
- the operand of this operationMethod Detail |
public boolean isConstantExpr()
isConstantExpr()
method tests whether this expression is a constant expression
(i.e. it is reducable to a constant and has no references to variables, maps, etc).
isConstantExpr
in class Expr
public void accept(ExprVisitor v)
accept()
method implements one half of the visitor pattern so that client visitors
can traverse the syntax tree easily and in an extensible way.
accept
in class Expr
v
- the visitor to acceptpublic java.lang.String toString()
toString()
method recursively converts this expression to a string. For binary
operations, inner expressions will be nested within parentheses if their precedence is lower than
the precedence of the parent expression.
public int getPrecedence()
getPrecedence()
method gets the binding precedence for this expression. This is
used to compute when inner expressions must be nested within parentheses in order to preserve the
implied order of evaluation.
getPrecedence
in class Expr
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |