站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss RULES 4.0.0.11754MR2 API 英文版文档

Rete (Drools 4.0.0.11754MR2 API) - JBoss RULES 4.0.0.11754MR2 API 英文版文档


org.drools.reteoo
Class Rete

java.lang.Object
  extended by org.drools.common.BaseNode
      extended by org.drools.reteoo.ObjectSource
          extended by org.drools.reteoo.Rete
All Implemented Interfaces:
Serializable, NetworkNode, NodeMemory, ObjectSink

public class Rete
extends ObjectSource
implements Serializable, ObjectSink, NodeMemory

The Rete-OO network. The Rete class is the root Object. All objects are asserted into the Rete node where it propagates to all matching ObjectTypeNodes. The first time an instance of a Class type is asserted it does a full iteration of all ObjectTyppeNodes looking for matches, any matches are then cached in a HashMap which is used for future assertions. While Rete extends ObjectSource nad implements ObjectSink it nulls the methods attach(), remove() and updateNewNode() as this is the root node they are no applicable

Author:
Mark Proctor, Bob McWhirter
See Also:
ObjectTypeNode, Serialized Form

Field Summary
 
Fields inherited from class org.drools.reteoo.ObjectSource
objectSource, sink
 
Fields inherited from class org.drools.common.BaseNode
hasMemory, id, sharedCount
 
Constructor Summary
Rete()
           
 
Method Summary
protected  void addObjectSink(ObjectSink objectSink)
          Adds the TupleSink so that it may receive Tuples propagated from this TupleSource.
 void assertObject(InternalFactHandle handle, PropagationContext context, InternalWorkingMemory workingMemory)
          This is the entry point into the network for all asserted Facts.
 void attach()
          Attaches the node into the network.
 void attach(InternalWorkingMemory[] workingMemories)
           
 Object createMemory(RuleBaseConfiguration config)
           
 boolean equals(Object object)
           
 ObjectHashMap getObjectTypeNodes()
           
 int hashCode()
          The hashCode return is simply the unique id of the node.
 void remove(BaseNode node, InternalWorkingMemory[] workingMemories)
          Removes the node from teh network.
protected  void removeObjectSink(ObjectSink objectSink)
          Removes the ObjectSink
 void retractObject(InternalFactHandle handle, PropagationContext context, InternalWorkingMemory workingMemory)
          Retract a fact object from this RuleBase and the specified WorkingMemory.
 void updateSink(ObjectSink sink, PropagationContext context, InternalWorkingMemory workingMemory)
           
 
Methods inherited from class org.drools.reteoo.ObjectSource
getSinkPropagator
 
Methods inherited from class org.drools.common.BaseNode
addShare, getId, getSharedCount, hasMemory, isInUse, isShared, removeShare, setHasMemory, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.drools.common.NodeMemory
getId
 

Constructor Detail

Rete

public Rete()
Method Detail

assertObject

public void assertObject(InternalFactHandle handle,
                         PropagationContext context,
                         InternalWorkingMemory workingMemory)
This is the entry point into the network for all asserted Facts. Iterates a cache of matching ObjectTypdeNodes asserting the Fact. If the cache does not exist it first iteraes and builds the cache.

Specified by:
assertObject in interface ObjectSink
Parameters:
handle - The FactHandle of the fact to assert
context - The PropagationContext of the WorkingMemory action
workingMemory - The working memory session.

retractObject

public void retractObject(InternalFactHandle handle,
                          PropagationContext context,
                          InternalWorkingMemory workingMemory)
Retract a fact object from this RuleBase and the specified WorkingMemory.

Specified by:
retractObject in interface ObjectSink
Parameters:
handle - The handle of the fact to retract.
workingMemory - The working memory session.
context - The PropagationContext of the WorkingMemory action.

addObjectSink

protected void addObjectSink(ObjectSink objectSink)
Adds the TupleSink so that it may receive Tuples propagated from this TupleSource.

Overrides:
addObjectSink in class ObjectSource
Parameters:
tupleSink - The TupleSink to receive propagated Tuples.

removeObjectSink

protected void removeObjectSink(ObjectSink objectSink)
Description copied from class: ObjectSource
Removes the ObjectSink

Overrides:
removeObjectSink in class ObjectSource
Parameters:
objectSink - The ObjectSink to remove

attach

public void attach()
Description copied from class: BaseNode
Attaches the node into the network. Usually to the parent ObjectSource or TupleSource

Specified by:
attach in class BaseNode

attach

public void attach(InternalWorkingMemory[] workingMemories)
Specified by:
attach in class BaseNode

remove

public void remove(BaseNode node,
                   InternalWorkingMemory[] workingMemories)
Description copied from class: BaseNode
Removes the node from teh network. Usually from the parent ObjectSource or TupleSource

Specified by:
remove in class BaseNode

getObjectTypeNodes

public ObjectHashMap getObjectTypeNodes()

createMemory

public Object createMemory(RuleBaseConfiguration config)
Specified by:
createMemory in interface NodeMemory

hashCode

public int hashCode()
Description copied from class: BaseNode
The hashCode return is simply the unique id of the node. It is expected that base classes will also implement equals(Object object).

Overrides:
hashCode in class BaseNode

equals

public boolean equals(Object object)
Overrides:
equals in class Object

updateSink

public void updateSink(ObjectSink sink,
                       PropagationContext context,
                       InternalWorkingMemory workingMemory)
Specified by:
updateSink in class ObjectSource


Copyright © 2001-2007 JBoss Inc.. All Rights Reserved.