|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgov.nasa.arc.brahms.common.rt.BrahmsObjectCtx
gov.nasa.arc.brahms.common.rt.FrameCtx
gov.nasa.arc.brahms.vm.rt.VMFrameCtx
gov.nasa.arc.brahms.vm.rt.VMWorkframeCtx
public class VMWorkframeCtx
The VMWorkframeCtx maintains the state for a workframe and has extensions for use in the virtual machine. In addition to keeping track of the state information as defined in the VMFrameCtx the workframe context also tracks the activity currently executed in the frame, the activities that have completed and the detectable contexts defining the detectables that were executed in the context of the workframe.
VMFrameCtx,
Serialized Form| Field Summary | |
|---|---|
static java.lang.String |
DETECTABLE
property name used with DiscreteEvent to indicate a detectable causing a state change |
static java.lang.String |
IMPASSE_RESOLVING_BELIEF
property name used with DiscreteEvent to indicate a belief resolving the impasse |
static java.lang.String |
INTERRUPTING_FRAME
Property name used with DiscreteEvent to indicate an interrupting frame |
| Fields inherited from interface gov.nasa.arc.brahms.common.rt.IRuntimeConstants |
|---|
ABORTED, ACTIVE, ACTIVITY, AVAILABLE, COMPLETED, CONSEQUENCE, ENDED, ENGINE, EXTERNAL_AGENT, FROM, IMPASSED, INITIAL, INTERRUPTED, JAVA_PROPERTY, sABORTED, sACTIVE, sAVAILABLE, sCOMPLETED, sENDED, sIMPASSED, sINTERRUPTED, sUNAVAILABLE, TO, TRANSFER, UNAVAILABLE |
| Constructor Summary | |
|---|---|
VMWorkframeCtx(VMWorkframe frame)
Constructor, creates a new context for the specified workframe. |
|
VMWorkframeCtx(VMWorkframe 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 |
addActiveDetectable(IDetectableCtx detectable)
Adds the specified detectable as an active detectable to the list of active detectables. |
void |
addCompletedActivity(ActivityCtx act)
Adds the specified activity as a completed activity to the list of completed activities. |
protected void |
doWork(long currentTime)
Executes work up to the time higher then the time currently being executed. |
java.util.ListIterator |
getActiveDetectables()
Returns the list of active detectables. |
java.util.ListIterator |
getCompletedActivities()
Returns the list of completed activities. |
ActivityCtx |
getCurrentActivity()
Returns the activity currently active in the workframe |
VMWorkframeCtx |
getLowestCurrentWork()
Returns the workframe context lowest in the frame hierarchy using this workframe context as the starting point. |
protected int |
getPreviousStatus()
Returns the previous status, the status the frame had before the current status. |
int |
getPriority()
Returns the priority of the frame context. |
boolean |
handleDiscreteEvent(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
Process the specified discrete event. |
void |
onAbort(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
Called when the frame context is aborted. |
void |
onComplete(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
Called when the frame context is to be completed. |
void |
onCompleteFinal(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
Called when the frame context was completed by a detectable and all remaining consequences have been fired and their events processed. |
void |
onContinue(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
Called when the frame context is continued from an interrupt. |
void |
onContinueFromImpasse(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
Called when the frame context is continued from an impasse. |
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 |
onImpasse(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
Called when the frame context is impassed. |
void |
onInterrupt(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
Called when the frame context is interrupted. |
void |
onStart(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
Called when the frame context is started for the first time. |
void |
removeActiveDetectable(IDetectableCtx detectable)
Removes the specified detectable as an active detectable from the list of active detectables. |
void |
removeCompletedActivity(ActivityCtx act)
Removes the specified activity as a completed activity from the list of completed activities. |
void |
setCurrentActivity(ActivityCtx act)
Sets the activity currently active in the workframe |
void |
setStatus(int status)
Sets the frame's current status. |
protected void |
setTestEndCompositeActivity(boolean test)
Sets the flag indicating whether or not this workframe should test if its current composite activity should be ended due to no more work being available. |
protected void |
updateDeltaEventTime(IActivityCtx activity,
long deltaTime)
Update the delta event time for the end activity event for the specified activity. |
| Methods inherited from class gov.nasa.arc.brahms.vm.rt.VMFrameCtx |
|---|
addFrameStatusListener, fireStatusChanged, handleDiscreteEvent, onAvailable, onUnavailable, removeFrameStatusListener |
| 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, setTimeAvailable |
| Methods inherited from interface gov.nasa.arc.brahms.common.rt.IBrahmsObjectCtx |
|---|
addNote, getContextFor, getEndTime, getID, getNote, getNotes, getStartTime, removeNote, setEndTime, setID, setStartTime |
| Field Detail |
|---|
public static final java.lang.String INTERRUPTING_FRAME
public static final java.lang.String DETECTABLE
public static final java.lang.String IMPASSE_RESOLVING_BELIEF
| Constructor Detail |
|---|
public VMWorkframeCtx(VMWorkframe frame)
frame - the Workframe for which this frame context is a context
public VMWorkframeCtx(VMWorkframe frame,
VMActiveInstanceCtx agent)
frame - the Workframe for which this frame context is a contextagent - the agent working on the frame| Method Detail |
|---|
public int getPriority()
throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
getPriority in interface IFrameCtxgetPriority in class FrameCtxgov.nasa.arc.brahms.common.exceptions.BrahmsException - if no priority is setprotected void setTestEndCompositeActivity(boolean test)
test - true if the test should be performed, false otherwise.protected void doWork(long currentTime)
doWork in class VMFrameCtxcurrentTime - the time at which and for which work can be executed
VMError - if an unexpected error occurs in executing the work
public void setStatus(int status)
throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
setStatus in interface IFrameCtxsetStatus in class VMFrameCtxstatus - 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.ENDEDprotected int getPreviousStatus()
IRuntimeConstants.UNAVAILABLE,
IRuntimeConstants.AVAILABLE,
IRuntimeConstants.ACTIVE,
IRuntimeConstants.INTERRUPTED,
IRuntimeConstants.IMPASSED,
IRuntimeConstants.ABORTED,
IRuntimeConstants.COMPLETED,
IRuntimeConstants.ENDEDpublic void setCurrentActivity(ActivityCtx act)
setCurrentActivity in interface IWorkframeCtxact - the current activity (ActivityCtx)public ActivityCtx getCurrentActivity()
getCurrentActivity in interface IWorkframeCtxpublic VMWorkframeCtx getLowestCurrentWork()
public void addCompletedActivity(ActivityCtx act)
throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
addCompletedActivity in interface IWorkframeCtxact - the ActivityCtx for the activity completed in the workframe
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if the activity is null
public void removeCompletedActivity(ActivityCtx act)
throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
removeCompletedActivity in interface IWorkframeCtxact - the ActivityCtx for the activity to be removed as a completed activity
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if the activity is null or no completed activities exist
or the specified activity is not found
public java.util.ListIterator getCompletedActivities()
throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
getCompletedActivities in interface IWorkframeCtxgov.nasa.arc.brahms.common.exceptions.BrahmsException - if no completed activities exist
public void addActiveDetectable(IDetectableCtx detectable)
throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
addActiveDetectable in interface IWorkframeCtxdetectable - the IDetectableCtx for the detectable active in the workframe
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if the detectable is null
public void removeActiveDetectable(IDetectableCtx detectable)
throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
removeActiveDetectable in interface IWorkframeCtxdetectable - the IDetectableCtx for the detectable to be removed as an active detectable
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if the detectable is null or no active detectables exist
or the specified detectable is not found
public java.util.ListIterator getActiveDetectables()
throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
getActiveDetectables in interface IWorkframeCtxgov.nasa.arc.brahms.common.exceptions.BrahmsException - if no active detectables existpublic boolean handleDiscreteEvent(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
handleDiscreteEvent in interface gov.nasa.arc.brahms.vm.events.IDiscreteEventHandlerhandleDiscreteEvent in class VMFrameCtxevt - the DiscreteEvent to be processed.
public void onStart(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
onStart in class VMFrameCtxevt - the DiscreteEvent that initiated the start of the framepublic void onEnd(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
onEnd in class VMFrameCtxevt - the DiscreteEvent that initiated the end of the framepublic void onInterrupt(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
evt - the DiscreteEvent that initiated the interruption of the framepublic void onContinue(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
evt - the DiscreteEvent that initiated the continuation of the framepublic void onImpasse(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
evt - the DiscreteEvent that initiated the impasse of the framepublic void onContinueFromImpasse(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
evt - the DiscreteEvent that initiated the continuation of the frame from an impassepublic void onAbort(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
evt - the DiscreteEvent that initiated the abort of the framepublic void onComplete(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
evt - the DiscreteEvent that initiated the completion of the framepublic void onCompleteFinal(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt)
evt - the DiscreteEvent that initiated the completion of the frame
protected void updateDeltaEventTime(IActivityCtx activity,
long deltaTime)
activity - the activity for which to update the eventdeltaTime - the new delta time
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||