Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
gov.llnl.babel.symbols.ASTNode
gov.llnl.babel.symbols.Method
Method
class defines a SIDL method, including modifiers,
return type, name, arguments, and exceptions. Methods may have one of
three definition modifiers: final, static, or abstract. They may also
have one of two communication modifiers: local or oneway. The return type
is either a type or null (which indicates void). The method name is a
simple identifier string. The optional arguments are an ordered collecton
or arguments. The method may throw any number of exceptions.
Nested Class Summary | |
class |
Field Summary | |
static int | |
static int | |
static int | |
static int | |
static int | |
static int | |
static int | |
static int | |
static int | |
static String[] | |
static String[] |
Constructor Summary | |
Method Summary | |
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void | |
Method |
|
boolean |
|
void |
|
Argument |
|
List |
|
List |
|
List |
|
int |
|
Type |
|
String |
|
Set | |
Set |
|
String |
|
Comment |
|
int |
|
String |
|
String |
|
int |
|
String |
|
Set |
|
Set |
|
String |
|
int |
|
Metadata |
|
String |
|
List |
|
List |
|
Set |
|
Map |
|
Type |
|
String |
|
String |
|
String |
|
String |
|
String |
|
ArrayList |
|
ArrayList |
|
Set |
|
Set |
|
Set |
|
boolean |
|
boolean |
|
boolean | |
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
int |
|
boolean |
|
boolean |
|
boolean |
|
boolean | |
boolean |
|
boolean |
|
int |
|
void |
|
boolean |
|
boolean |
|
boolean |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
Method |
|
Method |
|
Method | |
Method |
|
Method | |
Method |
|
Methods inherited from class gov.llnl.babel.symbols.ASTNode | |
checkFrozen , clone , freeze , protectCollection , protectList , protectMap , protectSet |
public static final int ABSTRACT
- Field Value:
- 1
public static final int FINAL
- Field Value:
- 2
public static final int LOCAL
- Field Value:
- 1
public static final int NONBLOCKING
- Field Value:
- 3
public static final int NONBLOCKING_RECV
- Field Value:
- 5
public static final int NONBLOCKING_SEND
- Field Value:
- 4
public static final int NORMAL
- Field Value:
- 0
public static final int ONEWAY
- Field Value:
- 2
public static final int STATIC
- Field Value:
- 3
public static final String[] s_comm_mod
public static final String[] s_def_mod
public Method(Context context)
Create an emptyMethod
object that will be built by calls to other member functions.
public void addArgument(Argument arg)
Add another argument to the end of the list of method arguments.
- Parameters:
arg
- The argument to be appended to the object's argument list
public void addAssertion(Assertion assertion) throws AssertionException
Add the specified assertion to the proper assertion list for this method.
- Parameters:
assertion
- The assertion to be added.
- Throws:
AssertionException
- The exception thrown if the assertion is not valid.
public void addImplicitThrows(SymbolID id)
Add a symbol identifier to the list of exceptions thrown, but do not treat it as an explicit throw.
public void addMetadata(String keyword, String value)
Add a (keyword, value) pair to the metadata for this object.
- Specified by:
- addMetadata in interface IMetadata
public void addRarrayIndex(Collection new_indices)
add a set of required rarray indices to the set of indices
public void addRarrayIndex(String s)
add a required rarray index to the set of indices
public void addSplicerContents(String location, String name, String impl)
Add the specified contents to the splicer block identified by the location and name.
public void addThrows(SymbolID id)
Add a symbol identifier to the list of explicit supported exceptions for this method. No error checking is performed to ensure that the specified symbol is valid in the throws clause; such checking must be performed by the parser. An explicit exception is one that is listed in the SIDL file rather than the implicit runtime exception.
- Parameters:
id
- The symbol identifier to be added
public Method cloneMethod()
Return a shallow copy of this method object. This method should never fail since this method is cloneable. Send in the clones.
public boolean equals(Object o)
public Argument getArgumentByName(String s)
Return an the argument whose formal name matches the passed in string. Return null if the string does not match anything.
public List getArgumentList()
Return the array of arguments in anArrayList
, where each element is anArgument
.
public List getArgumentListWithIndices()
Return the array of arguments in anArrayList
container. This returns all the arguments in the argument list, including those that are indices to an Rarray.
public List getArgumentListWithOutIndices()
Return the array of arguments in anArrayList
container. This method returns only arguments that are not used as indices to an Rarray
public int getArgumentMode(String name)
Return the mode of the argument with the specified formal name, if any; otherwise, return -1.
- Parameters:
name
- The formal argument name whose type is to be returned.
public Type getArgumentType(String name)
Return theType
of the argument with the specified formal name, if any; otherwise, return null.
- Parameters:
name
- The formal argument name whose type is to be returned.
public Set getBasicArrays()
Return theSet
of basic array references including arrays of fundamental types such as double, int, etc. Each element of the set is aSymbolID
.
public String getBlockingMethodName()
Return the nonblocking method name (if NONBLOCKING), else return long name
public Comment getComment()
Return the comment for the method. This may be null if there is no comment.
public int getCommunicationModifier()
Return the communication modifier for this method.
public String getCommunicationModifierString()
Return the communication modifier string for this method.
public String getCorrectMethodName()
This method is used for language bindings that support overloading. For most methods it will return the short name, but if the method requires the long name for some reason determinable inside the method class, the long name is returned. For example, nonblocking send and receive always use the long method name.
public int getDefinitionModifier()
Return the definition modifier for the method.
public String getDefinitionModifier(boolean is_interface)
Return the explicit definition modifier string for the method based on the type of extendable in which it belongs.
- Parameters:
is_interface
- If TRUE, then the extendable is an interface so do NOT include ABSTRACT since it is implicit.
- Returns:
- the string associated with the explicit definition modifier
public Set getExplicitThrows()
Return theSet
of explicit exceptions that may be thrown by this method. Each element of the set is aSymbolID
.
public Set getImplicitThrows()
Return theSet
of implicit exceptions that may be thrown by this method. Each element of the set is aSymbolID
.
public String getLongMethodName()
Return the long method name (a standard SIDL identifier).
public int getMaxArrayIterMacros(char type)
Return the number of array iteration macros in the assertions of the method of the specified return type. Valid types are given in MethodCall.java as MACRO_RETURNS_* values.
public Metadata getMetadata()
Return the metadata associated with this object.
- Specified by:
- getMetadata in interface IMetadata
public String getNameExtension()
Return the method name extension (a standard SIDL identifier).
public List getPostconditions()
Return the list of postconditions as anArrayList
ofAssertion
elements.
public List getPreconditions()
Return the list of preconditions as anArrayList
ofAssertion
elements.
public Set getRarrayIndices()
Return the set of rarray indices required in the arg list. (Returns null if there are no indices required)
public Map getRarrayInfo()
This returns an array list of RarrayInfo objects that contains the info for every rarray index used in this method.
public Type getReturnType()
Return the return type for the method or throw NullPointerException
public String getReturnType(String parent_pkg)
Return the string corresponding to the return type for this method. Note the string may represent an abbreviated return type (i.e., a type stripped of its package information).
- Parameters:
parent_pkg
- The string containing the parent package. When not null, it is used to strip the package from the return string if it is in the specified package.
- Returns:
- the string containing the possibly abbreviated return type.
public String getShortMethodName()
Return the short method name (a standard SIDL identifier).
public String getSignature()
Return the signature of the method. The signature does not include the attributes abstract, final, or static. It also does not abbreviate package names.
public String getSignature(boolean is_interface, String parent_pkg)
Return the signature of the method, including the definition modifier based on the extendable type. Also, optionally abbreviate type if in specified package.
- Parameters:
is_interface
- TRUE if interface and want the implicit definition modifier excluded from the result; otherwise, FALSEparent_pkg
- The string containing the parent package. When not null, it is used to strip the package from the return string if it is in the specified package.
- Returns:
- The string containing the full signature.
public String getSignaturePreface(boolean is_interface, String parent_pkg)
Return the concatenation of the explicit definition modifier, copy, return type, name and extension.
- Parameters:
is_interface
- TRUE if an interface and want the implicit definition modifier excluded from the result; otherwise, FALSE.parent_pkg
- The string containing the parent package. When not null, it is used to strip the package from the return string if it is in the specified package.
- Returns:
- the string containing the preface
public ArrayList getSplicerBlocks(String location)
Return splicer blocks for the specified location.
public ArrayList getSplicerContents(String location, String name)
Return splicer contents for the specified location and splicer name.
public Set getSymbolReferences()
Return theSet
of symbols referred to by this method. Each element of the set is aSymbolID
.
public Set getSymbolReferencesWithoutExceptions()
Return theSet
of symbols referred to by this method, except for the exceptions it throws. Each element of the set is aSymbolID
.
public Set getThrows()
Return theSet
of exceptions that may be thrown by this method. Each element of the set is aSymbolID
.
public boolean hasArrayOrderSpec()
Return TRUE if and only if at least one argument of this method is an array with an ordering specification. For example, calling this on methods without array arguments will return FALSE while calling it on something likevoid doIt(in array<int, 2, row-major> x);
will return TRUE.
public boolean hasAttribute(String key)
- Specified by:
- hasAttribute in interface Attributes
public boolean hasExplicitExceptions()
public boolean hasPureAssertion()
Return TRUE if PURE clause appears in the assertions associated with this method; otherwise, return FALSE.
public boolean hasRarray()
Returns true if this method has an rarray in it's signature
public boolean hasReservedMethodAssertion(List list, int type)
Return TRUE if the list of assertions has the specified reserved method assertion; FALSE otherwise.
public boolean hasReservedMethodAssertion(int type)
Return TRUE if the method has the specified reserved method assertion; FALSE otherwise.
public boolean hasUnreservedMethodAssertion(List list, boolean any)
Return TRUE if the list of assertions has the type of unreserved method assertion; FALSE otherwise.
public boolean hasUnreservedMethodAssertion(boolean any)
Return TRUE if the method has any unreserved method (when any is TRUE) assertion or has an unreserved method assertion with a throws clause (if any is FALSE); otherwise, return FALSE.
public int hashCode()
public boolean isAbstract()
Return TRUE if the method is abstract; otherwise, return FALSE.
public boolean isBuiltIn()
Return the built-in attribute for the method.
public boolean isFinal()
Return TRUE if the method is final; otherwise, return FALSE.
public boolean isReturnCopy()
Return the copy mode for the return type.
public boolean isStatic()
Return TRUE if the method is static; otherwise, return FALSE.
public int numRarray()
Returns the number of rarray arguments in the method's argument list.
public void removeAttribute(String key) throws UnknownAttributeException
- Specified by:
- removeAttribute in interface Attributes
public boolean sameBaseSignature(Method m)
Return TRUE if the base signature of the specified method matches that of this method; otherwise, return FALSE. For them to match, the methods must have the same short and the same arguments.
- Parameters:
m
- The method whose base signature is being compared.
public boolean sameSignature(Method m)
Return TRUE if the signature of the specified method matches that of this method; otherwise, return FALSE. For signatures to match, the methods must have the same return types and mode, the same names, the same arguments, and the same throws clauses. They must also have the same communication modifiers. The signature does not include modifiers static, abstract, or final.
- Parameters:
m
- The method whose signature is being compared with.
public boolean sameSignature(Method m, boolean compExt)
Return TRUE if the signature of the specified method matches that of this method; otherwise, return FALSE. For signatures to match, the methods must have the same return types and mode, the same names, the same arguments, and the same throws clauses. They must also have the same communication modifiers. The signature does not include modifiers static, abstract, or final.
- Parameters:
m
- The method whose signature is being compared with.compExt
- True if the comparision should compare method extensions. (False for from clauses)
public void setAttribute(String key, String value)
- Specified by:
- setAttribute in interface Attributes
public void setBuiltIn(boolean is_builtin)
Set the built-in attribute.
- Parameters:
is_builtin
- TRUE if the method is/should be built-in; otherwise, false.
public void setComment(Comment comment)
Set the comment for the method.
- Parameters:
comment
- The comment associated with the method. May be null.
public void setCommunicationModifier(int modifier)
Set the communication modifier for the method.
- Parameters:
modifier
- The method's communication modifier. Valid values are NORMAL, LOCAL, and ONEWAY.
public void setDefinitionModifier(int modifier)
Set the definition modifier for the method.
- Parameters:
modifier
- The method's definnition modifier. Valid values are NORMAL, ABSTRACT, FINAL, and STATIC.
public void setMethodName(String shortName)
Set the names of the method (a standard SIDL identifier). Use of this method will result in the long and short name being identical.
- Parameters:
shortName
- The short name of the method
public void setMethodName(String shortName, String extension)
Set the names of the method (a standard SIDL identifier).
- Parameters:
shortName
- The short name of the methodextension
- The method name extension used in combination with the short name to uniquely identify this method
public void setReturnCopy(boolean copy)
Set the copy mode for the return type.
- Parameters:
copy
- If TRUE then the return interface/class is to be copied to the caller; otherwise, it is not.
public void setReturnType(Type type)
Set the return type for the method.
- Parameters:
type
- The return type to be used. Note that a void return type must be represented by aType.VOID
NOT a null Type reference.
public Method spawnNonblockingRecv() throws CodeGenerationException
Create the non-blocking recv variant iff method is nonblocking
- Returns:
- new Method or null;
- See Also:
spawnNonblockingSend()
public Method spawnNonblockingSend() throws CodeGenerationException
Create the non-blocking send variant iff method is nonblocking
- Returns:
- new Method or null;
- See Also:
spawnNonblockingRecv()
public Method spawnPostHook(boolean useCReturn, boolean without) throws CodeGenerationException
Create the post hook variant iff hooks are turned on. The return argument is always converted to an in argument
- Parameters:
useCReturn
- if true, uses the return name given in C.java. If false, uses the Fortran variant namewithout
- If false, all out and inout args are converted to in args only. If true, inouts and outs remain such.
- Returns:
- new Method or null;
- See Also:
spawnNonblockingRecv()
public Method spawnPreHook(boolean withinout) throws CodeGenerationException
Create the pre hook variant iff hooks are turned on. Always filters out the return value and the out args
- Parameters:
withinout
- If false, all in and inout args are converted to in args only. If true, inouts remain inout. out args are always removed.
- Returns:
- new Method or null;
- See Also:
spawnNonblockingRecv()