gov.llnl.babel.symbols
Class Argument

java.lang.Object
  extended by gov.llnl.babel.symbols.ASTNode
      extended by gov.llnl.babel.symbols.Argument
All Implemented Interfaces:
Attributes, java.lang.Cloneable

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, java.lang.String name)
          Create an argument object.
 
Method Summary
 boolean equals(java.lang.Object object)
          Return TRUE if the specified object is considered the same as this object; otherwise, return FALSE.
 void freeze()
           
static java.lang.String[] getAllowableModes()
           
 java.lang.String getArgumentString()
          Return a string representation of the argument for outputting the arguments in a method signature, for example.
 java.lang.String getArgumentString(java.lang.String abbrev_pkg)
          Return a string representation of the argument for outputting the arguments in a method signature, for example.
 java.lang.String getAttribute(java.lang.String key)
           
 java.util.Set getAttributes()
           
 Comment getComment()
          Return the comment for the method.
 java.lang.String getFormalName()
          Return the formal name of the parameter identifier.
 int getMode()
          Return the value of the argument parameter passing mode.
 java.lang.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(java.lang.String key)
           
 int hashCode()
           
 boolean isCopy()
          Return TRUE if the copy flag has been set for this method argument; otherwise, return FALSE.
 void removeAttribute(java.lang.String key)
           
 void setAttribute(java.lang.String key)
           
 void setAttribute(java.lang.String key, java.lang.String value)
           
 void setComment(Comment comment)
          Set the comment for the method.
 boolean similar(Argument arg)
          This method returns true if two arguments map are similar enough to cause a problem for overloaded functions.
 
Methods inherited from class gov.llnl.babel.symbols.ASTNode
checkFrozen, clone, protectCollection, protectList, protectMap, protectSet
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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

Argument

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

Parameters:
copy - The copy flag.
mode - The parameter passing mode (IN, OUT, or INOUT).
type - The SIDL type of the argument.
name - The formal parameter name.
Method Detail

isCopy

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


getMode

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


getAllowableModes

public static java.lang.String[] getAllowableModes()

getModeString

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


getFormalName

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


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.


getArgumentString

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


getArgumentString

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


hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.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.

Overrides:
equals in class java.lang.Object
Parameters:
object - The object being used for comparison.

similar

public boolean similar(Argument arg)
This method returns true if two arguments map are similar enough to cause a problem for overloaded functions.


setComment

public void setComment(Comment comment)
Set the comment for the method.

Parameters:
comment - The comment associated with the method. May be null.

getComment

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


hasAttribute

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

getAttribute

public java.lang.String getAttribute(java.lang.String key)
                              throws UnknownAttributeException
Specified by:
getAttribute in interface Attributes
Throws:
UnknownAttributeException

setAttribute

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

setAttribute

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

removeAttribute

public void removeAttribute(java.lang.String key)
                     throws UnknownAttributeException
Specified by:
removeAttribute in interface Attributes
Throws:
UnknownAttributeException

getAttributes

public java.util.Set getAttributes()
Specified by:
getAttributes in interface Attributes

freeze

public void freeze()
Overrides:
freeze in class ASTNode