gov.llnl.babel.symbols

Class FComplexLiteral


public class FComplexLiteral
extends Literal

Field Summary

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

ERROR_SEMANTIC_VALIDATION, d_context

Constructor Summary

FComplexLiteral(FloatLiteral r, FloatLiteral i, Context context)
Create a new object.
FComplexLiteral(LongLiteral r, LongLiteral i, Context context)
Create a new object.

Method Summary

Object
accept(ExprVisitor ev, Object data)
Implement the "visitor pattern".
String
cExpression(String epvVar, int[] startInd)
Return the C version of the expression.
ArrayList
getArrayIterMacros(String epvVar, int[] startInd)
Return the list of array iteration macro messages, if any.
String
getImaginaryImage()
Return the image of the imaginary part of the literal.
FloatLiteral
getImaginaryLiteral()
Return the literal of the imaginary part of the literal.
Float
getImaginaryValue()
Return the value of the imaginary part of the literal.
int
getNumArrayIterMacrosByType(char type)
Returns the number of macros supported by this assertion of the specified type.
String
getRealImage()
Return the image of the real part of the literal.
FloatLiteral
getRealLiteral()
Return the literal of the imaginary part of the literal.
Float
getRealValue()
Return the value of the real part of the literal.
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, 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
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.
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

Constructor Details

FComplexLiteral

public FComplexLiteral(FloatLiteral r,
                       FloatLiteral i,
                       Context context)
            throws AssertionException
Create a new object.
Parameters:
r - The real part of the number.
i - The imaginary part of the number.
Throws:
AssertionException - The exception raised if error in any validation.

FComplexLiteral

public FComplexLiteral(LongLiteral r,
                       LongLiteral i,
                       Context context)
            throws AssertionException
Create a new object.
Parameters:
r - The long real part of the number.
i - The long imaginary part of the number.
Throws:
AssertionException - The exception raised if error in any validation.

Method Details

accept

public Object accept(ExprVisitor ev,
                     Object data)
Implement the "visitor pattern".
Overrides:
accept in interface AssertionExpression

cExpression

public String cExpression(String epvVar,
                          int[] startInd)
Return the C version of the expression. ToDo...This is actually more involved if this is part of a unary or binary expression because the .real and .imaginary parts of a sidl_complex must be used instead of this. However, this should be okay for passing the literal to a method call.
Overrides:
cExpression in interface AssertionExpression

getArrayIterMacros

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

getImaginaryImage

public String getImaginaryImage()
Return the image of the imaginary part of the literal.

getImaginaryLiteral

public FloatLiteral getImaginaryLiteral()
Return the literal of the imaginary part of the literal.

getImaginaryValue

public Float getImaginaryValue()
Return the value of the imaginary part of the literal.

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.
Overrides:
getNumArrayIterMacrosByType in interface AssertionExpression

getRealImage

public String getRealImage()
Return the image of the real part of the literal.

getRealLiteral

public FloatLiteral getRealLiteral()
Return the literal of the imaginary part of the literal.

getRealValue

public Float getRealValue()
Return the value of the real part of the literal.

hasMethodCall

public boolean hasMethodCall()
Return TRUE if the expression is, or has, at least one method call; otherwise, return false.
Overrides:
hasMethodCall in interface AssertionExpression

hasPure

public boolean hasPure()
Return TRUE if the expression is, or has, a PURE clause; otherwise, return false.
Overrides:
hasPure in interface AssertionExpression

hasReservedMethod

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

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

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.
Overrides:
requiresMethodContext in interface AssertionExpression

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.
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 any validation.