gov.llnl.babel.symbols

Class Argument

Implemented Interfaces:
Attributes

public class Argument
extends ASTNode
implements Attributes

The Argument class defines a SIDL argument, which consists of a parameter passing mode (IN, INOUT, or OUT with an optional COPY), a type, and a formal parameter name.

Field Summary

static int
IN
static int
INOUT
static int
OUT

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

d_frozen

Constructor Summary

Argument(int mode, Type type, String name)
Create an argument object.

Method Summary

boolean
equals(Object object)
Return TRUE if the specified object is considered the same as this object; otherwise, return FALSE.
void
freeze()
static String[]
getAllowableModes()
String
getArgumentString()
Return a string representation of the argument for outputting the arguments in a method signature, for example.
String
getArgumentString(String abbrev_pkg)
Return a string representation of the argument for outputting the arguments in a method signature, for example.
String
getAttribute(String key)
Set
getAttributes()
Comment
getComment()
Return the comment for the method.
String
getFormalName()
Return the formal name of the parameter identifier.
int
getMode()
Return the value of the argument parameter passing mode.
String
getModeString()
Return a string representing the argument mode.
Type
getType()
Return the type of the argument.
boolean
hasArrayOrderSpec()
Return TRUE if the type of this argument is an array with an with an ordering specification.
boolean
hasAttribute(String key)
int
hashCode()
boolean
isCopy()
Return TRUE if the copy flag has been set for this method argument; otherwise, return FALSE.
void
removeAttribute(String key)
void
setAttribute(String key)
void
setAttribute(String key, String value)
void
setComment(Comment comment)
Set the comment for the method.

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

checkFrozen, clone, freeze, protectCollection, protectList, protectMap, protectSet

Field Details

IN

public static final int IN
Field Value:
0

INOUT

public static final int INOUT
Field Value:
1

OUT

public static final int OUT
Field Value:
2

Constructor Details

Argument

public Argument(int mode,
                Type type,
                String name)
Create an argument object.
Parameters:
mode - The parameter passing mode (IN, OUT, or INOUT).
type - The SIDL type of the argument.
name - The formal parameter name.

Method Details

equals

public boolean equals(Object object)
Return TRUE if the specified object is considered the same as this object; otherwise, return FALSE. Note that the formal name does not need to match for equality.
Parameters:
object - The object being used for comparison.

freeze

public void freeze()
Overrides:
freeze in interface ASTNode

getAllowableModes

public static String[] getAllowableModes()

getArgumentString

public String getArgumentString()
Return a string representation of the argument for outputting the arguments in a method signature, for example.

getArgumentString

public String getArgumentString(String abbrev_pkg)
Return a string representation of the argument for outputting the arguments in a method signature, for example. Optionally abbreviate the type if it is declared in the specified package.

getAttribute

public String getAttribute(String key)
            throws UnknownAttributeException
Specified by:
getAttribute in interface Attributes

getAttributes

public Set getAttributes()
Specified by:
getAttributes in interface Attributes

getComment

public Comment getComment()
Return the comment for the method. This may be null if there is no comment.

getFormalName

public String getFormalName()
Return the formal name of the parameter identifier.

getMode

public int getMode()
Return the value of the argument parameter passing mode.

getModeString

public final String getModeString()
Return a string representing the argument mode.

getType

public Type getType()
Return the type of the argument.

hasArrayOrderSpec

public boolean hasArrayOrderSpec()
Return TRUE if the type of this argument is an array with an with an ordering specification. For example, in array<int, 2, column-major> x would return TRUE. out array<int, 2> x would return FALSE because it does not have an ordering specification. Non-array arguments return FALSE.

hasAttribute

public boolean hasAttribute(String key)
Specified by:
hasAttribute in interface Attributes

hashCode

public int hashCode()

isCopy

public boolean isCopy()
Return TRUE if the copy flag has been set for this method argument; otherwise, return FALSE.

removeAttribute

public void removeAttribute(String key)
            throws UnknownAttributeException
Specified by:
removeAttribute in interface Attributes

setAttribute

public void setAttribute(String key)
Specified by:
setAttribute in interface Attributes

setAttribute

public void setAttribute(String key,
                         String value)
Specified by:
setAttribute in interface Attributes

setComment

public void setComment(Comment comment)
Set the comment for the method.
Parameters:
comment - The comment associated with the method. May be null.