gov.llnl.babel.symbols

Class MethodCall


public class MethodCall
extends AssertionExpression

Field Summary

static String
ARRAY_BOOLEAN_RESULT_VAR
Relevant public and private literals.
static String
ARRAY_COUNT_VAR
static String
ARRAY_DOUBLE_RESULT_VAR
static String
ARRAY_INTEGER_RESULT_VAR
static String
ARRAY_ITER_VAR
static String
ARRAY_SIZE_VAR
static int
MACRO_RETURNS_BOOLEAN_IND
static int
MACRO_RETURNS_DOUBLE_IND
static int
MACRO_RETURNS_INTEGER_IND
static char[]
MACRO_RETURN_TYPE
static int
MAXIMUM_ARRAY_METHOD
static int
MAXIMUM_METHOD
static int
MAX_VALID_MACRO_RETURNS
static int
METHOD_ANY_ARRAY
static int
METHOD_ANY_BUILTIN
static int
METHOD_ARRAY_ALL
static int
METHOD_ARRAY_ANY
static int
METHOD_ARRAY_COUNT
static int
METHOD_ARRAY_DIMEN
static int
METHOD_ARRAY_IRANGE
static int
METHOD_ARRAY_LOWER
static int
METHOD_ARRAY_MAX
static int
METHOD_ARRAY_MIN
static int
METHOD_ARRAY_NEAR_EQUAL
static int
METHOD_ARRAY_NONE
static int
METHOD_ARRAY_NON_DECR
static int
METHOD_ARRAY_NON_INCR
static int
METHOD_ARRAY_RANGE
static int
METHOD_ARRAY_SIZE
static int
METHOD_ARRAY_STRIDE
static int
METHOD_ARRAY_SUM
static int
METHOD_ARRAY_UPPER
static int
METHOD_IRANGE
static int
METHOD_NEAR_EQUAL
static int
METHOD_NOT_RESERVED
static int
METHOD_NUMERIC_ARRAY
static int
METHOD_RANGE
static int
METHOD_RELATION_BOTH
static int
METHOD_RELATION_LEFT
static int
METHOD_RELATION_NONE
static int
METHOD_RELATION_RIGHT
static int
MINIMUM_METHOD
static int
RELATION_OP_EQUAL
WARNING: The following relation operators must correspond to those found in sidlArray.h.
static int
RELATION_OP_GREATER_EQUAL
static int
RELATION_OP_GREATER_THAN
static int
RELATION_OP_LESS_EQUAL
static int
RELATION_OP_LESS_THAN
static int
RELATION_OP_NOT_EQUAL

Fields inherited from class gov.llnl.babel.symbols.AssertionExpression

ERROR_SEMANTIC_VALIDATION, d_context

Constructor Summary

MethodCall(String name, Context context)
Create a new object.

Method Summary

Object
accept(ExprVisitor ev, Object data)
void
addArgument(AssertionExpression arg)
Add the specified expression as an argument to the method call.
String
cExpression(String epvVar, int[] startInd)
Return the C version of the expression.
ArrayList
getArgumentReturnTypes(Method meth)
Return a list of argument return type values (Integer) that correspond to the Type class equivalents of the arguments associated with the specified method.
ArrayList
getArguments()
Return an ArrayList of argument expressions with each element as a AssertionExpression.
ArrayList
getArrayIterMacros(String epvVar, int[] startInd)
Return the list of array iteration macros, if any.
String
getMethodName()
Return the name of the method call.
int
getNumArrayIterMacrosByType(char type)
Returns the number of macros supported by this assertion of the specified type.
boolean
hasCompatibleArgumentTypes(ArrayList list)
Return TRUE if the specified argument type list is compatible with the arguments in this call; otherwise, return FALSE.
boolean
hasMethodCall()
Return TRUE if the expression is, or has, at least one method call; otherwise, return FALSE.
boolean
hasPure()
Return TRUE if the expression is, or has, PURE clause; otherwise, return FALSE.
boolean
hasReservedMethod(int type)
Return TRUE if the expression is, or has, the specified reserved method; otherwise, return FALSE.
boolean
hasResult()
Return TRUE if the expression contains RESULT; otherwise, return FALSE.
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.
boolean
isArrayMacroMethod()
Return TRUE if the method is one of the special array macro ones; otherwise, return FALSE.
boolean
isArrayMethod()
Return TRUE if the method is one of the special array ones; otherwise, return FALSE.
boolean
isBuiltinNumericArrayMethod()
Return TRUE if the method is one of the special built-in ones whose array argument(s) must contain numeric values only.
boolean
isBuiltinRelationMethod()
Return TRUE if the method is one of the special built-in ones whose only argument should be a relation; otherwise, return FALSE.
boolean
isStatic()
Return TRUE if the (unreserved) method is static; 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.
boolean
throwsExceptions()
Return TRUE if the (unreserved) method throws exceptions; otherwise, return FALSE.
String
toString()
Return the stringified version of the expression (in SIDL form).
protected void
validateSemantics(Extendable ext, Method m)
Validate the expression semantics, if necessary, within the context of the extendable and optional method.

Methods inherited from class gov.llnl.babel.symbols.AssertionExpression

accept, cExpression, getArrayIterMacros, getExceptionPrefix, getExceptionPrefix, getNumArrayIterMacrosByType, getReturnType, getReturnTypeName, getReturnTypeValue, hasMethodCall, hasParens, hasPure, hasReservedMethod, hasResult, hasUnreservedMethod, isValid, leftAssociative, requiresExtendableContext, requiresMethodContext, returnIsArray, returnIsBoolean, returnIsCharacter, returnIsDComplex, returnIsDouble, returnIsFComplex, returnIsFloat, returnIsInteger, returnIsLong, returnIsNumericArray, returnIsOpaque, returnIsString, setParens, setReturnToBoolean, setReturnToCharacter, setReturnToDComplex, setReturnToDouble, setReturnToFComplex, setReturnToFloat, setReturnToInteger, setReturnToLong, setReturnToOpaque, setReturnToString, setReturnType, setReturnType, toString, validateExpression, validateSemantics

Field Details

ARRAY_BOOLEAN_RESULT_VAR

public static final String ARRAY_BOOLEAN_RESULT_VAR
Relevant public and private literals.

ARRAY_COUNT_VAR

public static final String ARRAY_COUNT_VAR

ARRAY_DOUBLE_RESULT_VAR

public static final String ARRAY_DOUBLE_RESULT_VAR

ARRAY_INTEGER_RESULT_VAR

public static final String ARRAY_INTEGER_RESULT_VAR

ARRAY_ITER_VAR

public static final String ARRAY_ITER_VAR

ARRAY_SIZE_VAR

public static final String ARRAY_SIZE_VAR

MACRO_RETURNS_BOOLEAN_IND

public static final int MACRO_RETURNS_BOOLEAN_IND
Field Value:
0

MACRO_RETURNS_DOUBLE_IND

public static final int MACRO_RETURNS_DOUBLE_IND
Field Value:
1

MACRO_RETURNS_INTEGER_IND

public static final int MACRO_RETURNS_INTEGER_IND
Field Value:
2

MACRO_RETURN_TYPE

public static final char[] MACRO_RETURN_TYPE

MAXIMUM_ARRAY_METHOD

public static final int MAXIMUM_ARRAY_METHOD
Field Value:
17

MAXIMUM_METHOD

public static final int MAXIMUM_METHOD
Field Value:
20

MAX_VALID_MACRO_RETURNS

public static final int MAX_VALID_MACRO_RETURNS
Field Value:
3

METHOD_ANY_ARRAY

public static final int METHOD_ANY_ARRAY
Field Value:
-3

METHOD_ANY_BUILTIN

public static final int METHOD_ANY_BUILTIN
Field Value:
-1

METHOD_ARRAY_ALL

public static final int METHOD_ARRAY_ALL
Field Value:
1

METHOD_ARRAY_ANY

public static final int METHOD_ARRAY_ANY
Field Value:
2

METHOD_ARRAY_COUNT

public static final int METHOD_ARRAY_COUNT
Field Value:
3

METHOD_ARRAY_DIMEN

public static final int METHOD_ARRAY_DIMEN
Field Value:
4

METHOD_ARRAY_IRANGE

public static final int METHOD_ARRAY_IRANGE
Field Value:
5

METHOD_ARRAY_LOWER

public static final int METHOD_ARRAY_LOWER
Field Value:
6

METHOD_ARRAY_MAX

public static final int METHOD_ARRAY_MAX
Field Value:
7

METHOD_ARRAY_MIN

public static final int METHOD_ARRAY_MIN
Field Value:
8

METHOD_ARRAY_NEAR_EQUAL

public static final int METHOD_ARRAY_NEAR_EQUAL
Field Value:
9

METHOD_ARRAY_NONE

public static final int METHOD_ARRAY_NONE
Field Value:
12

METHOD_ARRAY_NON_DECR

public static final int METHOD_ARRAY_NON_DECR
Field Value:
10

METHOD_ARRAY_NON_INCR

public static final int METHOD_ARRAY_NON_INCR
Field Value:
11

METHOD_ARRAY_RANGE

public static final int METHOD_ARRAY_RANGE
Field Value:
13

METHOD_ARRAY_SIZE

public static final int METHOD_ARRAY_SIZE
Field Value:
14

METHOD_ARRAY_STRIDE

public static final int METHOD_ARRAY_STRIDE
Field Value:
15

METHOD_ARRAY_SUM

public static final int METHOD_ARRAY_SUM
Field Value:
16

METHOD_ARRAY_UPPER

public static final int METHOD_ARRAY_UPPER
Field Value:
17

METHOD_IRANGE

public static final int METHOD_IRANGE
Field Value:
18

METHOD_NEAR_EQUAL

public static final int METHOD_NEAR_EQUAL
Field Value:
19

METHOD_NOT_RESERVED

public static final int METHOD_NOT_RESERVED
Field Value:
0

METHOD_NUMERIC_ARRAY

public static final int METHOD_NUMERIC_ARRAY
Field Value:
-2

METHOD_RANGE

public static final int METHOD_RANGE
Field Value:
20

METHOD_RELATION_BOTH

public static final int METHOD_RELATION_BOTH
Field Value:
3

METHOD_RELATION_LEFT

public static final int METHOD_RELATION_LEFT
Field Value:
1

METHOD_RELATION_NONE

public static final int METHOD_RELATION_NONE
Field Value:
0

METHOD_RELATION_RIGHT

public static final int METHOD_RELATION_RIGHT
Field Value:
2

MINIMUM_METHOD

public static final int MINIMUM_METHOD
Field Value:
1

RELATION_OP_EQUAL

public static final int RELATION_OP_EQUAL
WARNING: The following relation operators must correspond to those found in sidlArray.h.
Field Value:
0

RELATION_OP_GREATER_EQUAL

public static final int RELATION_OP_GREATER_EQUAL
Field Value:
5

RELATION_OP_GREATER_THAN

public static final int RELATION_OP_GREATER_THAN
Field Value:
4

RELATION_OP_LESS_EQUAL

public static final int RELATION_OP_LESS_EQUAL
Field Value:
3

RELATION_OP_LESS_THAN

public static final int RELATION_OP_LESS_THAN
Field Value:
2

RELATION_OP_NOT_EQUAL

public static final int RELATION_OP_NOT_EQUAL
Field Value:
1

Constructor Details

MethodCall

public MethodCall(String name,
                  Context context)
            throws AssertionException
Create a new object.
Parameters:
name - The name of the method that is to be called.
Throws:
AssertionException - The exception raised if error during any validation.

Method Details

accept

public Object accept(ExprVisitor ev,
                     Object data)
Overrides:
accept in interface AssertionExpression

addArgument

public void addArgument(AssertionExpression arg)
Add the specified expression as an argument to the method call.
Parameters:
arg - An assertion expression as an argument to the method call.

cExpression

public String cExpression(String epvVar,
                          int[] startInd)
Return the C version of the expression. WARNING: Changes to the code generated below must match the validations in the method that validates the semantics of the call.
Overrides:
cExpression in interface AssertionExpression

getArgumentReturnTypes

public ArrayList getArgumentReturnTypes(Method meth)
Return a list of argument return type values (Integer) that correspond to the Type class equivalents of the arguments associated with the specified method. Each element of the ArrayList is an Integer.

getArguments

public ArrayList getArguments()
Return an ArrayList of argument expressions with each element as a AssertionExpression.

getArrayIterMacros

public ArrayList getArrayIterMacros(String epvVar,
                                    int[] startInd)
Return the list of array iteration macros, if any. WARNING: Changes to the code generated below must match the validations in the method that validates the semantics of the call. ASSUMPTION: None of the standard arguments to these macros has a macro return type associated with it. That is, only the result that is appended to the macros has the relevant index!
Overrides:
getArrayIterMacros in interface AssertionExpression

getMethodName

public String getMethodName()
Return the name of the method call.

getNumArrayIterMacrosByType

public int getNumArrayIterMacrosByType(char type)
Returns the number of macros supported by this assertion of the specified type. Valid types are MACRO_RETURN*.
Overrides:
getNumArrayIterMacrosByType in interface AssertionExpression

hasCompatibleArgumentTypes

public boolean hasCompatibleArgumentTypes(ArrayList list)
            throws AssertionException
Return TRUE if the specified argument type list is compatible with the arguments in this call; otherwise, return FALSE.
Throws:
AssertionException - The exception is raised if there is a problem with any of the argument return types (e.g., return type not yet determined).

hasMethodCall

public boolean hasMethodCall()
Return TRUE if the expression is, or has, at least one method call; otherwise, return FALSE. In this case, this expression is a method call so it always returns TRUE. Note that this method assumes there is an associated method that is valid and is being invoked correctly.
Overrides:
hasMethodCall in interface AssertionExpression

hasPure

public boolean hasPure()
Return TRUE if the expression is, or has, PURE clause; otherwise, return FALSE. In this case, a PURE clause that shows up within the method call would be a semantic error so FALSE is always returned.
Overrides:
hasPure in interface AssertionExpression

hasReservedMethod

public boolean hasReservedMethod(int type)
Return TRUE if the expression is, or has, the specified reserved method; otherwise, return FALSE. To facilitate checking, the following options for type can also be used to check if the method is one of many: METHOD_ANY_BUILTIN TRUE for any reserved method METHOD_NUMERIC_ARRAY TRUE for any reserved, numeric array method METHOD_ANY_ARRAY TRUE for any reserved array method
Overrides:
hasReservedMethod in interface AssertionExpression

hasResult

public boolean hasResult()
Return TRUE if the expression contains RESULT; otherwise, return FALSE.
Overrides:
hasResult in interface AssertionExpression

hasUnreservedMethod

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

isArrayMacroMethod

public boolean isArrayMacroMethod()
Return TRUE if the method is one of the special array macro ones; otherwise, return FALSE.

isArrayMethod

public boolean isArrayMethod()
Return TRUE if the method is one of the special array ones; otherwise, return FALSE.

isBuiltinNumericArrayMethod

public boolean isBuiltinNumericArrayMethod()
Return TRUE if the method is one of the special built-in ones whose array argument(s) must contain numeric values only.

isBuiltinRelationMethod

public boolean isBuiltinRelationMethod()
Return TRUE if the method is one of the special built-in ones whose only argument should be a relation; otherwise, return FALSE.

isStatic

public boolean isStatic()
Return TRUE if the (unreserved) method is static; otherwise, return FALSE. WARNING: This is not known until _after_ the method has been validated!

requiresExtendableContext

public boolean requiresExtendableContext()
Return TRUE if extendable context is required to validate the expression; otherwise, return FALSE.
Overrides:
requiresExtendableContext in interface AssertionExpression

requiresMethodContext

public boolean requiresMethodContext()
Return TRUE if method context is required to validate the expression; otherwise, return FALSE. This is separate from and in addition to the extendable context.
Overrides:
requiresMethodContext in interface AssertionExpression

throwsExceptions

public boolean throwsExceptions()
Return TRUE if the (unreserved) method throws exceptions; otherwise, return FALSE. WARNING: This is not known until _after_ the method has been validated!

toString

public String toString()
Return the stringified version of the expression (in SIDL form).
Overrides:
toString in interface AssertionExpression

validateSemantics

protected void validateSemantics(Extendable ext,
                                 Method m)
            throws AssertionException
Validate the expression semantics, if necessary, within the context of the extendable and optional method. WARNING: Changes to the validations, such as number or type of arguments, must also be reflected in the method that generates the code.
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.