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

java.lang.Object
  extended by gov.nasa.arc.brahms.common.rt.BrahmsObjectCtx
      extended by gov.nasa.arc.brahms.common.rt.ConditionCtx
          extended by gov.nasa.arc.brahms.common.rt.PreconditionCtx
All Implemented Interfaces:
IBrahmsObjectCtx, IConditionCtx, IPreconditionCtx, IRuntimeConstants, java.io.Serializable
Direct Known Subclasses:
VMPreconditionCtx

public class PreconditionCtx
extends ConditionCtx
implements IPreconditionCtx

The PreconditionCtx defines the context for a precondition defining the beliefs or facts that made the precondition evaluate to true and defining the frame for which the precondition evaluated to true.

Version:
1 August 2000
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
PreconditionCtx(Precondition precondition)
          Constructor, creates a new precondition context for the specified precondition
 
Method Summary
 void addBoundVariable(IVariableCtx var)
          Adds the specified variable as a variable bound by this precondition.
 void addEvaluatedStatement(IStatementCtx statement)
          Adds the specified statement (belief or fact) as a statement evaluated by this precondition causing this precondition to evaluate to true.
 java.util.Enumeration getBoundVariables()
          Returns a list of all the variables bound by this precondition.
 java.util.Enumeration getEvaluatedStatements()
          Returns a list of all the statements (facts or beliefs) evaluated by this precondition to result in the precondition evaluating to true.
 IFrameCtx getParent()
          Returns the parent frame context in which this precondition is evaluated.
 void removeBoundVariable(IVariableCtx var)
          Removes the specified variable as a variable bound by this precondition.
 void removeEvaluatedStatement(IStatementCtx statement)
          Removes the specified statement (belief or fact) as a statement evaluated by this precondition.
 void setParent(IFrameCtx parent)
          Sets the parent frame context in which this precondition is evaluated.
 
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
 
Methods inherited from interface gov.nasa.arc.brahms.common.rt.IBrahmsObjectCtx
addNote, getContextFor, getEndTime, getID, getNote, getNotes, getStartTime, removeNote, setEndTime, setID, setStartTime
 

Constructor Detail

PreconditionCtx

public PreconditionCtx(Precondition precondition)
Constructor, creates a new precondition context for the specified precondition

Parameters:
precondition - the precondition for which this is a context
Method Detail

setParent

public void setParent(IFrameCtx parent)
               throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Sets the parent frame context in which this precondition is evaluated.

Specified by:
setParent in interface IPreconditionCtx
Parameters:
parent - the IFrameCtx in which the precondition is evaluated.
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if a null parent is specified

getParent

public IFrameCtx getParent()
                    throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the parent frame context in which this precondition is evaluated.

Specified by:
getParent in interface IPreconditionCtx
Returns:
IFrameCtx the parent frame in which the precondition is evaluated.
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no parent is specified

addEvaluatedStatement

public void addEvaluatedStatement(IStatementCtx statement)
                           throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Adds the specified statement (belief or fact) as a statement evaluated by this precondition causing this precondition to evaluate to true.

Specified by:
addEvaluatedStatement in interface IPreconditionCtx
Parameters:
statement - the statement (IBeliefCtx or IFactCtx) to be added
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if statement is null

removeEvaluatedStatement

public void removeEvaluatedStatement(IStatementCtx statement)
                              throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Removes the specified statement (belief or fact) as a statement evaluated by this precondition.

Specified by:
removeEvaluatedStatement in interface IPreconditionCtx
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

getEvaluatedStatements

public java.util.Enumeration getEvaluatedStatements()
                                             throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns a list of all the statements (facts or beliefs) evaluated by this precondition to result in the precondition evaluating to true.

Specified by:
getEvaluatedStatements in interface IPreconditionCtx
Returns:
Enumeration an enumeration of IBeliefCtx or IFactCtx
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if there are no statements

addBoundVariable

public void addBoundVariable(IVariableCtx var)
                      throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Adds the specified variable as a variable bound by this precondition.

Specified by:
addBoundVariable in interface IPreconditionCtx
Parameters:
var - the variable (IVariableCtx) to be added
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if var is null

removeBoundVariable

public void removeBoundVariable(IVariableCtx var)
                         throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Removes the specified variable as a variable bound by this precondition.

Specified by:
removeBoundVariable in interface IPreconditionCtx
Parameters:
var - the variable (IVariableCtx) to be removed
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if variable is null, no variables are present, or the variable is not found

getBoundVariables

public java.util.Enumeration getBoundVariables()
                                        throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns a list of all the variables bound by this precondition.

Specified by:
getBoundVariables in interface IPreconditionCtx
Returns:
Enumeration an enumeration of IVariableCtx
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if there are no variables


Copyright © 1997-2012 All Rights Reserved.