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

java.lang.Object
  extended by gov.nasa.arc.brahms.common.rt.BrahmsObjectCtx
      extended by gov.nasa.arc.brahms.common.rt.TriggerCtx
All Implemented Interfaces:
IBrahmsObjectCtx, IDetectableActionCtx, IRuntimeConstants, ITriggerCtx, java.io.Serializable
Direct Known Subclasses:
VMTriggerCtx

public class TriggerCtx
extends BrahmsObjectCtx
implements ITriggerCtx

The TriggerCtx is a detectable action or custom action that maintains the information about when the trigger or action part of the detectable was executed and what belief or event triggered the action.

Version:
2 October 2003
Author:
Ron van Hoof
See Also:
ITriggerCtx, IDetectableCtx, 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
TriggerCtx(IDetectableCtx parent)
          Constructor, creates a new context for a trigger action for the specified detectable.
TriggerCtx(java.lang.String activator)
          Constructor, creates a new context for a trigger action specified by the activator string.
 
Method Summary
 void addUsedVariable(IVariableCtx var)
          Adds the specified variable as a variable used by this detectable.
 java.lang.String getActivator()
          Returns the the activator for the trigger if the trigger was not related to a detectable.
 IDetectableCtx getParent()
          Returns the detectable context for which this trigger was executed.
 IBeliefCtx getTriggeringBelief()
          Returns the belief that triggered this trigger.
 java.util.Enumeration getUsedVariables()
          Returns a list of all the variables used by this detectable.
 void removeUsedVariable(IVariableCtx var)
          Removes the specified variable as a variable used by this detectable.
 void setTriggeringBelief(IBeliefCtx belief)
          Sets the belief that activated this trigger.
 
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

TriggerCtx

public TriggerCtx(IDetectableCtx parent)
Constructor, creates a new context for a trigger action for the specified detectable.

Parameters:
parent - the parent IDetectableCtx

TriggerCtx

public TriggerCtx(java.lang.String activator)
Constructor, creates a new context for a trigger action specified by the activator string.

Parameters:
activator - the activator for the trigger
Method Detail

getParent

public IDetectableCtx getParent()
                         throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the detectable context for which this trigger was executed.

Specified by:
getParent in interface IDetectableActionCtx
Returns:
IDetectableCtx the parent
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - when no parent is specified

getActivator

public java.lang.String getActivator()
                              throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the the activator for the trigger if the trigger was not related to a detectable.

Returns:
String the activator
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - when no activator is specified

setTriggeringBelief

public void setTriggeringBelief(IBeliefCtx belief)
                         throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Sets the belief that activated this trigger.

Specified by:
setTriggeringBelief in interface ITriggerCtx
Parameters:
belief - the belief that triggered this trigger
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if a null belief is specified

getTriggeringBelief

public IBeliefCtx getTriggeringBelief()
                               throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns the belief that triggered this trigger.

Specified by:
getTriggeringBelief in interface ITriggerCtx
Returns:
IBeliefCtx the belief that triggered this trigger
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no triggering belief is specified

addUsedVariable

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

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

removeUsedVariable

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

Specified by:
removeUsedVariable in interface ITriggerCtx
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

getUsedVariables

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

Specified by:
getUsedVariables in interface ITriggerCtx
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.