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

java.lang.Object
  extended by gov.nasa.arc.brahms.common.rt.BrahmsObjectCtx
      extended by gov.nasa.arc.brahms.common.rt.FrameCtx
          extended by gov.nasa.arc.brahms.vm.rt.VMFrameCtx
              extended by gov.nasa.arc.brahms.vm.rt.VMThoughtframeCtx
All Implemented Interfaces:
IBrahmsObjectCtx, IFrameCtx, IRuntimeConstants, IThoughtframeCtx, gov.nasa.arc.brahms.vm.events.IDiscreteEventData, gov.nasa.arc.brahms.vm.events.IDiscreteEventHandler, java.io.Serializable

public class VMThoughtframeCtx
extends VMFrameCtx
implements IThoughtframeCtx

The VMThoughtframeCtx is identical to the VMFrameCtx and maintains state information for a thoughtframe to be executed by an active instance. No additional behavior is added to this class. This class is defined for readability purposes in code, instead of using VMFrameCtx's for thoughtframes, VMThoughtframeCtx's are used.

Version:
$Revision: 1.2 $ $Date: 2008/10/08 12:17:48 $ $Author: rvhoof $
Author:
Ron van Hoof
See Also:
VMFrameCtx, 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
VMThoughtframeCtx(Thoughtframe frame)
          Constructor, creates a new context for the specified thoughtframe.
VMThoughtframeCtx(Thoughtframe frame, VMActiveInstanceCtx agent)
          Constructor, creates a new context for the specified thoughtframe setting the specified agent as the agent working on frame.
 
Method Summary
protected  void doWork(long currentTime)
          Executes the thoughtframe.
 int getPriority()
          Returns the priority of the frame context.
 
Methods inherited from class gov.nasa.arc.brahms.vm.rt.VMFrameCtx
addFrameStatusListener, fireStatusChanged, handleDiscreteEvent, handleDiscreteEvent, onAvailable, onEnd, onStart, onUnavailable, removeFrameStatusListener, setStatus
 
Methods inherited from class gov.nasa.arc.brahms.common.rt.FrameCtx
addBinding, addFiredConsequence, getBinding, getBindings, getFiredConsequences, getPerformedBy, getPerformedIn, getState, getStatus, getTimeAvailable, removeBinding, removeFiredConsequence, setPerformedBy, setPerformedIn, setPriority, setState, setState, setTimeAvailable, 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.IFrameCtx
addBinding, addFiredConsequence, getBinding, getBindings, getFiredConsequences, getPerformedBy, getPerformedIn, getState, getStatus, getTimeAvailable, removeBinding, removeFiredConsequence, setPerformedBy, setPerformedIn, setPriority, setState, setState, setStatus, setTimeAvailable
 
Methods inherited from interface gov.nasa.arc.brahms.common.rt.IBrahmsObjectCtx
addNote, getContextFor, getEndTime, getID, getNote, getNotes, getStartTime, removeNote, setEndTime, setID, setStartTime
 

Constructor Detail

VMThoughtframeCtx

public VMThoughtframeCtx(Thoughtframe frame)
Constructor, creates a new context for the specified thoughtframe.

Parameters:
frame - the Thoughtframe for which this frame context is a context

VMThoughtframeCtx

public VMThoughtframeCtx(Thoughtframe frame,
                         VMActiveInstanceCtx agent)
Constructor, creates a new context for the specified thoughtframe setting the specified agent as the agent working on frame.

Parameters:
frame - the Thoughtframe for which this frame context is a context
agent - the agent working on the frame
Method Detail

getPriority

public int getPriority()
                throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the priority of the frame context. The priority is based on the priority set for the throughtframe directly.

Specified by:
getPriority in interface IFrameCtx
Overrides:
getPriority in class FrameCtx
Returns:
int the frame context's priority
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no priority is set

doWork

protected void doWork(long currentTime)
Executes the thoughtframe. Since thoughtframes do not take any time it will complete the thoughtframe from start to finish.

Specified by:
doWork in class VMFrameCtx
Parameters:
currentTime - the time at which and for which work can be executed
Throws:
VMError - if an unexpected error occurs in executing the work


Copyright © 1997-2012 All Rights Reserved.