gov.llnl.babel.symbols
Class MethodCall

java.lang.Object
  extended by gov.llnl.babel.symbols.AssertionExpression
      extended by gov.llnl.babel.symbols.MethodCall

public class MethodCall
extends AssertionExpression


Field Summary
static java.lang.String ARRAY_BOOLEAN_RESULT_VAR
          Relevant public and private literals.
static java.lang.String ARRAY_COUNT_VAR
           
static java.lang.String ARRAY_DOUBLE_RESULT_VAR
           
static java.lang.String ARRAY_INTEGER_RESULT_VAR
           
static java.lang.String ARRAY_ITER_VAR
           
static java.lang.String ARRAY_SIZE_VAR
           
static char[] MACRO_RETURN_TYPE
           
static int MACRO_RETURNS_BOOLEAN_IND
           
static int MACRO_RETURNS_DOUBLE_IND
           
static int MACRO_RETURNS_INTEGER_IND
           
static int MAX_VALID_MACRO_RETURNS
           
static int MAXIMUM_ARRAY_METHOD
           
static int MAXIMUM_METHOD
           
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_NON_DECR
           
static int METHOD_ARRAY_NON_INCR
           
static int METHOD_ARRAY_NONE
           
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_IS_USER_DEFINED
           
static int METHOD_NEAR_EQUAL
           
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
d_context, ERROR_SEMANTIC_VALIDATION
 
Constructor Summary
MethodCall(java.lang.String name, Context context)
          Create a new object.
 
Method Summary
 java.lang.Object accept(ExprVisitor ev, java.lang.Object data)
          Implement the "visitor pattern".
 void addArgument(AssertionExpression arg)
          Add the specified expression as an argument to the method call.
 java.lang.String cExpression(java.lang.String epvVar, int[] startInd)
          Return the C version of the expression.
 java.util.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.
 java.util.ArrayList getArguments()
          Return an ArrayList of argument expressions with each element as a AssertionExpression.
 java.util.ArrayList getArrayIterMacros(java.lang.String epvVar, int[] startInd)
          Return the list of array iteration macros, if any.
 int getDefaultComplexity()
          Return the default complexity of the expression (0 = constant, 1 = linear, etc.).
 java.lang.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 hasBuiltinMethod(int type)
          Return TRUE if the expression is, or has, the specified built-in method; otherwise, return FALSE.
 boolean hasCompatibleArgumentTypes(java.util.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 hasResult()
          Return TRUE if the expression contains RESULT; 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 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 user-defined 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 user-defined method throws exceptions; otherwise, return FALSE.
 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, if necessary, within the context of the extendable and optional method.
 
Methods inherited from class gov.llnl.babel.symbols.AssertionExpression
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ARRAY_BOOLEAN_RESULT_VAR

public static final java.lang.String ARRAY_BOOLEAN_RESULT_VAR
Relevant public and private literals.

See Also:
Constant Field Values

ARRAY_COUNT_VAR

public static final java.lang.String ARRAY_COUNT_VAR
See Also:
Constant Field Values

ARRAY_DOUBLE_RESULT_VAR

public static final java.lang.String ARRAY_DOUBLE_RESULT_VAR
See Also:
Constant Field Values

ARRAY_INTEGER_RESULT_VAR

public static final java.lang.String ARRAY_INTEGER_RESULT_VAR
See Also:
Constant Field Values

ARRAY_ITER_VAR

public static final java.lang.String ARRAY_ITER_VAR
See Also:
Constant Field Values

ARRAY_SIZE_VAR

public static final java.lang.String ARRAY_SIZE_VAR
See Also:
Constant Field Values

MACRO_RETURN_TYPE

public static final char[] MACRO_RETURN_TYPE

MACRO_RETURNS_BOOLEAN_IND

public static final int MACRO_RETURNS_BOOLEAN_IND
See Also:
Constant Field Values

MACRO_RETURNS_DOUBLE_IND

public static final int MACRO_RETURNS_DOUBLE_IND
See Also:
Constant Field Values

MACRO_RETURNS_INTEGER_IND

public static final int MACRO_RETURNS_INTEGER_IND
See Also:
Constant Field Values

MAX_VALID_MACRO_RETURNS

public static final int MAX_VALID_MACRO_RETURNS
See Also:
Constant Field Values

METHOD_ANY_ARRAY

public static final int METHOD_ANY_ARRAY
See Also:
Constant Field Values

METHOD_NUMERIC_ARRAY

public static final int METHOD_NUMERIC_ARRAY
See Also:
Constant Field Values

METHOD_ANY_BUILTIN

public static final int METHOD_ANY_BUILTIN
See Also:
Constant Field Values

METHOD_IS_USER_DEFINED

public static final int METHOD_IS_USER_DEFINED
See Also:
Constant Field Values

METHOD_ARRAY_ALL

public static final int METHOD_ARRAY_ALL
See Also:
Constant Field Values

METHOD_ARRAY_ANY

public static final int METHOD_ARRAY_ANY
See Also:
Constant Field Values

METHOD_ARRAY_COUNT

public static final int METHOD_ARRAY_COUNT
See Also:
Constant Field Values

METHOD_ARRAY_DIMEN

public static final int METHOD_ARRAY_DIMEN
See Also:
Constant Field Values

METHOD_ARRAY_IRANGE

public static final int METHOD_ARRAY_IRANGE
See Also:
Constant Field Values

METHOD_ARRAY_LOWER

public static final int METHOD_ARRAY_LOWER
See Also:
Constant Field Values

METHOD_ARRAY_MAX

public static final int METHOD_ARRAY_MAX
See Also:
Constant Field Values

METHOD_ARRAY_MIN

public static final int METHOD_ARRAY_MIN
See Also:
Constant Field Values

METHOD_ARRAY_NEAR_EQUAL

public static final int METHOD_ARRAY_NEAR_EQUAL
See Also:
Constant Field Values

METHOD_ARRAY_NON_DECR

public static final int METHOD_ARRAY_NON_DECR
See Also:
Constant Field Values

METHOD_ARRAY_NON_INCR

public static final int METHOD_ARRAY_NON_INCR
See Also:
Constant Field Values

METHOD_ARRAY_NONE

public static final int METHOD_ARRAY_NONE
See Also:
Constant Field Values

METHOD_ARRAY_RANGE

public static final int METHOD_ARRAY_RANGE
See Also:
Constant Field Values

METHOD_ARRAY_SIZE

public static final int METHOD_ARRAY_SIZE
See Also:
Constant Field Values

METHOD_ARRAY_STRIDE

public static final int METHOD_ARRAY_STRIDE
See Also:
Constant Field Values

METHOD_ARRAY_SUM

public static final int METHOD_ARRAY_SUM
See Also:
Constant Field Values

METHOD_ARRAY_UPPER

public static final int METHOD_ARRAY_UPPER
See Also:
Constant Field Values

METHOD_IRANGE

public static final int METHOD_IRANGE
See Also:
Constant Field Values

METHOD_NEAR_EQUAL

public static final int METHOD_NEAR_EQUAL
See Also:
Constant Field Values

METHOD_RANGE

public static final int METHOD_RANGE
See Also:
Constant Field Values

MINIMUM_METHOD

public static final int MINIMUM_METHOD
See Also:
Constant Field Values

MAXIMUM_ARRAY_METHOD

public static final int MAXIMUM_ARRAY_METHOD
See Also:
Constant Field Values

MAXIMUM_METHOD

public static final int MAXIMUM_METHOD
See Also:
Constant Field Values

METHOD_RELATION_NONE

public static final int METHOD_RELATION_NONE
See Also:
Constant Field Values

METHOD_RELATION_LEFT

public static final int METHOD_RELATION_LEFT
See Also:
Constant Field Values

METHOD_RELATION_RIGHT

public static final int METHOD_RELATION_RIGHT
See Also:
Constant Field Values

METHOD_RELATION_BOTH

public static final int METHOD_RELATION_BOTH
See Also:
Constant Field Values

RELATION_OP_EQUAL

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

See Also:
Constant Field Values

RELATION_OP_NOT_EQUAL

public static final int RELATION_OP_NOT_EQUAL
See Also:
Constant Field Values

RELATION_OP_LESS_THAN

public static final int RELATION_OP_LESS_THAN
See Also:
Constant Field Values

RELATION_OP_LESS_EQUAL

public static final int RELATION_OP_LESS_EQUAL
See Also:
Constant Field Values

RELATION_OP_GREATER_THAN

public static final int RELATION_OP_GREATER_THAN
See Also:
Constant Field Values

RELATION_OP_GREATER_EQUAL

public static final int RELATION_OP_GREATER_EQUAL
See Also:
Constant Field Values
Constructor Detail

MethodCall

public MethodCall(java.lang.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 Detail

getMethodName

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


isStatic

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


throwsExceptions

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


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.

getArguments

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


isArrayMethod

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


isArrayMacroMethod

public boolean isArrayMacroMethod()
Return TRUE if the method is one of the special array macro 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.


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.

Specified by:
hasPure in class AssertionExpression

hasResult

public boolean hasResult()
Return TRUE if the expression contains RESULT; otherwise, return FALSE.

Specified by:
hasResult in class AssertionExpression

hasResultOrArg

public boolean hasResultOrArg()
Return TRUE if a result clause or method argument is found within the expression; otherwise, return FALSE.

Specified by:
hasResultOrArg in class AssertionExpression

hasResultOrOutArg

public boolean hasResultOrOutArg(boolean outOnly)
Return TRUE if a result clause or output argument is found within the expression; otherwise, return FALSE.

Specified by:
hasResultOrOutArg in class AssertionExpression
Parameters:
outOnly - TRUE if only concerned with output arguments that are out only; FALSE otherwise.

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.

Specified by:
hasMethodCall in class AssertionExpression

getDefaultComplexity

public int getDefaultComplexity()
Return the default complexity of the expression (0 = constant, 1 = linear, etc.).

Specified by:
getDefaultComplexity in class AssertionExpression

hasBuiltinMethod

public boolean hasBuiltinMethod(int type)
Return TRUE if the expression is, or has, the specified built-in 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 built-in method METHOD_NUMERIC_ARRAY TRUE for any built-in, numeric array method METHOD_ANY_ARRAY TRUE for any built-in array method

Specified by:
hasBuiltinMethod in class AssertionExpression

hasUserDefinedMethod

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

Specified by:
hasUserDefinedMethod in class AssertionExpression

requiresExtendableContext

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

Specified by:
requiresExtendableContext in class 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.

Specified by:
requiresMethodContext in class AssertionExpression

getArgumentReturnTypes

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


hasCompatibleArgumentTypes

public boolean hasCompatibleArgumentTypes(java.util.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).

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.

Specified by:
validateSemantics in class 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.

toString

public java.lang.String toString()
Return the stringified version of the expression (in SIDL form).

Specified by:
toString in class AssertionExpression

getArrayIterMacros

public java.util.ArrayList getArrayIterMacros(java.lang.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!

Specified by:
getArrayIterMacros in class AssertionExpression

getNumArrayIterMacrosByType

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

Specified by:
getNumArrayIterMacrosByType in class AssertionExpression

cExpression

public java.lang.String cExpression(java.lang.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.

Specified by:
cExpression in class AssertionExpression

accept

public java.lang.Object accept(ExprVisitor ev,
                               java.lang.Object data)
Description copied from class: AssertionExpression
Implement the "visitor pattern".

Specified by:
accept in class AssertionExpression