biz.hammurapi.rules
Class KnowledgeMaximizingHandleManager

java.lang.Object
  extended by biz.hammurapi.config.ComponentBase
      extended by biz.hammurapi.rules.KnowledgeMaximizingHandleManager
All Implemented Interfaces:
biz.hammurapi.config.Component, biz.hammurapi.config.Context, biz.hammurapi.metrics.MeasurementCollector, biz.hammurapi.metrics.MeasurementConsumer, HandleManager, Negatable

public class KnowledgeMaximizingHandleManager
extends biz.hammurapi.config.ComponentBase
implements HandleManager, biz.hammurapi.config.Component

Handle manager implementation which keeps handles in memory. Objects are compared by eqals(). This handle manager doesn't hold facts which superced each other, but retains only superceeding fact (e.g. if Mother supercedes Parent then Parent will not be retained in the manager when Mother is added).

Version:
${Revision}
Author:
Pavel Vlasov

Field Summary
 
Fields inherited from class biz.hammurapi.config.ComponentBase
owner
 
Constructor Summary
KnowledgeMaximizingHandleManager()
           
 
Method Summary
 javax.rules.Handle addObject(java.lang.Object object)
          Adds new object to the manager if this object is not already there and there is no superceding object.
 void clear()
          Removes all mappings.
 boolean contains(javax.rules.Handle handle)
           
 java.util.Collection getHandles()
           
 java.lang.Object getObject(javax.rules.Handle handle)
          Retrieves object by handle
 java.util.Collection getObjects()
           
 boolean isNegatedBy(Negator negator)
           
 void rebind(javax.rules.Handle handle, java.lang.Object object)
          Rebinds handle to another object
 void remove(javax.rules.Handle handle)
          Removes object entry by key.
 void remove(java.lang.Object obj)
          Removes object entry by value;
 void setStorageReference(java.lang.String storageReference)
          Path to object storage.
 void start()
           
 void stop()
           
 
Methods inherited from class biz.hammurapi.config.ComponentBase
addMeasurement, get, getChild, getMeasurementConsumer, getOwner, getOwner, setMeasurementConsumer, setOwner
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface biz.hammurapi.config.Component
setOwner
 

Constructor Detail

KnowledgeMaximizingHandleManager

public KnowledgeMaximizingHandleManager()
Method Detail

setStorageReference

public void setStorageReference(java.lang.String storageReference)
Path to object storage.

Parameters:
storageReference -

addObject

public javax.rules.Handle addObject(java.lang.Object object)
Adds new object to the manager if this object is not already there and there is no superceding object. If object being added supercedes any objects in the manager these objects will be removed.

Specified by:
addObject in interface HandleManager
Returns:

getObject

public java.lang.Object getObject(javax.rules.Handle handle)
Description copied from interface: HandleManager
Retrieves object by handle

Specified by:
getObject in interface HandleManager
Returns:

getObjects

public java.util.Collection getObjects()
Specified by:
getObjects in interface HandleManager
Returns:
All objects with handles.

getHandles

public java.util.Collection getHandles()
Specified by:
getHandles in interface HandleManager
Returns:
All handles.

remove

public void remove(javax.rules.Handle handle)
Description copied from interface: HandleManager
Removes object entry by key.

Specified by:
remove in interface HandleManager

contains

public boolean contains(javax.rules.Handle handle)
Specified by:
contains in interface HandleManager
Returns:
True there is a mapping with given handle in the manager.

rebind

public void rebind(javax.rules.Handle handle,
                   java.lang.Object object)
Description copied from interface: HandleManager
Rebinds handle to another object

Specified by:
rebind in interface HandleManager

remove

public void remove(java.lang.Object obj)
Description copied from interface: HandleManager
Removes object entry by value;

Specified by:
remove in interface HandleManager

clear

public void clear()
Description copied from interface: HandleManager
Removes all mappings.

Specified by:
clear in interface HandleManager

start

public void start()
           throws biz.hammurapi.config.ConfigurationException
Specified by:
start in interface biz.hammurapi.config.Component
Throws:
biz.hammurapi.config.ConfigurationException

stop

public void stop()
          throws biz.hammurapi.config.ConfigurationException
Specified by:
stop in interface biz.hammurapi.config.Component
Throws:
biz.hammurapi.config.ConfigurationException

isNegatedBy

public boolean isNegatedBy(Negator negator)
Specified by:
isNegatedBy in interface Negatable
Returns:
true if negator negates this instance.


Copyright © 2005 Hammurapi Group. All Rights Reserved.