gov.llnl.babel.symbols
public class BinaryExpression extends AssertionExpression
Modifier and Type | Field and Description |
---|---|
static int |
BITWISE_AND |
static int |
BITWISE_OR |
static int |
BITWISE_XOR |
static int |
DIVIDE |
static int |
EQUALS |
static int |
GREATER_EQUAL |
static int |
GREATER_THAN |
static int |
IF_AND_ONLY_IF |
static int |
IMPLIES |
static int |
LESS_EQUAL |
static int |
LESS_THAN |
static int |
LOGICAL_AND |
static int |
LOGICAL_OR |
static int |
LOGICAL_XOR |
static int |
MAX_OP_VALUE |
static int |
MIN_OP_VALUE |
static int |
MINUS |
static int |
MODULUS |
static int |
MULTIPLY |
static int |
NOOP |
static int |
NOT_EQUAL |
static int |
PLUS |
static int |
POWER |
static int |
REMAINDER |
static int |
SHIFT_LEFT |
static int |
SHIFT_RIGHT |
d_context, ERROR_SEMANTIC_VALIDATION
Constructor and Description |
---|
BinaryExpression(AssertionExpression lhs,
int op,
AssertionExpression rhs,
Context context)
Construct a new object.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
accept(ExprVisitor ev,
java.lang.Object data)
Implement the "visitor pattern".
|
boolean |
arrayOnLeft()
Return TRUE if an array appears on the LHS; otherwise, FALSE.
|
boolean |
arrayOnRight()
Return TRUE if an array appears on the RHS; otherwise, FALSE.
|
java.lang.String |
cExpression(java.lang.String epvVar,
int[] startInd)
Return the C version of the expression.
|
java.util.ArrayList |
getArrayIterMacros(java.lang.String epvVar,
int[] startInd)
Return the list of array iteration macro messages, if any.
|
java.lang.String |
getArrayRelation()
Return the array relation only.
|
java.lang.String |
getArrayRelationVariable(boolean onLeft)
Return the specified array relation's array variable.
|
int |
getDefaultComplexity()
Return the default complexity of the expression (0 = constant, 1 = linear,
etc.).
|
AssertionExpression |
getLeftExpression()
Return the left-hand expression.
|
int |
getNumArrayIterMacrosByType(char type)
Returns the number of macros supported by this assertion of the
specified type.
|
int |
getOp()
Return the binary operator.
|
java.lang.String |
getOpSymbol()
Return the symbol associated with the operator.
|
AssertionExpression |
getRightExpression()
Return the right-hand expression.
|
boolean |
hasBuiltinMethod(int type)
Return TRUE if the expression is, or has, the specified built-in method
call; otherwise, return FALSE.
|
boolean |
hasMethodCall()
Return TRUE if the expression has at least one method call; otherwise,
return FALSE.
|
boolean |
hasPure()
Return TRUE if the expression has an "is pure" clause; otherwise, return
FALSE.
|
boolean |
hasResult()
Return TRUE if the expression uses the "result" keyword; otherwise,
return FALSE.
|
boolean |
hasResultOrArg()
Return TRUE if a result clause or method argument is found within the
expression; otherwise, return FALSE.
|
boolean |
hasResultOrOutArg(boolean outOnly)
Return TRUE if a result clause or output argument is found within the
expression; otherwise, return FALSE.
|
boolean |
hasUserDefinedMethod(boolean any)
Return TRUE if the expression has a method AND the method is any
user-defined method (when any is TRUE) or it is an user-defined
method with a throws clause (if any is FALSE); otherwise, return FALSE.
|
boolean |
isArrayRelationRequired()
Return TRUE if the array relation is required (during validation);
otherwise, return FALSE.
|
boolean |
requiresExtendableContext()
Return TRUE if extendable context is required to validate the expression;
otherwise, return FALSE.
|
boolean |
requiresMethodContext()
Return TRUE if method context is required to validate the expression;
otherwise, return FALSE.
|
void |
setArrayRelationRequired(boolean isReq)
Set the array relation required attribute.
|
java.lang.String |
toString()
Return the stringified version of the expression (in SIDL form).
|
protected void |
validateSemantics(Extendable ext,
Method m)
Validate the expression semantics, first ensuring both subexpressions
are valid then that the binary expression is valid for the specified
operator.
|
getExceptionPrefix, getExceptionPrefix, getReturnType, getReturnTypeName, getReturnTypeValue, hasParens, isValid, leftAssociative, returnIsArray, returnIsBoolean, returnIsCharacter, returnIsClass, returnIsDComplex, returnIsDouble, returnIsEnum, returnIsFComplex, returnIsFloat, returnIsInteger, returnIsInterface, returnIsLong, returnIsNumericArray, returnIsOpaque, returnIsString, setParens, setReturnToBoolean, setReturnToCharacter, setReturnToClass, setReturnToDComplex, setReturnToDouble, setReturnToEnum, setReturnToFComplex, setReturnToFloat, setReturnToInteger, setReturnToInterface, setReturnToLong, setReturnToOpaque, setReturnToString, setReturnType, setReturnType, validateExpression
public static final int NOOP
public static final int LOGICAL_AND
public static final int DIVIDE
public static final int EQUALS
public static final int GREATER_EQUAL
public static final int GREATER_THAN
public static final int IF_AND_ONLY_IF
public static final int IMPLIES
public static final int LESS_EQUAL
public static final int LESS_THAN
public static final int MINUS
public static final int MODULUS
public static final int MULTIPLY
public static final int NOT_EQUAL
public static final int LOGICAL_OR
public static final int PLUS
public static final int POWER
public static final int REMAINDER
public static final int SHIFT_LEFT
public static final int SHIFT_RIGHT
public static final int LOGICAL_XOR
public static final int BITWISE_AND
public static final int BITWISE_OR
public static final int BITWISE_XOR
public static final int MIN_OP_VALUE
public static final int MAX_OP_VALUE
public BinaryExpression(AssertionExpression lhs, int op, AssertionExpression rhs, Context context) throws AssertionException
lhs
- The expression on the left side of the operator.op
- The binary operator.rhs
- The expression on the right side of the operator.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 AssertionExpression getLeftExpression()
public int getOp()
public java.lang.String getOpSymbol()
public AssertionExpression getRightExpression()
public void setArrayRelationRequired(boolean isReq)
public boolean isArrayRelationRequired()
public java.lang.String getArrayRelationVariable(boolean onLeft)
public java.lang.String getArrayRelation()
public boolean arrayOnLeft()
public boolean arrayOnRight()
public boolean hasPure()
hasPure
in class AssertionExpression
public boolean hasResult()
hasResult
in class AssertionExpression
public boolean hasResultOrArg()
hasResultOrArg
in class AssertionExpression
public boolean hasResultOrOutArg(boolean outOnly)
hasResultOrOutArg
in class AssertionExpression
outOnly
- TRUE if only concerned with output arguments that are
out only; FALSE otherwise.public boolean hasMethodCall()
hasMethodCall
in class AssertionExpression
public int getDefaultComplexity()
getDefaultComplexity
in class AssertionExpression
public boolean hasBuiltinMethod(int type)
hasBuiltinMethod
in class AssertionExpression
public boolean hasUserDefinedMethod(boolean any)
hasUserDefinedMethod
in class AssertionExpression
public boolean requiresExtendableContext()
requiresExtendableContext
in class AssertionExpression
public boolean requiresMethodContext()
requiresMethodContext
in class AssertionExpression
protected void validateSemantics(Extendable ext, Method m) throws AssertionException
validateSemantics
in class AssertionExpression
ext
- The interface or class that owns this expression.m
- The method that owns this expression.AssertionException
- The exception that can be raised during the validation.public java.util.ArrayList getArrayIterMacros(java.lang.String epvVar, int[] startInd)
getArrayIterMacros
in class AssertionExpression
public int getNumArrayIterMacrosByType(char type)
getNumArrayIterMacrosByType
in class AssertionExpression
public java.lang.String cExpression(java.lang.String epvVar, int[] startInd)
cExpression
in class AssertionExpression
public java.lang.String toString()
toString
in class AssertionExpression
public java.lang.Object accept(ExprVisitor ev, java.lang.Object data)
accept
in class AssertionExpression