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

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

public class UnavailableCtx
extends FrameStateCtx

The UnavailableCtx manages information about the unavailable state of a frame. The unavailable state is entered by a frame when the frame was available and one or more of its preconditions evaluated to false due to a change in the belief or fact set. This context maintains when the frame enters the unavailable state and when the frame leaves the unavailable state. This context also defines the contexts of the beliefs or facts (statement) that caused a precondition to evaluate to false.

Version:
28 July 2000
Author:
Ron van Hoof
See Also:
FrameStateCtx, Serialized Form

Field Summary
static byte DETECTABLE
          Indicates as the cause for unavailability the end of a composite activity caused by a detectable (abort or complete)
static byte RETRACTION
          Indicates as the cause for unavailability a retracted statement
 
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
UnavailableCtx(IFrameCtx frame)
          Constructor, creates a new UnavailableCtx for the specified frame
 
Method Summary
 void addCausingStatement(StatementCtx statement)
          Adds the specified statement (belief or fact) as a statement causing a precondition to evaluate to false.
 byte getCause()
          Returns the cause of the unavailability, either RETRACTION when a statement was retracted causing the frame to become unavailable or DETECTABLE when a composite activity was aborted or completed by a detectable.
 DetectableCtx getCausingDetectable()
          Returns the detectable causing the unavailability of the frame.
 java.util.Enumeration getCausingStatements()
          Returns a list of all the statements (facts or beliefs) causing a precondition to evaluate to false.
 int getState()
          Returns the state identifier
 java.lang.String getStateName()
          Returns the name of the state
 void removeCausingStatement(StatementCtx statement)
          Removes the specified statement (belief or fact) as a statement causing a precondition to evaluate to false.
 void setCause(byte cause)
          Sets the cause of the unavailability, either RETRACTION when a statement was retracted causing the frame to become unavailable or DETECTABLE when a composite activity was aborted or completed by a detectable.
 void setCausingDetectable(DetectableCtx detectable)
          Sets the detectable causing the unavailability of the frame.
 
Methods inherited from class gov.nasa.arc.brahms.common.rt.FrameStateCtx
getFrame, getNextFrameState, getPreviousFrameState, setFrame, setNextFrameState, setPreviousFrameState
 
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

RETRACTION

public static final byte RETRACTION
Indicates as the cause for unavailability a retracted statement

See Also:
Constant Field Values

DETECTABLE

public static final byte DETECTABLE
Indicates as the cause for unavailability the end of a composite activity caused by a detectable (abort or complete)

See Also:
Constant Field Values
Constructor Detail

UnavailableCtx

public UnavailableCtx(IFrameCtx frame)
               throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Constructor, creates a new UnavailableCtx for the specified frame

Parameters:
frame - the IFrameCtx that is set to unavailable
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if frame specified is null
Method Detail

getState

public int getState()
Returns the state identifier

Overrides:
getState in class FrameStateCtx
Returns:
int the state id

getStateName

public java.lang.String getStateName()
Returns the name of the state

Overrides:
getStateName in class FrameStateCtx
Returns:
String the name of the state

setCause

public void setCause(byte cause)
              throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Sets the cause of the unavailability, either RETRACTION when a statement was retracted causing the frame to become unavailable or DETECTABLE when a composite activity was aborted or completed by a detectable.

Parameters:
cause - the cause for the unavailability
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if an invalid is cause is specified
See Also:
RETRACTION, DETECTABLE

getCause

public byte getCause()
              throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the cause of the unavailability, either RETRACTION when a statement was retracted causing the frame to become unavailable or DETECTABLE when a composite activity was aborted or completed by a detectable. The methods getCausingStatements or getCausingDetectable provide the detailed information for the cause.

Parameters:
cause - the cause for the unavailability
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no cause is specified
See Also:
RETRACTION, DETECTABLE, getCausingStatements(), getCausingDetectable()

addCausingStatement

public void addCausingStatement(StatementCtx statement)
                         throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Adds the specified statement (belief or fact) as a statement causing a precondition to evaluate to false.

Parameters:
statement - the statement (BeliefCtx or FactCtx) to be added
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if statement is null

removeCausingStatement

public void removeCausingStatement(StatementCtx statement)
                            throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Removes the specified statement (belief or fact) as a statement causing a precondition to evaluate to false.

Parameters:
statement - the statement to be removed
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if statement is null, no statements are present, or the statements is not found

getCausingStatements

public java.util.Enumeration getCausingStatements()
                                           throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns a list of all the statements (facts or beliefs) causing a precondition to evaluate to false.

Returns:
Enumeration an enumeration of BeliefCtx or FactCtx
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if there are no statements

setCausingDetectable

public void setCausingDetectable(DetectableCtx detectable)
                          throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Sets the detectable causing the unavailability of the frame.

Parameters:
detectable - the DetectableCtx for the detectable causing the unavailability
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no detectable is specified.

getCausingDetectable

public DetectableCtx getCausingDetectable()
                                   throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the detectable causing the unavailability of the frame.

Returns:
DetectableCtx the context for the detectable causing the unavailability
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no detectable is specified.


Copyright © 1997-2012 All Rights Reserved.