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

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

public class ActivityStateCtx
extends BrahmsObjectCtx

The state of the activities instantiated by the virtual machine is maintained using the ActivityStateCtx. An activity is at any point in time in one of the following states, active, interrupted, impassed, or completed, aborted. The ActivityStateCtx maintains information about the state of the activity, when the activiy entered the state and when the activity left the state. The ActivityStateCtx allows for keeping a linked list of the states an activity went through, where the last state in the list is the current state.

Version:
11 August 2000
Author:
Ron van Hoof
See Also:
Serialized Form

Field Summary
static int ABORT
           
static int ACTIVE
           
static int COMPLETE
           
static int ENDACTIVITY
           
static int IMPASSE
           
static int INTERRUPT
           
 
Fields inherited from interface gov.nasa.arc.brahms.common.rt.IRuntimeConstants
ABORTED, 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
ActivityStateCtx(IActivityCtx activity, int state)
          Constructor, creates a new ActivityStateCtx for the specified activity.
 
Method Summary
 IActivityCtx getActivity()
          Returns the activity for which this state is set
 ActivityStateCtx getNextState()
          Returns the next activity state that follows this activity state for the same activity
 ActivityStateCtx getPreviousState()
          Returns the previous activity state specifying the previous state of this activity state's activity
 int getState()
          Returns the state represented by this state context
 long getStateDuration()
          Returns the total duration of the state
 void setActivity(IActivityCtx activity)
          Sets the activity for which this state is set.
 void setNextState(ActivityStateCtx state)
          Sets the activity state to follow this activity state for the same activity
 void setPreviousState(ActivityStateCtx state)
          Sets the previous activity state specifying the previous state of this activity state's activity
 
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, toString, wait, wait, wait
 

Field Detail

ACTIVE

public static final int ACTIVE
See Also:
Constant Field Values

INTERRUPT

public static final int INTERRUPT
See Also:
Constant Field Values

IMPASSE

public static final int IMPASSE
See Also:
Constant Field Values

COMPLETE

public static final int COMPLETE
See Also:
Constant Field Values

ABORT

public static final int ABORT
See Also:
Constant Field Values

ENDACTIVITY

public static final int ENDACTIVITY
See Also:
Constant Field Values
Constructor Detail

ActivityStateCtx

public ActivityStateCtx(IActivityCtx activity,
                        int state)
                 throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Constructor, creates a new ActivityStateCtx for the specified activity.

Parameters:
activity - the IActivityCtx for which this state is set
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if activity specified is null
See Also:
ACTIVE, INTERRUPT, IMPASSE, COMPLETE, ABORT
Method Detail

getState

public int getState()
Returns the state represented by this state context

Returns:
int the state
See Also:
ACTIVE, INTERRUPT, IMPASSE, COMPLETE, ABORT

setActivity

public void setActivity(IActivityCtx activity)
                 throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Sets the activity for which this state is set.

Parameters:
activity - the activity for which this state is set
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if the specified activity is null

getActivity

public IActivityCtx getActivity()
                         throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the activity for which this state is set

Returns:
IFrameCtx the activity for which this state is set
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no activity is specified

getStateDuration

public long getStateDuration()
Returns the total duration of the state

Returns:
long the total duration, -1 if no start and/or end time is set yet.

setNextState

public void setNextState(ActivityStateCtx state)
Sets the activity state to follow this activity state for the same activity

Parameters:
state - the next ActivityStateCtx

getNextState

public ActivityStateCtx getNextState()
Returns the next activity state that follows this activity state for the same activity

Returns:
activity the next activity state or null if this is the last or current activity state

setPreviousState

public void setPreviousState(ActivityStateCtx state)
Sets the previous activity state specifying the previous state of this activity state's activity

Parameters:
state - the previous ActivityStateCtx

getPreviousState

public ActivityStateCtx getPreviousState()
Returns the previous activity state specifying the previous state of this activity state's activity

Returns:
ActivityStateCtx the previous activity state or null if this is the first activity state


Copyright © 1997-2012 All Rights Reserved.