gov.llnl.babel.symbols
Class IdentifierLiteral

java.lang.Object
  extended by gov.llnl.babel.symbols.AssertionExpression
      extended by gov.llnl.babel.symbols.Literal
          extended by gov.llnl.babel.symbols.IdentifierLiteral

public class IdentifierLiteral
extends Literal


Field Summary
static int ARGUMENT
           
static int IN
           
static int INOUT
           
static int NULL
           
static int OUT
           
static int PURE
           
static int RESULT
           
 
Fields inherited from class gov.llnl.babel.symbols.AssertionExpression
d_context, ERROR_SEMANTIC_VALIDATION
 
Constructor Summary
IdentifierLiteral(java.lang.String id, Context context)
          Construct a new object.
 
Method Summary
 java.lang.Object accept(ExprVisitor ev, java.lang.Object data)
          Implement the "visitor pattern".
 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 getIdentifier()
          Return the identifier.
 int getIdentifierType()
          Return the identifier type.
 java.lang.String getIdentifierTypeName()
          Return the name of the identifier type.
 int getNumArrayIterMacrosByType(char type)
          Returns the number of macros supported by this assertion of the specified type.
 boolean hasMethodCall()
          Return TRUE if the expression has at least one method call; otherwise, return FALSE.
 boolean hasPure()
          Return TRUE if the expression is a PURE clause; otherwise, return FALSE.
 boolean hasReservedMethod(int type)
          Return TRUE if the expression is, or has, the specified reserved method call; 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 isArgument()
          Return TRUE if the identifier is ARGUMENT; otherwise, return FALSE.
 boolean isNull()
          Return TRUE if the identifier is NULL; otherwise, return FALSE.
 boolean isReserved()
          Return TRUE if the identifier is a reserved keyword; 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.
 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, returnIsDComplex, returnIsDouble, returnIsFComplex, returnIsFloat, returnIsInteger, returnIsLong, returnIsNumericArray, returnIsOpaque, returnIsString, setParens, setReturnToBoolean, setReturnToCharacter, setReturnToDComplex, setReturnToDouble, setReturnToFComplex, setReturnToFloat, setReturnToInteger, 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

ARGUMENT

public static final int ARGUMENT
See Also:
Constant Field Values

NULL

public static final int NULL
See Also:
Constant Field Values

PURE

public static final int PURE
See Also:
Constant Field Values

RESULT

public static final int RESULT
See Also:
Constant Field Values

IN

public static final int IN
See Also:
Constant Field Values

INOUT

public static final int INOUT
See Also:
Constant Field Values

OUT

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

IdentifierLiteral

public IdentifierLiteral(java.lang.String id,
                         Context context)
                  throws AssertionException
Construct a new object.

Parameters:
id - The string identifier.
Throws:
AssertionException - An exception that could be raised during any validation.
Method Detail

getIdentifier

public java.lang.String getIdentifier()
Return the identifier.


getIdentifierType

public int getIdentifierType()
Return the identifier type.


isNull

public boolean isNull()
Return TRUE if the identifier is NULL; otherwise, return FALSE.


isArgument

public boolean isArgument()
Return TRUE if the identifier is ARGUMENT; otherwise, return FALSE.


isReserved

public boolean isReserved()
Return TRUE if the identifier is a reserved keyword; otherwise, return FALSE.


getIdentifierTypeName

public java.lang.String getIdentifierTypeName()
Return the name of the identifier type. It is assumed the code for the type is valid since it is set internally in the constructor.


hasPure

public boolean hasPure()
Return TRUE if the expression is a PURE clause; otherwise, return FALSE. In this case, TRUE will be returned if the identifier is "pure".

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

hasMethodCall

public boolean hasMethodCall()
Return TRUE if the expression has at least one method call; otherwise, return FALSE. Since this is an identifier it cannot be a method call.

Specified by:
hasMethodCall in class AssertionExpression

hasReservedMethod

public boolean hasReservedMethod(int type)
Return TRUE if the expression is, or has, the specified reserved method call; otherwise, return FALSE.

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

Specified by:
hasUnreservedMethod 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

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. Assumptions: 1) If this is NULL, then it is associated either with a binary expression or a method call. In either case, it is assumed the corresponding expression container has already set the return type of this expression since there is no reasonable way to determine it here. 2) ARGUMENT is (the name of) an argument of the specified method that is supposed to be used in a method call. 3) RESULT is the return value associated with the specified method within the specified extendable.

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 raised if errors in any validation.

getArrayIterMacros

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

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 given in MethodCall.java.

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: This should NOT be invoked for special literals such as PURE because there is nothing to check, which means that the expression in the if-statement will be empty!

Specified by:
cExpression in class AssertionExpression

toString

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

Specified by:
toString in class AssertionExpression

accept

public java.lang.Object accept(ExprVisitor ev,
                               java.lang.Object data)
Implement the "visitor pattern".

Specified by:
accept in class AssertionExpression