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

java.lang.Object
  extended by gov.nasa.arc.brahms.common.rt.BrahmsObjectCtx
      extended by gov.nasa.arc.brahms.common.rt.ConceptCtx
          extended by gov.nasa.arc.brahms.common.rt.ActiveInstanceCtx
              extended by gov.nasa.arc.brahms.vm.rt.VMActiveInstanceCtx
                  extended by gov.nasa.arc.brahms.vm.rt.VMObjectInstanceCtx
All Implemented Interfaces:
IActiveInstanceCtx, IBrahmsObjectCtx, IConceptCtx, IObjectInstanceCtx, IRuntimeConstants, gov.nasa.arc.brahms.vm.engine.IPriorityWorkManager, gov.nasa.arc.brahms.vm.engine.IWorkManager, gov.nasa.arc.brahms.vm.events.IDiscreteEventData, gov.nasa.arc.brahms.vm.memory.IMemoryManagedElement, gov.nasa.arc.brahms.vm.monitoring.IMonitoredAgent, IFrameStatusListener, IRuntimeConceptCtx, java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener

public class VMObjectInstanceCtx
extends VMActiveInstanceCtx
implements IObjectInstanceCtx, gov.nasa.arc.brahms.vm.events.IDiscreteEventData

The ObjectInstanceCtx is the runtime class for the objects with extension for use in the virtual machine. It manages the belief set, location, frame contexts with their various states and containment. The virtual machine maintains the object states through the object instance contexts.

Version:
$Revision: 1.3 $ $Date: 2009/11/23 23:58:57 $ $Author: rnado $
Author:
Ron van Hoof
See Also:
IObjectInstanceCtx, Serialized Form

Field Summary
 
Fields inherited from class gov.nasa.arc.brahms.vm.rt.VMActiveInstanceCtx
m_bInitialized, m_llCIMessageQueue, m_llReceivedMessageConversationIds, m_oBeliefSet, m_oEngine, m_oIncomingMessageLock
 
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
VMObjectInstanceCtx(ObjectInstance obj)
          Constructor, creates a new context for the specified ObjectInstance.
 
Method Summary
 void addAggregate(PartCtx aggregate)
          Adds the specified aggregate as an aggregate for this object instance.
protected  gov.nasa.arc.brahms.vm.engine.IEngine createEngine(gov.nasa.arc.brahms.vm.controller.VMController vmc)
          Creates a new engine for this active concept for use in a virtual machine
 java.util.Enumeration<PartCtx> getAggregates()
          Returns a list of all the aggregates (PartCtx).
 int getMatchingStrategy(VMFrameCtx frame)
          Determines whether the active instance attempts to match facts or beliefs when evaluating OA operands that occur in expressions in the body of the given frame context.
 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.
 void initializeAsCopy(gov.nasa.arc.brahms.vm.controller.VMController vmc)
          Initializes the object as a local copy of a remote object.
 void removeAggregate(PartCtx aggregate)
          Removes the specified aggregate as an aggregate for this object instance.
 void removeAllAggregates()
          Removes all the aggregates from the list of aggregates.
 void reset()
          Resets the concept removing its context and any references and additional components created to use this concept in a virtual machine.
 
Methods inherited from class gov.nasa.arc.brahms.vm.rt.VMActiveInstanceCtx
activateCompositeActivity, addActiveDetectable, addBelief, addDeletedListener, addEventReference, addFrameBindingReference, addHardReference, addKnowsLocationOf, addSoftReference, addStatementReference, addStatusListener, clearKnowsLocationOf, containsBelief, createWorkSelector, deactivateCompositeActivity, deregisterForMonitoring, deregisterThreadListener, detect, doWork, finalizeDelete, getActiveDetectables, getBelief, getBelief, getBelief, getBelief, getBelief, getBelief, getBeliefChangeSupport, getBeliefForIndex, getBeliefForIndex, getBeliefRSN, getBeliefs, getBeliefs, getBeliefs, getBeliefs, getBeliefs, getBeliefs, getBeliefs, getBeliefs, getBeliefs, getBeliefs, getBeliefs, getBeliefs, getBeliefs, getBeliefs, getBeliefs, getBeliefsForIndex, getBeliefsForIndex, getContainedInstances, getContainsRelation, getContext, getController, getElement, getFactChangeSupport, getFactRSN, getKnowsLocationOf, getLocationAttribute, getPriorityAvailableThoughtframe, getPriorityAvailableWorkframe, getPriorityInterruptedFrame, getRemoteBeliefs, getRemovedBeliefs, getSoftReferences, getStatusListeners, hasAddedBelief, hasEventReferences, hasFrames, hasRemovedBelief, hasSoftReferences, initialize, initializeMemoryManagement, initiateDelete, isAcceptingFacts, isDeleted, isDeleteInitiated, isMarkedForGC, isSynchronizationRequired, knowsLocationOf, pause, postEvent, process, processMessage, propertyChange, registerForMonitoring, registerJavaObject, registerThreadListener, removeActiveDetectable, removeAllBeliefs, removeBelief, removeEventReference, removeFrameBindingReference, removeHardReference, removeKnowsLocationOf, removeSoftReference, removeStatementReference, removeStatusListener, resume, retractEvent, setBeliefChangeSupport, setController, setFactChangeSupport, setMarkedForGC, setSynchronizationRequired, start, statusChanged, stop, trigger, triggerImpasseResolution, unregisterJavaObject
 
Methods inherited from class gov.nasa.arc.brahms.common.rt.ActiveInstanceCtx
addAvailableFrame, addBelief, addCompletedFrame, addContainedElement, addImpasseDetectable, addImpassedFrame, addInterruptedFrame, addPastLocation, getAvailableThoughtframes, getAvailableWorkframes, getBelievedTime, getCompletedThoughtframeNames, getCompletedThoughtframes, getCompletedWorkframeNames, getCompletedWorkframes, getContainedElements, getCurrentWork, getImpasseDetectables, getImpassedFrames, getInterruptedFrames, getLocation, getPastLocations, hasAvailableThoughtframes, hasAvailableWorkframes, hasCompletedThoughtframes, hasCompletedWorkframes, hasImpassedFrames, hasInterruptedFrames, removeAllAvailableFrames, removeAllCompletedFrames, removeAllContainedElements, removeAllImpasseDetectables, removeAllImpassedFrames, removeAllInterruptedFrames, removeAllPastLocations, removeAvailableFrame, removeBelief, removeCompletedFrame, removeContainedElement, removeImpasseDetectable, removeImpassedFrame, removeInterruptedFrame, removePastLocation, setBelievedTime, setCurrentWork, setLocation
 
Methods inherited from class gov.nasa.arc.brahms.common.rt.ConceptCtx
addAttribute, addRelation, getAttribute, getRelation, initAttributeRelationCache, removeAttribute, removeRelation, resetAttributeRelationCache, toString
 
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.IActiveInstanceCtx
addAvailableFrame, addBelief, addCompletedFrame, addContainedElement, addImpasseDetectable, addImpassedFrame, addInterruptedFrame, addPastLocation, getAvailableThoughtframes, getAvailableWorkframes, getBeliefs, getBelievedTime, getCompletedThoughtframeNames, getCompletedThoughtframes, getCompletedWorkframeNames, getCompletedWorkframes, getContainedElements, getCurrentWork, getImpasseDetectables, getImpassedFrames, getInterruptedFrames, getLocation, getPastLocations, hasAvailableThoughtframes, hasAvailableWorkframes, hasCompletedThoughtframes, hasCompletedWorkframes, hasImpassedFrames, hasInterruptedFrames, removeAllAvailableFrames, removeAllBeliefs, removeAllCompletedFrames, removeAllContainedElements, removeAllImpasseDetectables, removeAllImpassedFrames, removeAllInterruptedFrames, removeAllPastLocations, removeAvailableFrame, removeBelief, removeCompletedFrame, removeContainedElement, removeImpasseDetectable, removeImpassedFrame, removeInterruptedFrame, removePastLocation, setBelievedTime, setCurrentWork, setLocation
 
Methods inherited from interface gov.nasa.arc.brahms.common.rt.IBrahmsObjectCtx
addNote, getContextFor, getEndTime, getID, getNote, getNotes, getStartTime, removeNote, setEndTime, setID, setStartTime
 
Methods inherited from interface gov.nasa.arc.brahms.vm.engine.IPriorityWorkManager
getCurrentWork
 

Constructor Detail

VMObjectInstanceCtx

public VMObjectInstanceCtx(ObjectInstance obj)
Constructor, creates a new context for the specified ObjectInstance.

Parameters:
obj - the ObjectInstance for which to create a context
Method Detail

initializeAsCopy

public void initializeAsCopy(gov.nasa.arc.brahms.vm.controller.VMController vmc)
                      throws VMException
Initializes the object as a local copy of a remote object. This type of object is only created in a distributed environment when an object is transferred by value. This initialization routine sets up the object with the minimum set of behaviors needed to manage a belief set. This object has no behaviors (activities or frames) and therefor does not require any such related behaviors. For this copy also none of the initial beliefs are processed.

Parameters:
vmc - the VMController controlling the virtual machine in which this concept is to be used.
Throws:
VMException - if an error occurs in initializing the concept

createEngine

protected gov.nasa.arc.brahms.vm.engine.IEngine createEngine(gov.nasa.arc.brahms.vm.controller.VMController vmc)
                                                      throws VMException
Creates a new engine for this active concept for use in a virtual machine

Note: This method always returns a new instance and does not verify whether one is already created.

Specified by:
createEngine in class VMActiveInstanceCtx
Parameters:
vmc - the virtual machine controller controlling the active instance
Returns:
IEngine a new engine
Throws:
VMException - if an error occurs in creating the engine

addAggregate

public void addAggregate(PartCtx aggregate)
                  throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Adds the specified aggregate as an aggregate for this object instance. The actual aggregate is the part context's aggregate/parent. Aggregates and sub aggregates are associated through a PartCtx.

Specified by:
addAggregate in interface IObjectInstanceCtx
Parameters:
aggregate - the aggregate (PartCtx) to be added
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if aggregate is null

removeAggregate

public void removeAggregate(PartCtx aggregate)
                     throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Removes the specified aggregate as an aggregate for this object instance. The actual aggregate is the part context's aggregate/parent. Aggregates and sub aggregates are associated through a PartCtx.

Specified by:
removeAggregate in interface IObjectInstanceCtx
Parameters:
aggregate - the aggregate to be removed
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if aggregate is null, no aggregates are available, or the aggregate is not found

getAggregates

public java.util.Enumeration<PartCtx> getAggregates()
                                             throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Returns a list of all the aggregates (PartCtx).

Specified by:
getAggregates in interface IObjectInstanceCtx
Returns:
Enumeration an enumeration of PartCtx
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if there are no aggregates

removeAllAggregates

public void removeAllAggregates()
Removes all the aggregates from the list of aggregates.

Specified by:
removeAllAggregates in interface IObjectInstanceCtx

reset

public void reset()
           throws VMException
Resets the concept removing its context and any references and additional components created to use this concept in a virtual machine.

Specified by:
reset in interface IRuntimeConceptCtx
Overrides:
reset in class VMActiveInstanceCtx
Throws:
VMException - if in error occurs in resetting the active instance

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

getMatchingStrategy

public int getMatchingStrategy(VMFrameCtx frame)
                        throws gov.nasa.arc.brahms.common.exceptions.BrahmsException
Determines whether the active instance attempts to match facts or beliefs when evaluating OA operands that occur in expressions in the body of the given frame context. For an object instance, the strategy is to match facts if the frame is a workframe with type factframe, otherwise to match beliefs for thoughtframes and workframes with type dataframe.

Specified by:
getMatchingStrategy in class VMActiveInstanceCtx
Parameters:
frame - a VMFrameCtx where an expression is being evaluated
Returns:
int a code indicating the matching strategy
Throws:
gov.nasa.arc.brahms.common.exceptions.BrahmsException - if an error occurs in determining the strategy
See Also:
gov.nasa.arc.brahms.vm.data.FACTS, gov.nasa.arc.brahms.vm.data.BELIEFS


Copyright © 1997-2012 All Rights Reserved.