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

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.Activity
All Implemented Interfaces:
gov.nasa.arc.brahms.common.IConstants, java.io.Serializable
Direct Known Subclasses:
CompositeActivity, PrimitiveActivity

public class Activity
extends NamedModelElement

An activity represents an agent or object doing something.

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
Activity()
          Constructor, creates a new activity.
Activity(java.lang.String name)
          Constructor, creates a new activity with the specified name.
Activity(java.lang.String file, int line)
          Constructor, creates a new activity declared in source code in the specified file at the specified line number.
Activity(java.lang.String name, java.lang.String file, int line)
          Constructor, creates a new activity with the specified name declared in source code in the specified file at the specified line number.
 
Method Summary
 boolean addParameter(Parameter p)
          Adds the specified Parameter as a declared parameter for the activity to the parameter list.
 void addReference(ActivityRef reference)
          Adds the specified activity reference as a reference to this activity.
static int convertWhenSymbolToInt(java.lang.String when)
          Converts the when indicator represented as a symbol to an integer constant.
 IActivityCtx createContext()
          Creates a new context for this activity for use in a virtual machine.
 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 this activity.
 java.lang.Object getDisplayText()
          Returns the activities display text, used to present the activity name in a user-friendly way.
 java.lang.String getFullyQualifiedName()
          Returns the fully qualified name of the activity.
 Parameter getParameter(int i)
          Returns the i-th parameter in the activities parameter list if a parameter with that index is declared
 Parameter getParameter(java.lang.String name)
          Returns the parameter with the specified name if such a parameter is declared for the activity.
 int getParameterCount()
          Returns the number of Parameters that are declared for this activity.
 java.util.Enumeration getParameters()
          Returns a list of all the parameters declared for this activity.
 java.lang.Object getPriority()
          Returns the activities priority
 java.lang.String getQualifiedName()
          Returns the qualified name of the activity.
 java.util.Enumeration getReferences()
          Returns a list of all the activity references referencing this activity.
 boolean hasParameters()
          Indicates whether any Parameters are declared for this activity.
 boolean removeParameter(java.lang.String name)
          Removes the parameter with the specified name as a declared parameter for this activity.
 void removeReference(ActivityRef reference)
          Removes the specified activity reference as a reference to this activity.
 void setActivityDescriptor(java.lang.String descriptor)
          Sets the activity descriptor for this activity.
 void setDisplayText(Parameter p)
          Sets the activities display text, used to present the activity name in a user-friendly way.
 void setDisplayText(java.lang.String text)
          Sets the activities display text, used to present the activity name in a user-friendly way.
 void setOwner(ActiveConcept c)
          Sets the concept/owner for which the activity is declared.
 void setOwner(CompositeActivity act)
          Sets the compisite activity as the owner in which the activity is declared.
 void setPriority(java.lang.Integer i)
          Sets the activities priority.
 void setPriority(Parameter p)
          Sets the activities priority.
 
Methods inherited from class gov.nasa.arc.brahms.common.data.NamedModelElement
getName, getOwner, 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, setID, setLine, setLoaded, setResolved, setSerialNumber
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Activity

public Activity()
Constructor, creates a new activity.


Activity

public Activity(java.lang.String name)
Constructor, creates a new activity with the specified name.

Parameters:
name - the name of the activity

Activity

public Activity(java.lang.String file,
                int line)
Constructor, creates a new activity declared in source code in the specified file at the specified line number.

Parameters:
file - the source file in which the activity is declared
line - the line number in the source file at which the activity is declared

Activity

public Activity(java.lang.String name,
                java.lang.String file,
                int line)
Constructor, creates a new activity with the specified name declared in source code in the specified file at the specified line number.

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

convertWhenSymbolToInt

public static int convertWhenSymbolToInt(java.lang.String when)
Converts the when indicator represented as a symbol to an integer constant.

Parameters:
type - the symbol representation
Returns:
int the constant value

setActivityDescriptor

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

Parameters:
descriptor - the activity descriptor

getActivityDescriptor

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

Returns:
String the activity descriptor for this activity

getFullyQualifiedName

public java.lang.String getFullyQualifiedName()
Returns the fully qualified name of the activity. The fully qualified name of aan activity is the fully qualified name of its owner followed by the name of the activity.

Overrides:
getFullyQualifiedName in class NamedModelElement
Returns:
String the fully qualified name

getQualifiedName

public java.lang.String getQualifiedName()
Returns the qualified name of the activity. The qualified name of a activity is the qualified name of its owner followed by the name of the activity. If the owner is a concept the qualified name is the name of the activity. If the owner is a composite activity the qualified name is the qualified name of the composite activity followed by the name of this activity. The qualified name differs from the fully qualified name in that it does not include the package and concept name.

Returns:
String the qualified name

addParameter

public boolean addParameter(Parameter p)
Adds the specified Parameter as a declared parameter for the activity to the parameter list.

Parameters:
p - the Parameter to be added
Returns:
boolean true if it was added, false if not

removeParameter

public boolean removeParameter(java.lang.String name)
Removes the parameter with the specified name as a declared parameter for this activity.

Parameters:
name - the name of the Parameter to be removed
Returns:
boolean true if the parameter was removed, false if not.

getParameter

public Parameter getParameter(java.lang.String name)
                       throws java.util.NoSuchElementException
Returns the parameter with the specified name if such a parameter is declared for the activity.

Parameters:
name - the name of the requested Parameter
Returns:
Parameter the requested Parameter
Throws:
java.util.NoSuchElementException - if no Parameter with the specified name is declared for this activity

getParameter

public Parameter getParameter(int i)
                       throws java.util.NoSuchElementException
Returns the i-th parameter in the activities parameter list if a parameter with that index is declared

Parameters:
i - the zero-based index of the requested Parameter
Returns:
Parameter the requested Parameter
Throws:
java.util.NoSuchElementException - if no Parameter is declared for this activity at the specified index.

getParameters

public java.util.Enumeration getParameters()
Returns a list of all the parameters declared for this activity.

Returns:
Enumeration an Enumeration of Parameter, an empty Enumeration if no Parameters are declared.

hasParameters

public boolean hasParameters()
Indicates whether any Parameters are declared for this activity.

Returns:
boolean true if one or more parameters are declared for this activity, false otherwise.

getParameterCount

public int getParameterCount()
Returns the number of Parameters that are declared for this activity.

Returns:
int the nunmber of parameters declared for this activity.

setDisplayText

public void setDisplayText(Parameter p)
Sets the activities display text, used to present the activity name in a user-friendly way. The display text is passed to the activity through the specified parameter.

Parameters:
p - the Parameter used to specify the activities display text

setDisplayText

public void setDisplayText(java.lang.String text)
Sets the activities display text, used to present the activity name in a user-friendly way.

Overrides:
setDisplayText in class NamedModelElement
Parameters:
text - String the display text

getDisplayText

public java.lang.Object getDisplayText()
Returns the activities display text, used to present the activity name in a user-friendly way.

Overrides:
getDisplayText in class NamedModelElement
Parameters:
Object - a String if the actual display text is specified or a Parameter if the display text is specified through an argument for the parameter

setPriority

public void setPriority(Parameter p)
Sets the activities priority. The priority is passed to the activity through the specified parameter.

Parameters:
p - the Parameter used to specify the activities priority

setPriority

public void setPriority(java.lang.Integer i)
Sets the activities priority.

Parameters:
i - the priority of the activity, 0 or higher

getPriority

public java.lang.Object getPriority()
Returns the activities priority

Parameters:
Object - an Integer if the actual priority is specified or a Parameter if the priority is specified through an argument for the parameter

setOwner

public void setOwner(ActiveConcept c)
Sets the concept/owner for which the activity is declared.

Parameters:
c - the owning ActiveConcept

setOwner

public void setOwner(CompositeActivity act)
Sets the compisite activity as the owner in which the activity is declared.

Parameters:
act - the owning CompositeActivity

addReference

public void addReference(ActivityRef reference)
Adds the specified activity reference as a reference to this activity.

Parameters:
reference - the ActivityRef referencing this activity

removeReference

public void removeReference(ActivityRef reference)
Removes the specified activity reference as a reference to this activity.

Parameters:
reference - the ActivityRef to be removed as a reference

getReferences

public java.util.Enumeration getReferences()
Returns a list of all the activity references referencing this activity.

Returns:
Enumeration an Enumeration of ActivityRef

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()
Creates a new context for this activity for use in a virtual machine.

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

Returns:
IActivityCtx the activity's context


Copyright © 1997-2012 All Rights Reserved.