avrora.core.isdl.ast
Class Logical.UnOp

java.lang.Object
  extended byavrora.core.isdl.ast.Expr
      extended byavrora.core.isdl.ast.Logical
          extended byavrora.core.isdl.ast.Logical.UnOp
Direct Known Subclasses:
Logical.NotExpr
Enclosing class:
Logical

public abstract static class Logical.UnOp
extends Logical

The UnOp inner class represents an operation on a single boolean value. For example, the logical negation is an operation on a single boolean that produce a single boolean result.


Nested Class Summary
 
Nested classes inherited from class avrora.core.isdl.ast.Logical
Logical.AndExpr, Logical.BinOp, Logical.EquExpr, Logical.GreaterEquExpr, Logical.GreaterExpr, Logical.LessEquExpr, Logical.LessExpr, Logical.NequExpr, Logical.NotExpr, Logical.OrExpr, Logical.UnOp, Logical.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
Logical.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.
 java.lang.String toString()
           
 
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

operation

public final java.lang.String operation
The operation field stores the string name of the operation being performed on the expression. For example, '!' represents logical negation.


operand

public final Expr operand
The operand field stores a reference to the expression operand of this operation.

Constructor Detail

Logical.UnOp

public Logical.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.

Parameters:
op - the string name of the operation
o - the operand of this operation
Method Detail

isConstantExpr

public boolean isConstantExpr()
Description copied from class: Expr
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).

Overrides:
isConstantExpr in class Expr
Returns:
true if this expression can be evaluated to a constant; false otherwise

accept

public 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.

Specified by:
accept in class Expr
Parameters:
v - the visitor to accept

toString

public java.lang.String toString()

getPrecedence

public int getPrecedence()
Description copied from class: Expr
The 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.

Specified by:
getPrecedence in class Expr
Returns:
an integer representing the precedence of this expression; higher numbers are higher precedence