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

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.ConsequenceCtx
All Implemented Interfaces:
IBrahmsObjectCtx, IConditionCtx, IConsequenceCtx, IRuntimeConstants, java.io.Serializable
Direct Known Subclasses:
VMConsequenceCtx

public class ConsequenceCtx
extends ConditionCtx
implements IConsequenceCtx

The ConsequenceCtx defines the context for a fired consequence defining the consequence that was fired, what frame fired the consequence and defining what beliefs and/or facts were created by the consequence.

Version:
10 November 1999
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
ConsequenceCtx(Consequence consequence)
          Constructor, creates a new consequence context for the specified consequence.
 
Method Summary
 void addCreatedStatement(IStatementCtx statement)
          Adds the specified statement (belief or fact) as a statement created by this consequence.
 void addUsedVariable(VariableCtx var)
          Adds the specified variable as a variable used by this consequence.
 java.util.Enumeration getCreatedStatements()
          Returns a list of all the statements (facts and beliefs) created by this consequence.
 IFrameCtx getParent()
          Returns the parent frame context in which this consequence is fired.
 java.util.Enumeration getUsedVariables()
          Returns a list of all the variables used by this consequence.
 void removeCreatedStatement(IStatementCtx statement)
          Removes the specified statement (belief or fact) as a statement created by this consequence.
 void removeUsedVariable(VariableCtx var)
          Removes the specified variable as a variable used by this consequence.
 void setParent(IFrameCtx parent)
          Sets the parent frame context in which this consequence is fired.
 java.lang.String toString()
          Returns the string representation of the consequence context, returning the id and the consequence itself.
 
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.IBrahmsObjectCtx
addNote, getContextFor, getEndTime, getID, getNote, getNotes, getStartTime, removeNote, setEndTime, setID, setStartTime
 

Constructor Detail

ConsequenceCtx

public ConsequenceCtx(Consequence consequence)
Constructor, creates a new consequence context for the specified consequence.

Parameters:
consequence - the fired consequence for which this context is the 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 consequence is fired.

Specified by:
setParent in interface IConsequenceCtx
Parameters:
parent - the IFrameCtx in which the consequence is fired
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 consequence is fired.

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

addCreatedStatement

public void addCreatedStatement(IStatementCtx statement)
                         throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Adds the specified statement (belief or fact) as a statement created by this consequence.

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

removeCreatedStatement

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

Specified by:
removeCreatedStatement in interface IConsequenceCtx
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

getCreatedStatements

public java.util.Enumeration getCreatedStatements()
                                           throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns a list of all the statements (facts and beliefs) created by this consequence.

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

addUsedVariable

public void addUsedVariable(VariableCtx var)
                     throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Adds the specified variable as a variable used by this consequence.

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

removeUsedVariable

public void removeUsedVariable(VariableCtx var)
                        throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Removes the specified variable as a variable used by this consequence.

Specified by:
removeUsedVariable in interface IConsequenceCtx
Parameters:
var - the variable (VariableCtx) 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

getUsedVariables

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

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

toString

public java.lang.String toString()
Returns the string representation of the consequence context, returning the id and the consequence itself.

Overrides:
toString in class java.lang.Object
Returns:
String the string representation of the consequence context


Copyright © 1997-2012 All Rights Reserved.