gov.nasa.arc.brahms.common.data
Class Invocation

java.lang.Object
  extended by gov.nasa.arc.brahms.common.data.BrahmsObject
      extended by gov.nasa.arc.brahms.common.data.ModelElement
          extended by gov.nasa.arc.brahms.common.data.Invocation
All Implemented Interfaces:
IExpression, gov.nasa.arc.brahms.common.IConstants, java.io.Serializable
Direct Known Subclasses:
ConstructorInvocation, MethodInvocation

public abstract class Invocation
extends ModelElement
implements IExpression

Invocation is an abstract class that captures the common aspects of Java method invocations and constructor invocations

Version:
$Revision: 1.1 $ $Date: 2009/11/23 18:28:41 $ $Author: rnado $
Author:
Bob Nado
See Also:
Serialized Form

Field Summary
static org.apache.log4j.Logger LOGGER
          The logger used to log messages
 
Fields inherited from interface gov.nasa.arc.brahms.common.IConstants
ABORT, ACTIVECLASS, ACTIVECONCEPT, ACTIVEINSTANCE, AGENT, ANONYMOUS, ANYAGENT, AREA, AREADEF, ASSIGNED, ATTRIBUTE, BASEAREADEF, BASECLASS, BASECONCEPTUALCLASS, BASEGROUP, BASELIBRARY, BOOLEAN, BROADCAST, BUILDING, BYTE, CCLOCK, CDATE, CHAR, CITY, CLASS, CLOCK, COLLECTALL, COMMUNICATE, COMPLETE, COMPOSITE, COMPUTER, CONCEPT, CONCEPTUALCLASS, CONCEPTUALCONCEPT, CONCEPTUALOBJECT, CONTINUE, COPY, CREATEAGENT, CREATEAREA, CREATEOBJECT, current, CURRENT, DATAFRAME, DATE, DB, DETECTABLE, DIV, DOUBLE, EMAIL, EMPTY_STRING, END, ENDACTIVITY, ENTAGENT, EQ, EXCEPTION, EXPR, FACE2FACE, FACTFRAME, FALSE, FAX, FLOAT, FOREACH, FORONE, G2, GE, GEOGRAPHYCONCEPT, GESTURE, GET, GROUP, GT, IMPASSE, INT, INVALID, JAVA, JAVA_TYPE, KNOWN_MODIFIER, KNOWNVAL_MODIFIER, LE, LOCAL, LONG, LT, MAP, MINUS, MOD, MOVE, MULT, NE, NEW, NONE, NOT_MODIFIER, NOWORK, O, OA, OBJECT, ONTOLOGY, PAGER, PARAMETER, PATH, PHONE, PLUS, PRIMITIVE, PRIVATE, PROAGENT, PROTECTED, PRSAGENT, PUBLIC, PUT, RECEIVE, RELATION, sACTIVECLASS, sACTIVECONCEPT, sACTIVEINSTANCE, sAGENT, sARCHIVE, sAREA, sAREADEF, sBOOLEAN, sBYTE, sBYTECODEEXT, sCHAR, sCLASS, sCOMPUTER, sCONCEPT, sCONCEPTUALCLASS, sCONCEPTUALCONCEPT, sCONCEPTUALOBJECT, sCOPY, sCURRENT, sDETECTABLE, sDOUBLE, sEMAIL, sEND, SEND, sFACE2FACE, sFAX, sFILEEXT, sFLOAT, sGEOGRAPHYCONCEPT, sGROUP, SHORT, SIMAGENT, sINT, sJAVA_TYPE, sLONG, sMAP, sNEW, sNONE, sNOWORK, sOBJECT, SOURCECODE, sPAGER, sPARAMETER, sPATH, sPHONE, sPRIVATE, sPROJECTEXT, sPROTECTED, sPUBLIC, sSHORT, sSTART, sSTRING, sSYMBOL, START, STRING, sUNKNOWN, sVOID, SYMBOL, TRUE, UDT, UML, UNASSIGNED, UNDEFINED, unknown, UNKNOWN, UNKNOWN_MODIFIER, V, VARIABLE, VOID, WHENEVER, WORKFRAME, WORLD, XML
 
Constructor Summary
Invocation()
          Creates an empty instance of Invocation representing an abstract Java invocation
Invocation(java.lang.String file, int line)
          Creates an empty instance of Invocation representing an abstract Java invocation at a given line in a source file
 
Method Summary
 boolean addArgument(IExpression exp)
          Adds the specified expression to the list of argument expressions specified for this invocation.
 int getArgumentNumber()
          Return the number of arguments passed in the invocation
 java.util.List<IExpression> getArguments()
          Returns a list of all the argument expressions specified for this invocation.
 Type[] getBrahmsParameterTypes()
          Returns the array of Brahms parameter types for the constructor or method to be invoked
 ModelElement getOwner()
          Returns the 'owner' of this invocation.
 int getParameterNumber()
          Return the number of parameters derived from the method or constructor signature
 void getParameters(java.util.LinkedList ll)
          Adds to a supplied list all the parameters used in the expression.
 java.lang.Class<?>[] getParameterTypes()
          Returns the array of parameter types to be used to look up at runtime a suitable constructor or method for the invocation
 void getVariables(java.util.LinkedList ll)
          Adds to a supplied list all the variables used in the expression.
 boolean hasArguments()
          Returns whether this invocation has any argument expressions specified for the referenced method or constructor.
 boolean isVarArgs()
          Returns whether the constructor or method to be invoked takes a variable number of arguments
protected  void parseParameterTypes(java.lang.String typeDescriptors)
          Parses a type descriptor string that represents the types of the parameters of the constructor or method to be invoked.
 void setBrahmsParameterTypes(Type[] types)
          Sets the array of Brahms parameter types for the constructor or method to be invoked
 void setOwner(ModelElement owner)
          Sets the 'owner' of this invocation.
 void setParameterTypes(java.lang.Class<?>[] types)
          Sets the array of parameter types to be used to look up at runtime a suitable constructor or method for the invocation
 void setVarArgs(boolean varargs)
          Sets whether the constructor or method to be invoked takes a variable number of arguments
 
Methods inherited from class gov.nasa.arc.brahms.common.data.BrahmsObject
delete, export, getFile, getID, getLine, getSerialNumber, isBCC, isDynamic, isLoaded, isResolved, setBCC, setDynamic, setFile, setID, setID, setLine, setLoaded, setResolved, setSerialNumber
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.nasa.arc.brahms.common.data.IExpression
export, getCollectType, setCollectType
 

Field Detail

LOGGER

public static final org.apache.log4j.Logger LOGGER
The logger used to log messages

Constructor Detail

Invocation

public Invocation()
Creates an empty instance of Invocation representing an abstract Java invocation


Invocation

public Invocation(java.lang.String file,
                  int line)
Creates an empty instance of Invocation representing an abstract Java invocation at a given line in a source file

Parameters:
file - the file in which the Java invocation is specified
line - the line number in the file at which the Java invocation is specified
Method Detail

addArgument

public boolean addArgument(IExpression exp)
Adds the specified expression to the list of argument expressions specified for this invocation. The argument expression is evaluated and passed to the referenced method or constructor when the invocation is to be executed.

Parameters:
exp - the argument IExpression to be added
Returns:
true if the argument is successfully added, false otherwise
See Also:
IExpression

hasArguments

public boolean hasArguments()
Returns whether this invocation has any argument expressions specified for the referenced method or constructor.

Returns:
true if the invocation has argument expressions, false otherwise

getArgumentNumber

public int getArgumentNumber()
Return the number of arguments passed in the invocation

Returns:
int the number of arguments

getArguments

public java.util.List<IExpression> getArguments()
Returns a list of all the argument expressions specified for this invocation.

Returns:
List<IExpression> a list of argument expressions
See Also:
IExpression

setParameterTypes

public void setParameterTypes(java.lang.Class<?>[] types)
Sets the array of parameter types to be used to look up at runtime a suitable constructor or method for the invocation

Parameters:
types - an array of Class objects for the parameter types

getParameterTypes

public java.lang.Class<?>[] getParameterTypes()
Returns the array of parameter types to be used to look up at runtime a suitable constructor or method for the invocation

Returns:
Class<?>[] an array of Java Class objects for the parameter types

setBrahmsParameterTypes

public void setBrahmsParameterTypes(Type[] types)
Sets the array of Brahms parameter types for the constructor or method to be invoked

Parameters:
types - an array of Brahms Type objects for the parameter types

getBrahmsParameterTypes

public Type[] getBrahmsParameterTypes()
Returns the array of Brahms parameter types for the constructor or method to be invoked

Returns:
Type[] the array of Brahms Type objects for the parameter types

getParameterNumber

public int getParameterNumber()
Return the number of parameters derived from the method or constructor signature

Returns:
int the number of parameters

setVarArgs

public void setVarArgs(boolean varargs)
Sets whether the constructor or method to be invoked takes a variable number of arguments

Parameters:
varargs - true if the constructor or method takes a variable number of arguments, else false

isVarArgs

public boolean isVarArgs()
Returns whether the constructor or method to be invoked takes a variable number of arguments

Returns:
boolean true if the constructor or method takes a variable number of arguments, else false

setOwner

public void setOwner(ModelElement owner)
Sets the 'owner' of this invocation. The owner can either be a Workframe whose body contains a method invocation as a top-level step or an Assignment with the invocation as right-hand side

Parameters:
owner - the ModelElement in which the invocation is specified

getOwner

public ModelElement getOwner()
Returns the 'owner' of this invocation. The owner can either be a Workframe whose body contains a method invocation as a top-level step or an Assignment with the invocation as right-hand side

Returns:
ModelElement the owner of this invocation

parseParameterTypes

protected void parseParameterTypes(java.lang.String typeDescriptors)
Parses a type descriptor string that represents the types of the parameters of the constructor or method to be invoked. Sets both the Java Class array of parameter types and the Brahms Type array of Brahms parameter types

Parameters:
typeDescriptors - the String describing the parameter types

getVariables

public void getVariables(java.util.LinkedList ll)
Adds to a supplied list all the variables used in the expression. Adds nothing to the list if the expression contains no variables

Specified by:
getVariables in interface IExpression
Parameters:
ll - the LinkedList to which to add the variables used in the expression.

getParameters

public void getParameters(java.util.LinkedList ll)
Adds to a supplied list all the parameters used in the expression. Adds nothing to the list if the expression contains no parameters

Specified by:
getParameters in interface IExpression
Parameters:
ll - the LinkedList to which to add the parameters used in the operand.


Copyright © 1997-2012 All Rights Reserved.