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

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.VMBroadcastActivityCtx
                      extended by gov.nasa.arc.brahms.vm.rt.VMCommunicateActivityCtx
All Implemented Interfaces:
IActivityCtx, IBrahmsObjectCtx, IBroadcastActivityCtx, ICommunicateActivityCtx, IPrimitiveActivityCtx, IRuntimeConstants, gov.nasa.arc.brahms.vm.events.IDiscreteEventData, gov.nasa.arc.brahms.vm.events.IDiscreteEventHandler, java.io.Serializable

public class VMCommunicateActivityCtx
extends VMBroadcastActivityCtx
implements ICommunicateActivityCtx

The VMCommunicateActivityCtx is a communicate activity context with extensions for use in the virtual machine that maintains the context of a communicate activity being or to be executed by an active instance. The context maintains the start and end times for an activity, the duration, priority, status, randomness, duration, resources, with whom or what the communication is with, what the communication is about, the type of communication and when the communication is to occur during the activity.

Version:
$Revision: 1.6 $ $Date: 2009/04/28 22:33:20 $ $Author: rnado $
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
  VMCommunicateActivityCtx(CommunicateActivity act)
          Constructor, creates a new context for the specified VMCommunicateActivity.
protected VMCommunicateActivityCtx(CommunicateActivity act, java.lang.String id)
          Constructor, creates a new context for the specified VMCommunicateActivity.
 
Method Summary
protected  void communicate(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
          Communicates the beliefs specified by the transfer definitions with the active instances specified in the communication with attribute.
 java.util.Enumeration<ParameterCtx> getWith()
          Returns the active instances with which is to be communicated as specified for this communicate activity.
protected  void receive(java.util.Enumeration<VMTransferDefinition> tdfs, long time)
          Communicates with the active instances that are to be communicated with and requests from them the beliefs that match the specified transfer definition.
protected  void receive(VMTransferDefinition tdf, long time)
          Communicates with the active instances that are to be communicated with and requests from them the beliefs that match the specified transfer definition.
protected  void sendAbortEvent(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
          Sends an abort event to the event notifier.
protected  void sendCompleteEvent(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
          Sends a complete event to the event notifier.
protected  void sendContinueEvent(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
          Sends a continue event to the event notifier.
protected  void sendContinueFromImpasseEvent(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
          Sends a continue from impasse event to the event notifier.
protected  void sendEndEvent(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
          Sends an end event to the event notifier.
protected  void sendImpasseEvent(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
          Sends an impasse event to the event notifier.
protected  void sendInterruptEvent(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
          Sends an interrupt event to the event notifier.
protected  void sendStartEvent(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
          Sends a start event to the event notifier.
 
Methods inherited from class gov.nasa.arc.brahms.vm.rt.VMBroadcastActivityCtx
addAbout, addWith, getAbout, getAreasToBroadcastTo, getCommunicationWith, getToSubAreas, getType, getWhen, hasWith, onEnd, onStart, removeAbout, removeWith, send, send
 
Methods inherited from class gov.nasa.arc.brahms.vm.rt.VMPrimitiveActivityCtx
addResource, getDuration, getElapsedTime, getMaxDuration, getMinDuration, getRandom, getResourceCount, getResources, removeResource, 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.IBroadcastActivityCtx
getAbout, getType, getWhen
 
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

VMCommunicateActivityCtx

public VMCommunicateActivityCtx(CommunicateActivity act)
Constructor, creates a new context for the specified VMCommunicateActivity.

Parameters:
act - the VMCommunicateActivity for which to create a context

VMCommunicateActivityCtx

protected VMCommunicateActivityCtx(CommunicateActivity act,
                                   java.lang.String id)
Constructor, creates a new context for the specified VMCommunicateActivity.

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

getWith

public java.util.Enumeration<ParameterCtx> getWith()
                                            throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the active instances with which is to be communicated as specified for this communicate activity.

Specified by:
getWith in interface IBroadcastActivityCtx
Overrides:
getWith in class VMBroadcastActivityCtx
Returns:
Enumeration the list of ParameterCtx referencing active instances to communicate with
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no active instances are specified

communicate

protected void communicate(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
                    throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Communicates the beliefs specified by the transfer definitions with the active instances specified in the communication with attribute.

Overrides:
communicate in class VMBroadcastActivityCtx
Parameters:
evt - the event that triggered the communication
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if an internal error occurs

receive

protected void receive(VMTransferDefinition tdf,
                       long time)
                throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Communicates with the active instances that are to be communicated with and requests from them the beliefs that match the specified transfer definition. The communicated beliefs are added the belief set of the communicating active instance.

Parameters:
tdf - the VMTransferDefinition specifying what needs to be received
time - the time at which the receiving is to occur
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if an internal error occurs

receive

protected void receive(java.util.Enumeration<VMTransferDefinition> tdfs,
                       long time)
                throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Communicates with the active instances that are to be communicated with and requests from them the beliefs that match the specified transfer definition. The communicated beliefs are added the belief set of the communicating active instance.

Parameters:
tdfs - the VMTransferDefinitions specifying what needs to be received
time - the time at which the receiving is to occur
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if an internal error occurs

sendStartEvent

protected void sendStartEvent(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
Sends a start event to the event notifier.

Note that this method is created for the different implementations by the sub classes of VMActivityCtx.

Overrides:
sendStartEvent in class VMBroadcastActivityCtx
Parameters:
evt - the DiscreteEvent that triggered the state change

sendEndEvent

protected void sendEndEvent(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
Sends an end event to the event notifier.

Note that this method is created for the different implementations by the sub classes of VMActivityCtx.

Overrides:
sendEndEvent in class VMBroadcastActivityCtx
Parameters:
evt - the DiscreteEvent that triggered the state change

sendInterruptEvent

protected void sendInterruptEvent(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
Sends an interrupt event to the event notifier.

Note that this method is created for the different implementations by the sub classes of VMActivityCtx.

Overrides:
sendInterruptEvent in class VMBroadcastActivityCtx
Parameters:
evt - the DiscreteEvent that triggered the state change

sendContinueEvent

protected void sendContinueEvent(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
Sends a continue event to the event notifier.

Note that this method is created for the different implementations by the sub classes of VMActivityCtx.

Overrides:
sendContinueEvent in class VMBroadcastActivityCtx
Parameters:
evt - the DiscreteEvent that triggered the state change

sendImpasseEvent

protected void sendImpasseEvent(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
Sends an impasse event to the event notifier.

Note that this method is created for the different implementations by the sub classes of VMActivityCtx.

Overrides:
sendImpasseEvent in class VMBroadcastActivityCtx
Parameters:
evt - the DiscreteEvent that triggered the state change

sendContinueFromImpasseEvent

protected void sendContinueFromImpasseEvent(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
Sends a continue from impasse event to the event notifier.

Note that this method is created for the different implementations by the sub classes of VMActivityCtx.

Overrides:
sendContinueFromImpasseEvent in class VMBroadcastActivityCtx
Parameters:
evt - the DiscreteEvent that triggered the state change

sendCompleteEvent

protected void sendCompleteEvent(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
Sends a complete event to the event notifier.

Note that this method is created for the different implementations by the sub classes of VMActivityCtx.

Overrides:
sendCompleteEvent in class VMBroadcastActivityCtx
Parameters:
evt - the DiscreteEvent that triggered the state change

sendAbortEvent

protected void sendAbortEvent(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
Sends an abort event to the event notifier.

Note that this method is created for the different implementations by the sub classes of VMActivityCtx.

Overrides:
sendAbortEvent in class VMBroadcastActivityCtx
Parameters:
evt - the DiscreteEvent that triggered the state change


Copyright © 1997-2012 All Rights Reserved.