|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object gov.nasa.arc.brahms.common.rt.BrahmsObjectCtx gov.nasa.arc.brahms.common.rt.FrameCtx gov.nasa.arc.brahms.vm.rt.VMFrameCtx
public abstract class VMFrameCtx
The VMFrameCtx maintains the general state information for a Brahms frame, workframe or thoughtframe and is a specialization of the FrameCtx to provide extensions for use in the virtual machine. The frame context maintains the status of the frame, the state of the frame, the executing active instance, and the contexts of the variables in the frame, preconditions that evaluated to true making the frame available and consequences fired in the frame. A modeled Brahms frame can have multiple contexts due to the possible different bindings of its variables.
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 | |
---|---|
VMFrameCtx(BFrame frame)
Constructor, creates a new context for the specified frame. |
|
VMFrameCtx(BFrame frame,
VMActiveInstanceCtx agent)
Constructor, creates a new context for the specified frame setting the specified agent as the agent working on frame. |
Method Summary | |
---|---|
void |
addFrameStatusListener(IFrameStatusListener listener)
Registers the specified listener as a frame status listener with this frame context. |
protected abstract void |
doWork(long currentTime)
Executes work up to the time higher then the time currently being executed. |
protected void |
fireStatusChanged(FrameStatusEvent evt)
Distributes the specified status event to all registered frame status listeners. |
boolean |
handleDiscreteEvent(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
Process the specified discrete event. |
boolean |
handleDiscreteEvent(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt,
gov.nasa.arc.brahms.vm.events.IDiscreteEventHandlerFactory ehf)
Handles the specified discrete event by selecting the appropriate event handler from the specified event handler factory. |
void |
onAvailable(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
Called when the frame context is made available. |
void |
onEnd(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
Called when a frame terminated under normal conditions meaning that there was nothing more to work on. |
void |
onStart(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
Called when the frame context is started for the first time. |
void |
onUnavailable(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
Called when the frame context is made unavailable. |
void |
removeFrameStatusListener(IFrameStatusListener listener)
Unregisters the specified listener as a frame status listener with this frame context. |
void |
setStatus(int status)
Sets the frame's current status. |
Methods inherited from class gov.nasa.arc.brahms.common.rt.FrameCtx |
---|
addBinding, addFiredConsequence, getBinding, getBindings, getFiredConsequences, getPerformedBy, getPerformedIn, getPriority, 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.IBrahmsObjectCtx |
---|
addNote, getContextFor, getEndTime, getID, getNote, getNotes, getStartTime, removeNote, setEndTime, setID, setStartTime |
Constructor Detail |
---|
public VMFrameCtx(BFrame frame)
frame
- the BFrame for which this frame context is a contextpublic VMFrameCtx(BFrame frame, VMActiveInstanceCtx agent)
frame
- the BFrame for which this frame context is a contextagent
- the agent working on the frameMethod Detail |
---|
protected abstract void doWork(long currentTime)
currentTime
- the time at which and for which work can be executed
VMError
- if an unexpected error occurs in executing the workpublic void setStatus(int status) throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
setStatus
in interface IFrameCtx
setStatus
in class FrameCtx
status
- the status of the frame context
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if status is an invalid statusIRuntimeConstants.UNAVAILABLE
,
IRuntimeConstants.AVAILABLE
,
IRuntimeConstants.ACTIVE
,
IRuntimeConstants.INTERRUPTED
,
IRuntimeConstants.IMPASSED
,
IRuntimeConstants.ABORTED
,
IRuntimeConstants.COMPLETED
,
IRuntimeConstants.ENDED
public void addFrameStatusListener(IFrameStatusListener listener)
listener
- the IFrameStatusListener registering for status eventsIFrameStatusListener
public void removeFrameStatusListener(IFrameStatusListener listener)
listener
- the IFrameStatusListener to be unregisteredIFrameStatusListener
protected void fireStatusChanged(FrameStatusEvent evt)
evt
- the FrameStatusEvent to be distributed to all frame status listeners.FrameStatusEvent
,
IFrameStatusListener
public boolean handleDiscreteEvent(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt, gov.nasa.arc.brahms.vm.events.IDiscreteEventHandlerFactory ehf)
handleDiscreteEvent
in interface gov.nasa.arc.brahms.vm.events.IDiscreteEventData
evt
- the DiscreteEvent to be handledehf
- the EventHandlerFactory containing handlers from which this
DiscreteEventData selects the appropriate handler
public boolean handleDiscreteEvent(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
handleDiscreteEvent
in interface gov.nasa.arc.brahms.vm.events.IDiscreteEventHandler
evt
- the DiscreteEvent to be processed.
public void onAvailable(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
evt
- the DiscreteEvent that initiated the availability of the framepublic void onUnavailable(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
evt
- the DiscreteEvent that initiated the unavailability of the framepublic void onStart(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
evt
- the DiscreteEvent that initiated the start of the framepublic void onEnd(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
evt
- the DiscreteEvent that initiated the end of the frame
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |