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

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.NamedModelElement
              extended by gov.nasa.arc.brahms.common.data.ActivityRef
All Implemented Interfaces:
gov.nasa.arc.brahms.common.IConstants, java.io.Serializable

public class ActivityRef
extends NamedModelElement

An ActivityRef is a reference to an activity made in a workframe. When a workframe is executing its actions and finds an activity reference it will execute the activity referenced by the reference. It will pass the referenced activity the parameter values specified for the reference (if any). The use of activity references allows for the re-use of activities in multiple workframes.

Version:
$Revision: 1.1 $ $Date: 2007/10/10 14:12:09 $ $Author: rvhoof $
Author:
Ron van Hoof
See Also:
Serialized Form

Field Summary
 
Fields inherited from class gov.nasa.arc.brahms.common.data.NamedModelElement
NAME_PROPERTY
 
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
ActivityRef()
          Constructor, creates a new activity reference with no reference to an activity.
ActivityRef(java.lang.String name)
          Constructor, creates a new activity reference with the specified name.
ActivityRef(java.lang.String file, int line)
          Constructor, creates a new activity reference specified in the given file at the given line number.
ActivityRef(java.lang.String name, java.lang.String file, int line)
          Constructor, creates a new activity reference with the specified name and specified in the given file at the given line number.
 
Method Summary
 boolean addArgument(ParameterValue p)
          Adds the specified parameter value to the list of parameter values specified for this activity reference.
 IActivityCtx createContext()
          Deprecated. use createContext(Activity), you can no longer create a context for an activity reference due to the ability to override activities.
 IActivityCtx createContext(Activity activity)
          Creates a new context for this activity reference, actually creating a context for the specified activity referenced by this activity reference.
 void delete()
          Deletes this element from the model and removes all references to this element in other model elements.
 java.lang.String getActivityDescriptor()
          Returns the activity descriptor for the activity being referenced.
 ParameterValue getArgument(int index)
          Returns the ParameterValue at the specified zero-based index in the argument list.
 java.util.Enumeration getArguments()
          Returns a list of all the parameter values specified for this activity reference.
 boolean hasArguments()
          Returns whether this activity reference has any parameter values specified for the referenced activity.
 boolean removeArgument(ParameterValue p)
          Removes the specified parameter value from the list of parameter values specified for this activity reference.
 void setActivityDescriptor(java.lang.String descriptor)
          Sets the activity descriptor for the activity being referenced.
protected  void setID()
          Sets the unique identifier.
 void setOwner(BFrame frm)
          Sets the 'owner' of this activity reference.
 
Methods inherited from class gov.nasa.arc.brahms.common.data.NamedModelElement
getDisplayText, getFullyQualifiedName, getName, getOwner, setDisplayText, setFullyQualifiedName, setName, setOwner, toString
 
Methods inherited from class gov.nasa.arc.brahms.common.data.BrahmsObject
export, getFile, getID, getLine, getSerialNumber, isBCC, isDynamic, isLoaded, isResolved, setBCC, setDynamic, setFile, setID, setLine, setLoaded, setResolved, setSerialNumber
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ActivityRef

public ActivityRef()
Constructor, creates a new activity reference with no reference to an activity.


ActivityRef

public ActivityRef(java.lang.String name)
Constructor, creates a new activity reference with the specified name. The name should be the same as the activity referenced.

Parameters:
name - the name of the activity reference

ActivityRef

public ActivityRef(java.lang.String file,
                   int line)
Constructor, creates a new activity reference specified in the given file at the given line number.

Parameters:
file - the file in which the activity reference is specified
line - the line number in the file at which the activity reference is specified

ActivityRef

public ActivityRef(java.lang.String name,
                   java.lang.String file,
                   int line)
Constructor, creates a new activity reference with the specified name and specified in the given file at the given line number. The name should be the same as the activity referenced.

Parameters:
name - the name of the activity reference
file - the file in which the activity reference is specified
line - the line number in the file at which the activity reference is specified
Method Detail

setID

protected void setID()
Sets the unique identifier.

Overrides:
setID in class BrahmsObject

setActivityDescriptor

public void setActivityDescriptor(java.lang.String descriptor)
Sets the activity descriptor for the activity being referenced.

Parameters:
descriptor - the activity descriptor

getActivityDescriptor

public java.lang.String getActivityDescriptor()
Returns the activity descriptor for the activity being referenced.

Returns:
String the activity descriptor for the activity being referenced

addArgument

public boolean addArgument(ParameterValue p)
Adds the specified parameter value to the list of parameter values specified for this activity reference. The parameter value is passed to the referenced activity when the activity is to be executed.

Parameters:
p - the ParameterValue to be added
Returns:
true if the parameter is successfully added, false otherwise
See Also:
ParameterValue

removeArgument

public boolean removeArgument(ParameterValue p)
Removes the specified parameter value from the list of parameter values specified for this activity reference.

Parameters:
p - the ParameterValue to be removed
Returns:
true if the parameter is successfully removed, false otherwise
See Also:
ParameterValue

getArgument

public ParameterValue getArgument(int index)
Returns the ParameterValue at the specified zero-based index in the argument list.

Parameters:
index - the index of the requested ParameterValue
Returns:
ParameterValue the requested argument, null if no argument is specified at the specified index

hasArguments

public boolean hasArguments()
Returns whether this activity reference has any parameter values specified for the referenced activity.

Returns:
true if the activity reference has parameter values, false otherwise

getArguments

public java.util.Enumeration getArguments()
Returns a list of all the parameter values specified for this activity reference.

Returns:
Enumeration a list of ParameterValue

setOwner

public void setOwner(BFrame frm)
Sets the 'owner' of this activity reference. The owner is the frame in which the activity reference is specified.

Parameters:
frm - the BFrame in which the activity reference is specified

delete

public void delete()
Deletes this element from the model and removes all references to this element in other model elements.

Overrides:
delete in class BrahmsObject

createContext

public IActivityCtx createContext()
Deprecated. use createContext(Activity), you can no longer create a context for an activity reference due to the ability to override activities.

Creates a new context for this activity reference, actually creating a context for the activity referenced by this activity reference. This is a convenience method.

Note: This method always returns a new instance and does not verify whether one is already created.

Returns:
IActivityCtx the referenced activity's context

createContext

public IActivityCtx createContext(Activity activity)
Creates a new context for this activity reference, actually creating a context for the specified activity referenced by this activity reference. This is a convenience method.

Note: This method always returns a new instance and does not verify whether one is already created.

Parameters:
activity - the Activity being referenced by this activity reference
Returns:
IActivityCtx the referenced activity's context


Copyright © 1997-2012 All Rights Reserved.