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

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.VMMoveActivityCtx
All Implemented Interfaces:
IActivityCtx, IBrahmsObjectCtx, IMoveActivityCtx, IPrimitiveActivityCtx, IRuntimeConstants, gov.nasa.arc.brahms.vm.events.IDiscreteEventData, gov.nasa.arc.brahms.vm.events.IDiscreteEventHandler, java.io.Serializable

public class VMMoveActivityCtx
extends VMPrimitiveActivityCtx
implements IMoveActivityCtx

The VMMoveActivityCtx is a move activity context with extensions for use in the virtual machine that maintains the start and end times for an activity, the duration, priority, status, randomness, duration, resources, start location and destination location.

Version:
$Revision: 1.1 $ $Date: 2007/10/10 14:04:24 $ $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
  VMMoveActivityCtx(MoveActivity act)
          Constructor, creates a new context for the specified VMMoveActivity.
protected VMMoveActivityCtx(MoveActivity act, java.lang.String id)
          Constructor, creates a new context for the specified VMMoveActivity.
 
Method Summary
protected  void enterDestinationLocation(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
          The active instance enters the destination location.
 ParameterCtx getDestinationLocation()
          Returns the destination location for the move.
 java.util.Enumeration getDetectArrivalInAreas()
          Returns a list of all the areas (ParameterCtx) in which agents can detect the arrival of the moving agent.
 ParameterCtx getDetectArrivalInSubAreas()
          Returns whether we need to include the sub areas when returning the list of areas in which agents can detect the arrival of the moving agent.
 java.util.Enumeration getDetectDepartureInAreas()
          Returns a list of all the areas (ParameterCtx) in which agents can detect the departure of the moving agent.
 ParameterCtx getDetectDepartureInSubAreas()
          Returns whether we need to include the sub areas when returning the list of areas in which agents can detect the departure of the moving agent.
 long getDuration()
          Returns the calculated duration of the activity used by the VM
 ParameterCtx getStartLocation()
          Returns the start location for the move, the start location of the active instance when starting the move.
protected  void leaveStartLocation(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
          The active instance leaves the start location.
protected  void onContinue(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
          Continues the activity from an interrupt.
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.
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.VMPrimitiveActivityCtx
addResource, 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, 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, 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

VMMoveActivityCtx

public VMMoveActivityCtx(MoveActivity act)
Constructor, creates a new context for the specified VMMoveActivity.

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

VMMoveActivityCtx

protected VMMoveActivityCtx(MoveActivity act,
                            java.lang.String id)
Constructor, creates a new context for the specified VMMoveActivity.

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

getStartLocation

public ParameterCtx getStartLocation()
                              throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the start location for the move, the start location of the active instance when starting the move. The start location is defined through a parameter context referencing an AreaCtx.

Specified by:
getStartLocation in interface IMoveActivityCtx
Returns:
ParameterCtx the start location
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no start location is specified

getDestinationLocation

public ParameterCtx getDestinationLocation()
                                    throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the destination location for the move. The destination location is defined through a parameter context referencing an AreaCtx.

Specified by:
getDestinationLocation in interface IMoveActivityCtx
Returns:
ParameterCtx the destination location
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no destination location is specified

getDetectDepartureInAreas

public java.util.Enumeration getDetectDepartureInAreas()
                                                throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns a list of all the areas (ParameterCtx) in which agents can detect the departure of the moving agent. This values in this list depend on whether values are specified for the 'detectDepartureIn' property of the activity and the value specified for the 'detectDepartureInSubAreas' property of the activity. If no areas are specified for the detectDepartureIn-property then the current location of the agent is used. If detectDepartureInSubAreas is true then also all the sub areas of the specified areas are returned.

Returns:
Enumeration an enumeration of ParameterCtx
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if there are no areas

getDetectDepartureInSubAreas

public ParameterCtx getDetectDepartureInSubAreas()
                                          throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns whether we need to include the sub areas when returning the list of areas in which agents can detect the departure of the moving agent. The detectDepartureInSubAreas indicator is set through a parameter context containing either the actual value or a reference to a variable containing the value.

Returns:
ParameterCtx containing a boolean value defining whether we need to include sub areas.
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no detectDepartureInSubAreas indicator is specified

getDetectArrivalInAreas

public java.util.Enumeration getDetectArrivalInAreas()
                                              throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns a list of all the areas (ParameterCtx) in which agents can detect the arrival of the moving agent. This values in this list depend on whether values are specified for the 'detectArrivalIn' property of the activity and the value specified for the 'detectArrivalInSubAreas' property of the activity. If no areas are specified for the detectArrivalIn-property then the current destination location of the agent is used. If detectArrivalInSubAreas is true then also all the sub areas of the specified areas are returned.

Returns:
Enumeration an enumeration of ParameterCtx
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if there are no areas

getDetectArrivalInSubAreas

public ParameterCtx getDetectArrivalInSubAreas()
                                        throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns whether we need to include the sub areas when returning the list of areas in which agents can detect the arrival of the moving agent. The detectArrivalInSubAreas indicator is set through a parameter context containing either the actual value or a reference to a variable containing the value.

Returns:
ParameterCtx containing a boolean value defining whether we need to include sub areas.
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no detectArrivalInSubAreas indicator is specified

getDuration

public long getDuration()
Returns the calculated duration of the activity used by the VM

Specified by:
getDuration in interface IPrimitiveActivityCtx
Overrides:
getDuration in class VMPrimitiveActivityCtx
Returns:
long the total duration of the activity

leaveStartLocation

protected void leaveStartLocation(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
The active instance leaves the start location. Any facts and beliefs about this active instance being in this location will be retracted.

Parameters:
evt - the event triggering the active instance to leave the location

enterDestinationLocation

protected void enterDestinationLocation(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
The active instance enters the destination location. Facts and beliefs will be created about the active instance being in the destination location. The active instances currently in the destination location will detect the active instance entering the location and will get a belief about the active instance's destination location.

Parameters:
evt - the event triggering the active instance to enter the location

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. At start the active instance will leave its current location, the start location.

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. The active instance arrives in the destination location and will detect the environment. Active instances currently in the destination location will detect the active instance entering the location.

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

onContinue

protected void onContinue(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
Continues the activity from an interrupt.

Overrides:
onContinue in class VMActivityCtx
Parameters:
evt - the DiscreteEvent that initiated the continuation

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 VMPrimitiveActivityCtx
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 VMPrimitiveActivityCtx
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 VMPrimitiveActivityCtx
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 VMPrimitiveActivityCtx
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 VMPrimitiveActivityCtx
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 VMPrimitiveActivityCtx
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 VMPrimitiveActivityCtx
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 VMPrimitiveActivityCtx
Parameters:
evt - the DiscreteEvent that triggered the state change


Copyright © 1997-2012 All Rights Reserved.