gov.nasa.arc.brahms.common.rt
Class CompositeActivityCtx

java.lang.Object
  extended by gov.nasa.arc.brahms.common.rt.BrahmsObjectCtx
      extended by gov.nasa.arc.brahms.common.rt.ActivityCtx
          extended by gov.nasa.arc.brahms.common.rt.CompositeActivityCtx
All Implemented Interfaces:
IActivityCtx, IBrahmsObjectCtx, ICompositeActivityCtx, IRuntimeConstants, java.io.Serializable

public class CompositeActivityCtx
extends ActivityCtx
implements ICompositeActivityCtx

The CompositeActivityCtx maintains the context of a composite activity being or to be executed by an active instance. The context maintains start and end times for an activity, the duration, priority, status, state of the frames that are part of the composite activity and the active detectables of the composite activity.

Version:
$Revision: 1.2 $ $Date: 2008/09/26 17:59:31 $ $Author: rvhoof $
Author:
Ron van Hoof
See Also:
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
CompositeActivityCtx(CompositeActivity act)
          Constructor, creates a new context for the specified CompositeActivity.
 
Method Summary
 void addActiveDetectable(IDetectableCtx detectable)
          Adds the specified detectable as an active detectable to the list of active detectables.
 void addAvailableFrame(IFrameCtx frame)
          Adds the specified frame context as an available frame.
 void addCompletedFrame(IFrameCtx frame)
          Adds the given frame context as a completed frame.
 void addImpassedFrame(IWorkframeCtx frame)
          Adds the specified frame context as an impassed frame.
 void addInterruptedFrame(IWorkframeCtx frame)
          Adds the specified frame context as an interrupted frame.
 java.util.ListIterator getActiveDetectables()
          Returns the list of active detectables.
 java.util.ListIterator getAvailableThoughtframes()
          Returns a list of all the available thoughtframes.
 java.util.ListIterator getAvailableWorkframes()
          Returns a list of all the available workframes.
 java.util.Set<java.lang.String> getCompletedThoughtframeNames()
          Return a list of the fully qualified names for all the thoughtframes for which completed thoughtframe contexts exist.
 java.util.ListIterator getCompletedThoughtframes(java.lang.String frameName)
          Return a list of all the completed thoughtframe contexts for the thoughtframe with the specified fully qualified name.
 java.util.Set<java.lang.String> getCompletedWorkframeNames()
          Return a list of the fully qualified names for all the workframes for which completed workframe contexts exist.
 java.util.ListIterator getCompletedWorkframes(java.lang.String frameName)
          Return a list of all the completed workframe contexts for the workframe with the specified fully qualified name.
 IWorkframeCtx getCurrentWork()
          Returns the workframe currently active in the activity.
 java.util.ListIterator getImpassedFrames()
          Returns a list of all the impassed workframes.
 java.util.ListIterator getInterruptedFrames()
          Returns a list of all the interrupted workframes.
protected  IThoughtframeCtx getPriorityAvailableThoughtframe()
          Returns the highest priority available thoughtframe.
protected  IWorkframeCtx getPriorityAvailableWorkframe()
          Returns the highest priority available workframe.
protected  IWorkframeCtx getPriorityInterruptedFrame()
          Returns the highest priority interrupted workframe.
 boolean hasAvailableThoughtframes()
          Inficates whether there are any available thoughtframes.
 boolean hasAvailableWorkframes()
          Inficates whether there are any available workframes.
 boolean hasCompletedThoughtframes()
          Inficates whether there are any completed thoughtframes.
 boolean hasCompletedWorkframes()
          Inficates whether there are any completed workframes.
 boolean hasImpassedFrames()
          Inficates whether there are any impassed workframes.
 boolean hasInterruptedFrames()
          Inficates whether there are any interrupted workframes.
 void removeActiveDetectable(IDetectableCtx detectable)
          Removes the specified detectable as an active detectable from the list of active detectables.
 void removeAvailableFrame(IFrameCtx frame)
          Removes the specifies frame as an available frame.
 void removeCompletedFrame(IFrameCtx frame)
          Removes the given frame context as a completed frame context
 void removeImpassedFrame(IWorkframeCtx frame)
          Removes the specified frame context as an impassed frame.
 void removeInterruptedFrame(IWorkframeCtx frame)
          Removes the specified frame context as an interrupted frame.
 void setCurrentWork(IWorkframeCtx frame)
          Sets the workframe currently active in the activity
 
Methods inherited from class gov.nasa.arc.brahms.common.rt.ActivityCtx
getCompletionCause, getDisplayText, getParentFrame, getPerformedBy, getPriority, getReferencedBy, getState, getStatus, setCompletionCause, setDisplayText, setParentFrame, setPerformedBy, setPriority, setReferencedBy, setState, setState, setStatus, 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.IActivityCtx
getCompletionCause, getDisplayText, getParentFrame, getPerformedBy, getPriority, getReferencedBy, getStatus, setCompletionCause, setDisplayText, setParentFrame, setPerformedBy, setReferencedBy, setStatus
 
Methods inherited from interface gov.nasa.arc.brahms.common.rt.IBrahmsObjectCtx
addNote, getContextFor, getEndTime, getID, getNote, getNotes, getStartTime, removeNote, setEndTime, setID, setStartTime
 

Constructor Detail

CompositeActivityCtx

public CompositeActivityCtx(CompositeActivity act)
Constructor, creates a new context for the specified CompositeActivity.

Parameters:
act - the CompositeActivity for which to create a context
Method Detail

addAvailableFrame

public void addAvailableFrame(IFrameCtx frame)
                       throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Adds the specified frame context as an available frame.

Specified by:
addAvailableFrame in interface ICompositeActivityCtx
Parameters:
frame - the available work or thoughtframe
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if frame is null

removeAvailableFrame

public void removeAvailableFrame(IFrameCtx frame)
                          throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Removes the specifies frame as an available frame.

Specified by:
removeAvailableFrame in interface ICompositeActivityCtx
Parameters:
frame - the frame to be removed as an available frame.
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if a null frame is specified, no available frames are present or the specified frame is not present

getAvailableWorkframes

public java.util.ListIterator getAvailableWorkframes()
                                              throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns a list of all the available workframes.

Specified by:
getAvailableWorkframes in interface ICompositeActivityCtx
Returns:
ListIterator an iterator returning a list of IWorkframeCtx
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if there are no available workframes

hasAvailableWorkframes

public boolean hasAvailableWorkframes()
Inficates whether there are any available workframes.

Specified by:
hasAvailableWorkframes in interface ICompositeActivityCtx
Returns:
boolean true if there are one or more available workframe instantiations, false otherwise

hasAvailableThoughtframes

public boolean hasAvailableThoughtframes()
Inficates whether there are any available thoughtframes.

Specified by:
hasAvailableThoughtframes in interface ICompositeActivityCtx
Returns:
boolean true if there are one or more available thoughtframe instantiations, false otherwise

getAvailableThoughtframes

public java.util.ListIterator getAvailableThoughtframes()
                                                 throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns a list of all the available thoughtframes.

Specified by:
getAvailableThoughtframes in interface ICompositeActivityCtx
Returns:
ListIterator an iterator returning a list of IThoughtframeCtx
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if there are no available thoughtframes

getPriorityAvailableWorkframe

protected IWorkframeCtx getPriorityAvailableWorkframe()
Returns the highest priority available workframe.

Returns:
IWorkframeCtx the context of the highest priority available workframe, null if there are no available workframes.

getPriorityAvailableThoughtframe

protected IThoughtframeCtx getPriorityAvailableThoughtframe()
Returns the highest priority available thoughtframe.

Returns:
IThoughtframeCtx the context of the highest priority available thoughtframe, null if there are no available thoughtframes.

addInterruptedFrame

public void addInterruptedFrame(IWorkframeCtx frame)
                         throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Adds the specified frame context as an interrupted frame.

Specified by:
addInterruptedFrame in interface ICompositeActivityCtx
Parameters:
frame - the interrupted workframe to be added
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if frame is null

removeInterruptedFrame

public void removeInterruptedFrame(IWorkframeCtx frame)
                            throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Removes the specified frame context as an interrupted frame.

Specified by:
removeInterruptedFrame in interface ICompositeActivityCtx
Parameters:
frame - the interrupted workframe to be removed
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if frame is null, no interrupted frames are available, or the frame is not present as an interrupted frame

getInterruptedFrames

public java.util.ListIterator getInterruptedFrames()
                                            throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns a list of all the interrupted workframes.

Specified by:
getInterruptedFrames in interface ICompositeActivityCtx
Returns:
ListIterator an iterator returning a list of IWorkframeCtx
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if there are no interrupted workframes

hasInterruptedFrames

public boolean hasInterruptedFrames()
Inficates whether there are any interrupted workframes.

Specified by:
hasInterruptedFrames in interface ICompositeActivityCtx
Returns:
boolean true if there are one or more interrupted workframe instantiations, false otherwise

getPriorityInterruptedFrame

protected IWorkframeCtx getPriorityInterruptedFrame()
Returns the highest priority interrupted workframe.

Returns:
IWorkframeCtx the context of the highest priority interrupted workframe, null if there are no interrupted workframes.

addImpassedFrame

public void addImpassedFrame(IWorkframeCtx frame)
                      throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Adds the specified frame context as an impassed frame.

Specified by:
addImpassedFrame in interface ICompositeActivityCtx
Parameters:
frame - the impassed workframe to be added
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if frame is null

removeImpassedFrame

public void removeImpassedFrame(IWorkframeCtx frame)
                         throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Removes the specified frame context as an impassed frame.

Specified by:
removeImpassedFrame in interface ICompositeActivityCtx
Parameters:
frame - the impassed workframe to be removed
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if frame is null, no impassed frames are available, or the frame is not present as an impassed frame

getImpassedFrames

public java.util.ListIterator getImpassedFrames()
                                         throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns a list of all the impassed workframes.

Specified by:
getImpassedFrames in interface ICompositeActivityCtx
Returns:
ListIterator an iterator returning a list of IWorkframeCtx
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if there are no impassed workframes

hasImpassedFrames

public boolean hasImpassedFrames()
Inficates whether there are any impassed workframes.

Specified by:
hasImpassedFrames in interface ICompositeActivityCtx
Returns:
boolean true if there are one or more impassed workframe instantiations, false otherwise

addCompletedFrame

public void addCompletedFrame(IFrameCtx frame)
                       throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Adds the given frame context as a completed frame. This method is used by the virtual machine to store non repearing frames and this method can be used by other components to store a history of executed frames.

Specified by:
addCompletedFrame in interface ICompositeActivityCtx
Parameters:
frame - the IFrameCtx to be added as a completed frame
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if frame context is null or frame context references no frame

removeCompletedFrame

public void removeCompletedFrame(IFrameCtx frame)
                          throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Removes the given frame context as a completed frame context

Specified by:
removeCompletedFrame in interface ICompositeActivityCtx
Parameters:
frame - the frame context to be removed
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if frame is null, no completed frames exist for the frame for which the specified frame is a context or if the specified frame context is not found or if the specified frame is not referencing a workframe or thoughtframe

getCompletedWorkframes

public java.util.ListIterator getCompletedWorkframes(java.lang.String frameName)
                                              throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Return a list of all the completed workframe contexts for the workframe with the specified fully qualified name.

Specified by:
getCompletedWorkframes in interface ICompositeActivityCtx
Parameters:
frameName - the fully qualified name for the workframe
Returns:
ListIterator the list of completed IWorkframeCtx
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if an invalid name is specified or no completed frames exist

getCompletedWorkframeNames

public java.util.Set<java.lang.String> getCompletedWorkframeNames()
                                                           throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Return a list of the fully qualified names for all the workframes for which completed workframe contexts exist.

Specified by:
getCompletedWorkframeNames in interface ICompositeActivityCtx
Returns:
Set the names of workframes for which completed IWorkframeCtx exist
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no completed frames exist

hasCompletedWorkframes

public boolean hasCompletedWorkframes()
Inficates whether there are any completed workframes.

Specified by:
hasCompletedWorkframes in interface ICompositeActivityCtx
Returns:
boolean true if there are one or more completed workframe instantiations, false otherwise

getCompletedThoughtframes

public java.util.ListIterator getCompletedThoughtframes(java.lang.String frameName)
                                                 throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Return a list of all the completed thoughtframe contexts for the thoughtframe with the specified fully qualified name.

Specified by:
getCompletedThoughtframes in interface ICompositeActivityCtx
Parameters:
frameName - the fully qualified name for the thoughtframe
Returns:
ListIterator the list of completed IThoughtframeCtx
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if an invalid name is specified or no completed frames exist

getCompletedThoughtframeNames

public java.util.Set<java.lang.String> getCompletedThoughtframeNames()
                                                              throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Return a list of the fully qualified names for all the thoughtframes for which completed thoughtframe contexts exist.

Specified by:
getCompletedThoughtframeNames in interface ICompositeActivityCtx
Returns:
Set the names of thoughtframes for which completed IThoughtframeCtx exist
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no completed frames exist

hasCompletedThoughtframes

public boolean hasCompletedThoughtframes()
Inficates whether there are any completed thoughtframes.

Specified by:
hasCompletedThoughtframes in interface ICompositeActivityCtx
Returns:
boolean true if there are one or more completed thoughtframe instantiations, false otherwise

setCurrentWork

public void setCurrentWork(IWorkframeCtx frame)
Sets the workframe currently active in the activity

Specified by:
setCurrentWork in interface ICompositeActivityCtx
Parameters:
frame - the current work (IWorkframeCtx) of the activity

getCurrentWork

public IWorkframeCtx getCurrentWork()
Returns the workframe currently active in the activity. Thoughtframes take no time and are therefor never set as current work.

Specified by:
getCurrentWork in interface ICompositeActivityCtx
Returns:
IWorkframeCtx the current work of the activity, null if the activity has no current work

addActiveDetectable

public void addActiveDetectable(IDetectableCtx detectable)
                         throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Adds the specified detectable as an active detectable to the list of active detectables. An active detectable is actively checked while the activity is active.

Specified by:
addActiveDetectable in interface ICompositeActivityCtx
Parameters:
detectable - the IDetectableCtx for the detectable active in the activity
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if the detectable is null

removeActiveDetectable

public void removeActiveDetectable(IDetectableCtx detectable)
                            throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Removes the specified detectable as an active detectable from the list of active detectables.

Specified by:
removeActiveDetectable in interface ICompositeActivityCtx
Parameters:
detectable - the IDetectableCtx for the detectable to be removed as an active detectable
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if the detectable is null or no active detectables exist or the specified detectable is not found

getActiveDetectables

public java.util.ListIterator getActiveDetectables()
                                            throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the list of active detectables.

Specified by:
getActiveDetectables in interface ICompositeActivityCtx
Returns:
ListIterator the list of active detectables (IDetectableCtx)
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no active detectables exist


Copyright © 1997-2012 All Rights Reserved.