gov.nasa.arc.brahms.vm.rt
Class VMContainmentActivityCtx

java.lang.Object
  extended by gov.nasa.arc.brahms.common.rt.BrahmsObjectCtx
      extended by gov.nasa.arc.brahms.common.rt.ActivityCtx
          extended by gov.nasa.arc.brahms.vm.rt.VMActivityCtx
              extended by gov.nasa.arc.brahms.vm.rt.VMPrimitiveActivityCtx
                  extended by gov.nasa.arc.brahms.vm.rt.VMContainmentActivityCtx
All Implemented Interfaces:
IActivityCtx, IBrahmsObjectCtx, IContainmentActivityCtx, IPrimitiveActivityCtx, IRuntimeConstants, gov.nasa.arc.brahms.vm.events.IDiscreteEventData, gov.nasa.arc.brahms.vm.events.IDiscreteEventHandler, java.io.Serializable
Direct Known Subclasses:
VMGetActivityCtx, VMPutActivityCtx

public abstract class VMContainmentActivityCtx
extends VMPrimitiveActivityCtx
implements IContainmentActivityCtx

The VMContainmentActivityCtx is the generic context for the VMPutActivityCtx and VMGetActivityCtx.

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

Field Summary
 
Fields inherited from interface gov.nasa.arc.brahms.common.rt.IRuntimeConstants
ABORTED, ACTIVE, ACTIVITY, AVAILABLE, COMPLETED, CONSEQUENCE, DETECTABLE, ENDED, ENGINE, EXTERNAL_AGENT, FROM, IMPASSED, INITIAL, INTERRUPTED, JAVA_PROPERTY, sABORTED, sACTIVE, sAVAILABLE, sCOMPLETED, sENDED, sIMPASSED, sINTERRUPTED, sUNAVAILABLE, TO, TRANSFER, UNAVAILABLE
 
Constructor Summary
protected VMContainmentActivityCtx(ContainmentActivity act, java.lang.String id)
          Constructor, creates a new context for the specified VMContainmentActivity.
 
Method Summary
 void addItem(ParameterCtx item)
          Adds the specified item as an item picked up or dropped off through this activity.
protected abstract  void doActivityAction(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
          Performs the containment action, put or get, depending on the activity.
 int getItemCount()
          Return the number of items associated with the activity.
 java.util.Enumeration getItems()
          Returns a list of all the items (ParameterCtx).
 ParameterCtx getWhen()
          Returns when the activity action is to take place (start or end).
protected  void onEnd(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
          Ends the activity, handling any completion initializations and executing any actions that are to be executed at the end of the activity as specified for the activity.
protected  boolean onStart(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
          Starts the activity, handling any startup initialization and executing any actions that are to be executed at the start of the activity as specified for the activity.
 void removeItem(ParameterCtx item)
          Removes the specified item as an item picked up or dropped off through this activity.
 
Methods inherited from class gov.nasa.arc.brahms.vm.rt.VMPrimitiveActivityCtx
addResource, getDuration, getElapsedTime, getMaxDuration, getMinDuration, getRandom, getResourceCount, getResources, removeResource, sendAbortEvent, sendCompleteEvent, sendContinueEvent, sendContinueFromImpasseEvent, sendEndEvent, sendImpasseEvent, sendInterruptEvent, sendStartEvent, setElapsedTime
 
Methods inherited from class gov.nasa.arc.brahms.vm.rt.VMActivityCtx
getDisplayText, getParameterCtx, getPriority, handleDiscreteEvent, handleDiscreteEvent, onAbort, onComplete, onContinue, onContinueFromImpasse, onImpasse, onInterrupt, resolveParameters
 
Methods inherited from class gov.nasa.arc.brahms.common.rt.ActivityCtx
getCompletionCause, getParentFrame, getPerformedBy, getReferencedBy, getState, getStatus, setCompletionCause, setDisplayText, setParentFrame, setPerformedBy, setPriority, setReferencedBy, setState, setState, setStatus, toString
 
Methods inherited from class gov.nasa.arc.brahms.common.rt.BrahmsObjectCtx
addNote, getContextFor, getEndTime, getID, getNote, getNotes, getStartTime, removeNote, setContextFor, setEndTime, setID, setStartTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gov.nasa.arc.brahms.common.rt.IPrimitiveActivityCtx
addResource, getDuration, getElapsedTime, getMaxDuration, getMinDuration, getRandom, getResourceCount, getResources, removeResource, setElapsedTime
 
Methods inherited from interface gov.nasa.arc.brahms.common.rt.IActivityCtx
getCompletionCause, getDisplayText, getParentFrame, getPerformedBy, getPriority, getReferencedBy, getStatus, setCompletionCause, setDisplayText, setParentFrame, setPerformedBy, setReferencedBy, setStatus
 
Methods inherited from interface gov.nasa.arc.brahms.common.rt.IBrahmsObjectCtx
addNote, getContextFor, getEndTime, getID, getNote, getNotes, getStartTime, removeNote, setEndTime, setID, setStartTime
 

Constructor Detail

VMContainmentActivityCtx

protected VMContainmentActivityCtx(ContainmentActivity act,
                                   java.lang.String id)
Constructor, creates a new context for the specified VMContainmentActivity.

Parameters:
act - the VMContainmentActivity for which to create a context
id - the unique identifier for the activity context
Method Detail

addItem

public void addItem(ParameterCtx item)
             throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Adds the specified item as an item picked up or dropped off through this activity. The actual item is the agent or object referenced by the parameter context where the parameter context specifies when the item was associated with the activity.

Specified by:
addItem in interface IContainmentActivityCtx
Parameters:
item - the item (ParameterCtx) to be added
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if item is null

removeItem

public void removeItem(ParameterCtx item)
                throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Removes the specified item as an item picked up or dropped off through this activity. The actual item is the agent or object referenced by the parameter context where the parameter context specifies when the item was (dis)associated with the activity.

Specified by:
removeItem in interface IContainmentActivityCtx
Parameters:
item - the item (ParameterCtx) to be removed
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if item is null, no items are available, or the item is not found

getItems

public java.util.Enumeration getItems()
                               throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns a list of all the items (ParameterCtx).

Specified by:
getItems in interface IContainmentActivityCtx
Returns:
Enumeration an enumeration of ParameterCtx
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if there are no items

getItemCount

public int getItemCount()
Return the number of items associated with the activity.

Specified by:
getItemCount in interface IContainmentActivityCtx
Returns:
int the number of items

getWhen

public ParameterCtx getWhen()
                     throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns when the activity action is to take place (start or end). The when value is set through a parameter context containing either the actual value or a reference to a variable containing the when value.

Specified by:
getWhen in interface IContainmentActivityCtx
Returns:
ParameterCtx the when value defining when the activity action is to occur
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if the when value is not defined

doActivityAction

protected abstract void doActivityAction(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
Performs the containment action, put or get, depending on the activity.

Parameters:
evt - the DiscreteEvent that triggered the execution of the code

onStart

protected boolean onStart(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
Starts the activity, handling any startup initialization and executing any actions that are to be executed at the start of the activity as specified for the activity. If the activity specifies that the java code execution is to occur at the start, it will execute the java code.

Overrides:
onStart in class VMActivityCtx
Parameters:
evt - the DiscreteEvent that initiated the start of the activity
Returns:
boolean true if the activity was started, false if not

onEnd

protected void onEnd(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
Ends the activity, handling any completion initializations and executing any actions that are to be executed at the end of the activity as specified for the activity. If the activity specifies that the java code execution is to occur at the end, it will execute the java code.

Overrides:
onEnd in class VMActivityCtx
Parameters:
evt - the DiscreteEvent that initiated the end of the activity


Copyright © 1997-2012 All Rights Reserved.