gov.nasa.arc.brahms.vm.rt
Class VMStatementCtx

java.lang.Object
  extended by gov.nasa.arc.brahms.common.rt.BrahmsObjectCtx
      extended by gov.nasa.arc.brahms.common.rt.StatementCtx
          extended by gov.nasa.arc.brahms.vm.rt.VMStatementCtx
All Implemented Interfaces:
IBrahmsObjectCtx, IRuntimeConstants, IStatementCtx, gov.nasa.arc.brahms.vm.events.IDiscreteEventData, java.io.Serializable
Direct Known Subclasses:
VMBeliefCtx, VMFactCtx

public class VMStatementCtx
extends StatementCtx
implements gov.nasa.arc.brahms.vm.events.IDiscreteEventData

The VMStatementCtx is a StatementCTx with extension for use in the Brahms virtual machine. A StatementCtx defines a context for a Statement defining the source of the statement, the element that created the statement. The source of a statement can be a concept due to the definition of initial statements, a consequence, a detectable, a transfer definition, an activity (actually the engine core that generates statements based on the activities executed), or just the engine core (reflection statements).

Version:
$Revision: 1.2 $ $Date: 2009/11/24 00:01:57 $ $Author: rnado $
Author:
Ron van Hoof
See Also:
StatementCtx, 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
VMStatementCtx(Statement statement)
          Constructor, creates a statement context for the specified statement.
VMStatementCtx(Statement statement, int sourceType, IBrahmsObjectCtx source)
          Constructor, creates a statement context for the specified statement.
 
Method Summary
 java.util.List<gov.nasa.arc.brahms.vm.memory.IMemoryManagedElement> getMMEs()
          Returns a list with the IMemoryManagedElement referenced in the statement if any.
 boolean handleDiscreteEvent(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt, gov.nasa.arc.brahms.vm.events.IDiscreteEventHandlerFactory ehf)
          Handles the specified discrete event by selecting the appropriate event handler from the specified event handler factory.
 
Methods inherited from class gov.nasa.arc.brahms.common.rt.StatementCtx
getSource, getSourceType, setSource, setSourceType
 
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

VMStatementCtx

public VMStatementCtx(Statement statement)
               throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Constructor, creates a statement context for the specified statement.

Parameters:
statement - the Statement for which this is a context
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException

VMStatementCtx

public VMStatementCtx(Statement statement,
                      int sourceType,
                      IBrahmsObjectCtx source)
               throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Constructor, creates a statement context for the specified statement.

Parameters:
statement - the Statement for which this is a context
sourceType - the source type
source - the BrahmsObjectCtx causing the creation of the statement
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if an invalid source type or source is specified
See Also:
IRuntimeConstants.INITIAL, IRuntimeConstants.CONSEQUENCE, IRuntimeConstants.DETECTABLE, IRuntimeConstants.TRANSFER, IRuntimeConstants.ACTIVITY, IRuntimeConstants.ENGINE
Method Detail

getMMEs

public java.util.List<gov.nasa.arc.brahms.vm.memory.IMemoryManagedElement> getMMEs()
                                                                            throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns a list with the IMemoryManagedElement referenced in the statement if any.

Returns:
List the list of referenced MMEs, empty if none
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if no statement is associated with this context

handleDiscreteEvent

public boolean handleDiscreteEvent(gov.nasa.arc.brahms.vm.events.DiscreteEvent evt,
                                   gov.nasa.arc.brahms.vm.events.IDiscreteEventHandlerFactory ehf)
Handles the specified discrete event by selecting the appropriate event handler from the specified event handler factory. The specified event contains as its data the object implementing this interface. The following should be the case: evt.getData() == this

Specified by:
handleDiscreteEvent in interface gov.nasa.arc.brahms.vm.events.IDiscreteEventData
Parameters:
evt - the DiscreteEvent to be handled
ehf - the EventHandlerFactory containing handlers from which this DiscreteEventData selects the appropriate handler
Returns:
boolean true if the event could be processed, false if not


Copyright © 1997-2012 All Rights Reserved.