Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
gov.llnl.babel.symbols.AssertionExpression
gov.llnl.babel.symbols.BinaryExpression
public class BinaryExpression
extends AssertionExpression
Field Summary | |
static int | |
static int | |
static int | |
static int | |
static int | |
static int | |
static int | |
static int | |
static int | |
static int | |
static int | |
static int | |
static int | |
static int | |
static int | |
static int | |
static int | |
static int | |
static int | |
static int | |
static int | |
static int | |
static int | |
static int | |
static int | |
static int |
Fields inherited from class gov.llnl.babel.symbols.AssertionExpression | |
ERROR_SEMANTIC_VALIDATION , d_context |
Constructor Summary | |
|
Method Summary | |
Object |
|
boolean |
|
boolean |
|
String |
|
ArrayList |
|
String |
|
String |
|
AssertionExpression |
|
int |
|
int |
|
String |
|
AssertionExpression |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
void |
|
String |
|
protected void |
|
public static final int BITWISE_AND
- Field Value:
- 21
public static final int BITWISE_OR
- Field Value:
- 22
public static final int BITWISE_XOR
- Field Value:
- 23
public static final int DIVIDE
- Field Value:
- 2
public static final int EQUALS
- Field Value:
- 3
public static final int GREATER_EQUAL
- Field Value:
- 4
public static final int GREATER_THAN
- Field Value:
- 5
public static final int IF_AND_ONLY_IF
- Field Value:
- 6
public static final int IMPLIES
- Field Value:
- 7
public static final int LESS_EQUAL
- Field Value:
- 8
public static final int LESS_THAN
- Field Value:
- 9
public static final int LOGICAL_AND
- Field Value:
- 1
public static final int LOGICAL_OR
- Field Value:
- 14
public static final int LOGICAL_XOR
- Field Value:
- 20
public static final int MAX_OP_VALUE
- Field Value:
- 23
public static final int MINUS
- Field Value:
- 10
public static final int MIN_OP_VALUE
- Field Value:
- 1
public static final int MODULUS
- Field Value:
- 11
public static final int MULTIPLY
- Field Value:
- 12
public static final int NOOP
- Field Value:
- 0
public static final int NOT_EQUAL
- Field Value:
- 13
public static final int PLUS
- Field Value:
- 15
public static final int POWER
- Field Value:
- 16
public static final int REMAINDER
- Field Value:
- 17
public static final int SHIFT_LEFT
- Field Value:
- 18
public static final int SHIFT_RIGHT
- Field Value:
- 19
public BinaryExpression(AssertionExpression lhs, int op, AssertionExpression rhs, Context context) throws AssertionException
Construct a new object. An exception is thrown if an invalid binary operator is specified.
- Parameters:
lhs
- The expression on the left side of the operator.op
- The binary operator.rhs
- The expression on the right side of the operator.
- Throws:
AssertionException
- The exception raised if the specified return type is out of range, the operator invalid, or either the left or right expression is null.
public Object accept(ExprVisitor ev, Object data)
Implement the "visitor pattern".
- Overrides:
- accept in interface AssertionExpression
public boolean arrayOnLeft()
Return TRUE if an array appears on the LHS; otherwise, FALSE.
public boolean arrayOnRight()
Return TRUE if an array appears on the RHS; otherwise, FALSE.
public String cExpression(String epvVar, int[] startInd)
Return the C version of the expression. ToDo...Need to finish this. In particular, need to handle complex subexpressions properly -- at least under the assumption that the relevant complex struct has been declared!
- Overrides:
- cExpression in interface AssertionExpression
public ArrayList getArrayIterMacros(String epvVar, int[] startInd)
Return the list of array iteration macro messages, if any. Each message is a string where the first character indicates the return type associated with the iteration. The remaining characters will be the actual macro invocation.
- Overrides:
- getArrayIterMacros in interface AssertionExpression
public String getArrayRelation()
Return the array relation only. For relations with a single array, this is the operator and value being used for comparison. When both arrays are specified, this is only the operator.
public String getArrayRelationVariable(boolean onLeft)
Return the specified array relation's array variable.
public int getNumArrayIterMacrosByType(char type)
Returns the number of macros supported by this assertion of the specified type. Valid types are given in MethodCall.java.
- Overrides:
- getNumArrayIterMacrosByType in interface AssertionExpression
public int getOp()
Return the binary operator.
public String getOpSymbol()
Return the symbol associated with the operator. It is assumed the operator is valid thanks to the check in the constructor.
public boolean hasMethodCall()
Return TRUE if the expression has at least one method call; otherwise, return FALSE.
- Overrides:
- hasMethodCall in interface AssertionExpression
public boolean hasPure()
Return TRUE if the expression has an "is pure" clause; otherwise, return FALSE.
- Overrides:
- hasPure in interface AssertionExpression
public boolean hasReservedMethod(int type)
Return TRUE if the expression is, or has, the specified reserved method call; otherwise, return FALSE.
- Overrides:
- hasReservedMethod in interface AssertionExpression
public boolean hasResult()
Return TRUE if the expression uses the "result" keyword; otherwise, return FALSE.
- Overrides:
- hasResult in interface AssertionExpression
public boolean hasUnreservedMethod(boolean any)
Return TRUE if the method is any unreserved method (when any is TRUE) or it is an unreserved method with a throws clause (if any is FALSE); otherwise, return FALSE.
- Overrides:
- hasUnreservedMethod in interface AssertionExpression
public boolean isArrayRelationRequired()
Return TRUE if the array relation is required (during validation); otherwise, return FALSE.
public boolean requiresExtendableContext()
Return TRUE if extendable context is required to validate the expression; otherwise, return FALSE.
- Overrides:
- requiresExtendableContext in interface AssertionExpression
public boolean requiresMethodContext()
Return TRUE if method context is required to validate the expression; otherwise, return FALSE.
- Overrides:
- requiresMethodContext in interface AssertionExpression
public void setArrayRelationRequired(boolean isReq)
Set the array relation required attribute.
public String toString()
Return the stringified version of the expression (in SIDL form).
- Overrides:
- toString in interface AssertionExpression
protected void validateSemantics(Extendable ext, Method m) throws AssertionException
Validate the expression semantics, first ensuring both subexpressions are valid then that the binary expression is valid for the specified operator. Set the return type of this binary expression accordingly.
- Overrides:
- validateSemantics in interface AssertionExpression
- Parameters:
ext
- The interface or class that owns this expression.m
- The method that owns this expression.
- Throws:
AssertionException
- The exception that can be raised during the validation.