|
||||||||||
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
public class FrameCtx
The FrameCtx maintains the general state information for a Brahms frame, workframe or thoughtframe. 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 | |
---|---|
FrameCtx(BFrame frame)
Constructor, creates a new context for the specified frame. |
|
FrameCtx(BFrame frame,
IActiveInstanceCtx agent)
Constructor, creates a new context for the specified frame setting the specified agent as the agent working on frame. |
Method Summary | |
---|---|
void |
addBinding(VariableCtx var)
Adds the specified variable binding to this frame context. |
void |
addFiredConsequence(ConsequenceCtx consequence)
Adds the specified consequence as a fired consequence to the list of fired consequences. |
VariableCtx |
getBinding(Variable var)
Returns the binding for the specified variable. |
java.util.Enumeration |
getBindings()
Returns the frame context's variable bindings. |
java.util.ListIterator |
getFiredConsequences()
Returns the list of fired consequences. |
IActiveInstanceCtx |
getPerformedBy()
Returns the active instance executing the frame. |
ICompositeActivityCtx |
getPerformedIn()
If the frame is performed as part of a composite activity this method returns the context of the composite activity in which the frame is performed. |
int |
getPriority()
Returns the priority of the frame context. |
FrameStateCtx |
getState()
Returns the current state of the frame context. |
int |
getStatus()
Returns the frame's current status. |
long |
getTimeAvailable()
Returns the time the frame became available to work on. |
void |
removeBinding(VariableCtx var)
Removes the specified variable binding from this frame context. |
void |
removeFiredConsequence(ConsequenceCtx consequence)
Removes the specified consequence as a fired consequence from the list of fired consequences. |
void |
setPerformedBy(IActiveInstanceCtx ai)
Sets the active instance executing the frame. |
void |
setPerformedIn(ICompositeActivityCtx act)
If the frame is performed as part of a composite activity this method sets the context of the composite activity in which the frame is performed. |
void |
setPriority(int priority)
Sets the priority of the frame context. |
void |
setState(FrameStateCtx state)
Sets the current state of the frame context. |
void |
setState(FrameStateCtx state,
boolean maintainHistory)
Sets the current state of the frame context. |
void |
setStatus(int status)
Sets the frame's current status. |
void |
setTimeAvailable(long time)
Sets the time the frame became available to work on. |
java.lang.String |
toString()
Returns the fully qualified name of the frame this is a context for. |
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 FrameCtx(BFrame frame)
frame
- the BFrame for which this frame context is a contextpublic FrameCtx(BFrame frame, IActiveInstanceCtx agent)
frame
- the BFrame for which this frame context is a contextagent
- the agent working on the frameMethod Detail |
---|
public void setPriority(int priority) throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
setPriority
in interface IFrameCtx
priority
- the frame context's priority
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if an invalid priority is specified (< 0)public int getPriority() throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
getPriority
in interface IFrameCtx
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if no priority is setpublic void setPerformedBy(IActiveInstanceCtx ai) throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
setPerformedBy
in interface IFrameCtx
ai
- the active instance executing the frame.
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if a null active instance is specifiedpublic IActiveInstanceCtx getPerformedBy() throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
getPerformedBy
in interface IFrameCtx
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if no active instance is specifiedpublic void setPerformedIn(ICompositeActivityCtx act) throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
setPerformedIn
in interface IFrameCtx
act
- the ICompositeActivityCtx of the composite activity in
which the frame is performed.
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if a null composite activity is specified.public ICompositeActivityCtx getPerformedIn() throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
getPerformedIn
in interface IFrameCtx
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if an internal error occurs.public void setStatus(int status) throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
setStatus
in interface IFrameCtx
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 int getStatus() throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
getStatus
in interface IFrameCtx
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if frame context has no status or invalid statusIRuntimeConstants.UNAVAILABLE
,
IRuntimeConstants.AVAILABLE
,
IRuntimeConstants.ACTIVE
,
IRuntimeConstants.INTERRUPTED
,
IRuntimeConstants.IMPASSED
,
IRuntimeConstants.ABORTED
,
IRuntimeConstants.COMPLETED
,
IRuntimeConstants.ENDED
public void setState(FrameStateCtx state)
setState
in interface IFrameCtx
state
- the FrameStateCtx with the state informationActiveCtx
,
AvailableCtx
,
UnavailableCtx
,
InterruptCtx
,
ImpasseCtx
,
CompleteCtx
public void setState(FrameStateCtx state, boolean maintainHistory)
setState
in interface IFrameCtx
state
- the FrameStateCtx with the state informationmaintainHistory
- true if history must be maintained, false otherwiseActiveCtx
,
AvailableCtx
,
UnavailableCtx
,
InterruptCtx
,
ImpasseCtx
,
CompleteCtx
public FrameStateCtx getState()
getState
in interface IFrameCtx
ActiveCtx
,
AvailableCtx
,
UnavailableCtx
,
InterruptCtx
,
ImpasseCtx
,
CompleteCtx
public void setTimeAvailable(long time)
setTimeAvailable
in interface IFrameCtx
time
- the time the frame became available in simulation unitspublic long getTimeAvailable()
getTimeAvailable
in interface IFrameCtx
public void addBinding(VariableCtx var) throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
addBinding
in interface IFrameCtx
var
- the VariableCtx to be added
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if the specified variable is null.public void removeBinding(VariableCtx var) throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
removeBinding
in interface IFrameCtx
var
- the VariableCtx to be removed
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if a null variable is specified, no
bindings are present or the specified variable is
not presentpublic VariableCtx getBinding(Variable var) throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
getBinding
in interface IFrameCtx
var
- the variable for which the binding is requested
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if no binding for the specified variable existspublic java.util.Enumeration getBindings() throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
getBindings
in interface IFrameCtx
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if frame context has no bindingspublic void addFiredConsequence(ConsequenceCtx consequence) throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
addFiredConsequence
in interface IFrameCtx
consequence
- the ConsequenceCtx for the consequence fired in the frame
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if the consequence is nullpublic void removeFiredConsequence(ConsequenceCtx consequence) throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
removeFiredConsequence
in interface IFrameCtx
consequence
- the ConsequenceCtx for the consequence fired in the frame
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if the consequence is null or no fired consequences exist
or the specified consequence is not foundpublic java.util.ListIterator getFiredConsequences() throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
getFiredConsequences
in interface IFrameCtx
gov.nasa.arc.brahms.common.exceptions.BrahmsException
- if no fired consequences existpublic java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |