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

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

public class VMCreateObjectActivityCtx
extends VMPrimitiveActivityCtx
implements ICreateObjectActivityCtx

The VMCreateObjectActivityCtx is a create object activity context with extensions for use in the virtual machine that maintains the context of a create object 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, source object, destination object, name and location of the destination object, aggregate conceptual instances and the action and when the action is to take place.

Version:
$Revision: 1.4 $ $Date: 2008/02/28 18:33:05 $ $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
  VMCreateObjectActivityCtx(CreateObjectActivity act)
          Constructor, creates a new context for the specified VMCreateObjectActivity.
protected VMCreateObjectActivityCtx(CreateObjectActivity act, java.lang.String id)
          Constructor, creates a new context for the specified VMCreateObjectActivity.
 
Method Summary
 void addBoundVariable(VariableCtx var)
          Adds the specified variable as a variable bound by this activity.
protected  void createObject(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
          Creates or copies an object using the parameters specified for the activity.
 ParameterCtx getAction()
          Returns the create object's action (NEW or COPY).
 java.util.Enumeration getBoundVariables()
          Returns a list of all the variables used by this activity.
 ParameterCtx getDestination()
          Returns the create object's destination object or class.
 java.util.Enumeration getDestinationAggregates()
          Returns a list of all the destination aggregates (ParameterCtx).
 ParameterCtx getDestinationLocation()
          Returns the location for the created object.
 ParameterCtx getDestinationName()
          Returns the name for the created object.
 ParameterCtx getSource()
          Returns the create object's source object or class.
 ParameterCtx getWhen()
          Returns when the create object 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 removeBoundVariable(VariableCtx var)
          Removes the specified variable as a variable bound by this 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, 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.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

VMCreateObjectActivityCtx

public VMCreateObjectActivityCtx(CreateObjectActivity act)
Constructor, creates a new context for the specified VMCreateObjectActivity.

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

VMCreateObjectActivityCtx

protected VMCreateObjectActivityCtx(CreateObjectActivity act,
                                    java.lang.String id)
Constructor, creates a new context for the specified VMCreateObjectActivity.

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

getAction

public ParameterCtx getAction()
                       throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the create object's action (NEW or COPY). The action is specified through a parameter context containing either the actual value (int) or a reference to a variable containing the value.

Specified by:
getAction in interface ICreateObjectActivityCtx
Returns:
ParameterCtx the action
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no action is specified

getWhen

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

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

getSource

public ParameterCtx getSource()
                       throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the create object's source object or class. The source is specified through a parameter context containing either the actual value (ConceptCtx) or a reference to a variable containing the value.

Specified by:
getSource in interface ICreateObjectActivityCtx
Returns:
ParameterCtx the source
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no source is specified

getDestination

public ParameterCtx getDestination()
                            throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the create object's destination object or class. The destination is specified through a parameter context containing either the actual value (ConceptCtx) or a reference to a variable containing the value.

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

getDestinationName

public ParameterCtx getDestinationName()
                                throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the name for the created object. The destination name is specified through a parameter context containing either the actual value (String) or a reference to a variable containing the value.

Specified by:
getDestinationName in interface ICreateObjectActivityCtx
Returns:
ParameterCtx the destination name
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no destination name is specified

getDestinationLocation

public ParameterCtx getDestinationLocation()
                                    throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the location for the created object. The destination location is specified through a parameter context containing either the actual value (AreaCtx) or a reference to a variable containing the value.

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

getDestinationAggregates

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

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

addBoundVariable

public void addBoundVariable(VariableCtx var)
                      throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Adds the specified variable as a variable bound by this activity.

Specified by:
addBoundVariable in interface ICreateObjectActivityCtx
Parameters:
var - the variable (VariableCtx) to be added
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if var is null

removeBoundVariable

public void removeBoundVariable(VariableCtx var)
                         throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Removes the specified variable as a variable bound by this activity.

Specified by:
removeBoundVariable in interface ICreateObjectActivityCtx
Parameters:
var - the variable (VariableCtx) to be removed
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if variable is null, no variables are present, or the variable is not found

getBoundVariables

public java.util.Enumeration getBoundVariables()
                                        throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns a list of all the variables used by this activity.

Specified by:
getBoundVariables in interface ICreateObjectActivityCtx
Returns:
Enumeration an enumeration of VariableCtx
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if there are no variables

createObject

protected void createObject(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
                     throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Creates or copies an object using the parameters specified for the activity.

Parameters:
evt - the event that triggered the object creation
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if an internal error occurs

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 create object activity is to occur at the start, it will create or copy an object using the parameters specified for the activity.

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 create object activity is to occur at the end, it will create or copy an object using the parameters specified for the activity.

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

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.