gov.nasa.arc.brahms.common.rt
Interface IFrameCtx

All Superinterfaces:
IBrahmsObjectCtx
All Known Subinterfaces:
IThoughtframeCtx, IWorkframeCtx
All Known Implementing Classes:
FrameCtx, ThoughtframeCtx, VMFrameCtx, VMThoughtframeCtx, VMWorkframeCtx, WorkframeCtx

public interface IFrameCtx
extends IBrahmsObjectCtx

The IFrameCtx is an interface for frame contexts that maintain 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.

Version:
28 July 2000
Author:
Ron van Hoof

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.
 
Methods inherited from interface gov.nasa.arc.brahms.common.rt.IBrahmsObjectCtx
addNote, getContextFor, getEndTime, getID, getNote, getNotes, getStartTime, removeNote, setEndTime, setID, setStartTime
 

Method Detail

setPriority

void setPriority(int priority)
                 throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Sets the priority of the frame context. The priority is calculated by the virtual machine based on the priorities of its activities.

Parameters:
priority - the frame context's priority
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if an invalid priority is specified (< 0)

getPriority

int getPriority()
                throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the priority of the frame context. The priority is calculated by the virtual machine based on the priorities of its activities.

Returns:
int the frame context's priority
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no priority is set

setPerformedBy

void setPerformedBy(IActiveInstanceCtx ai)
                    throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Sets the active instance executing the frame.

Parameters:
ai - the active instance executing the frame.
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if a null active instance is specified

getPerformedBy

IActiveInstanceCtx getPerformedBy()
                                  throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the active instance executing the frame.

Returns:
IActiveInstanceCtx the active instance executing the frame.
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no active instance is specified

setPerformedIn

void setPerformedIn(ICompositeActivityCtx act)
                    throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
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.

Parameters:
act - the ICompositeActivityCtx of the composite activity in which the frame is performed.
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if a null composite activity is specified.

getPerformedIn

ICompositeActivityCtx getPerformedIn()
                                     throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
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.

Returns:
ICompositeActivityCtx the composite activity in which the frame is performed or null if the frame is not performed in a composite activity.
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if an internal error occurs.

setStatus

void setStatus(int status)
               throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Sets the frame's current status.

Parameters:
status - the status of the frame context
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if status is an invalid status
See Also:
IRuntimeConstants.UNAVAILABLE, IRuntimeConstants.AVAILABLE, IRuntimeConstants.ACTIVE, IRuntimeConstants.INTERRUPTED, IRuntimeConstants.IMPASSED, IRuntimeConstants.ABORTED, IRuntimeConstants.COMPLETED, IRuntimeConstants.ENDED

getStatus

int getStatus()
              throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the frame's current status.

Returns:
int the status of the frame context
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if frame context has no status or invalid status
See Also:
IRuntimeConstants.UNAVAILABLE, IRuntimeConstants.AVAILABLE, IRuntimeConstants.ACTIVE, IRuntimeConstants.INTERRUPTED, IRuntimeConstants.IMPASSED, IRuntimeConstants.ABORTED, IRuntimeConstants.COMPLETED, IRuntimeConstants.ENDED

setState

void setState(FrameStateCtx state)
Sets the current state of the frame context. No state history is maintained. Any previous state information is discarded.

Parameters:
state - the FrameStateCtx with the state information
See Also:
ActiveCtx, AvailableCtx, UnavailableCtx, InterruptCtx, ImpasseCtx, CompleteCtx

setState

void setState(FrameStateCtx state,
              boolean maintainHistory)
Sets the current state of the frame context. Depending on the maintainHistory indicator a history of the states is maintained by linking the states in a list (maintainHistory == true). If maintainHistory is false no history is maintained and any previous state information is discarded.

Parameters:
state - the FrameStateCtx with the state information
maintainHistory - true if history must be maintained, false otherwise
See Also:
ActiveCtx, AvailableCtx, UnavailableCtx, InterruptCtx, ImpasseCtx, CompleteCtx

getState

FrameStateCtx getState()
Returns the current state of the frame context. If a history was maintained the history can be traversed using the states getPreviousFrameState and getNextFrameState methods.

Returns:
FrameStateCtx the current state of the frame context, null if no state is set yet
See Also:
ActiveCtx, AvailableCtx, UnavailableCtx, InterruptCtx, ImpasseCtx, CompleteCtx

setTimeAvailable

void setTimeAvailable(long time)
Sets the time the frame became available to work on.

Parameters:
time - the time the frame became available in simulation units

getTimeAvailable

long getTimeAvailable()
Returns the time the frame became available to work on.

Returns:
long the time the frame became available in simulation units

addBinding

void addBinding(VariableCtx var)
                throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Adds the specified variable binding to this frame context.

Parameters:
var - the VariableCtx to be added
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if the specified variable is null.

removeBinding

void removeBinding(VariableCtx var)
                   throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Removes the specified variable binding from this frame context.

Parameters:
var - the VariableCtx to be removed
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if a null variable is specified, no bindings are present or the specified variable is not present

getBinding

VariableCtx getBinding(Variable var)
                       throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the binding for the specified variable.

Parameters:
var - the variable for which the binding is requested
Returns:
VariableCtx the binding for the specified variable
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no binding for the specified variable exists

getBindings

java.util.Enumeration getBindings()
                                  throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the frame context's variable bindings.

Returns:
Enumeration an enumeration of VariableCtx's
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if frame context has no bindings

addFiredConsequence

void addFiredConsequence(ConsequenceCtx consequence)
                         throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Adds the specified consequence as a fired consequence to the list of fired consequences.

Parameters:
consequence - the ConsequenceCtx for the consequence fired in the frame
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if the consequence is null

removeFiredConsequence

void removeFiredConsequence(ConsequenceCtx consequence)
                            throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Removes the specified consequence as a fired consequence from the list of fired consequences.

Parameters:
consequence - the ConsequenceCtx for the consequence fired in the frame
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if the consequence is null or no fired consequences exist or the specified consequence is not found

getFiredConsequences

java.util.ListIterator getFiredConsequences()
                                            throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the list of fired consequences.

Returns:
ListIterator the list of fired consequences (ConsequenceCtx)
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no fired consequences exist


Copyright © 1997-2012 All Rights Reserved.