Package org.drools.core.reteoo
Class Rete
java.lang.Object
org.drools.core.common.BaseNode
org.drools.core.reteoo.ObjectSource
org.drools.core.reteoo.Rete
- All Implemented Interfaces:
Serializable,NetworkNode,ObjectSink,Sink
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- See Also:
-
Field Summary
Fields inherited from class org.drools.core.reteoo.ObjectSource
alphaNodeHashingThreshold, alphaNodeRangeIndexThreshold, declaredMask, inferredMask, sink, sourceFields inherited from class org.drools.core.common.BaseNode
associations, hashcode, id, memoryId, partitionId -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddObjectSink(ObjectSink objectSink) Adds theObjectSinkso that it may receiveObjectspropagated from thisObjectSource.voidassertObject(InternalFactHandle factHandle, PropagationContext context, ReteEvaluator reteEvaluator) This is the entry point into the network for all asserted Facts.voidbyPassModifyToBetaNode(InternalFactHandle factHandle, ModifyPreviousTuples modifyPreviousTuples, PropagationContext context, ReteEvaluator reteEvaluator) org.drools.util.bitmask.BitMaskcalculateDeclaredMask(Pattern pattern, ObjectType modifiedType, List<String> settableProperties) voiddoAttach(BuildContext context) protected booleandoRemove(RuleRemovalContext context, ReteooBuilder builder) Removes the node from the network.booleangetEntryPointNode(EntryPointId entryPoint) getObjectTypeNodes(EntryPointId entryPoint) intgetType()voidmodifyObject(InternalFactHandle factHandle, ModifyPreviousTuples modifyPreviousTuples, PropagationContext context, ReteEvaluator reteEvaluator) voidnetworkUpdated(UpdateContext updateContext) A method that is called for all nodes whose network below them changed, after the change is complete, providing them with an opportunity for state updatevoidremoveObjectSink(ObjectSink objectSink) Removes theObjectSinkvoidretractObject(InternalFactHandle handle, PropagationContext context, ReteEvaluator reteEvaluator) Retract a fact object from thisRuleBaseand the specifiedWorkingMemory.voidupdateSink(ObjectSink sink, PropagationContext context, InternalWorkingMemory wm) Methods inherited from class org.drools.core.reteoo.ObjectSource
getDeclaredMask, getObjectSinkPropagator, getObjectTypeNode, getParentObjectSource, initDeclaredMask, isInUse, resetInferredMask, setObjectSinkPropagator, setParentObjectSource, setPartitionId, setPartitionIdWithSinks, setSourcePartitionId, updateMaskMethods inherited from class org.drools.core.common.BaseNode
addAssociatedTerminal, addAssociation, addAssociation, attach, getAssociatedRules, getAssociatedTerminalsSize, getAssociationsSize, getId, getMemoryId, getPartitionId, getSinks, hasAssociatedTerminal, hashCode, initMemoryId, isAssociatedWith, isStreamMode, remove, removeAssociatedTerminal, removeAssociation, setId, setStreamMode, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.drools.base.common.NetworkNode
addAssociatedTerminal, getAssociatedRules, getAssociatedTerminalsSize, getId, getPartitionId, getSinks, hasAssociatedTerminal, isAssociatedWith, isRightInputIsRiaNode, removeAssociatedTerminal
-
Constructor Details
-
Rete
public Rete() -
Rete
-
-
Method Details
-
getType
public int getType()- Specified by:
getTypein interfaceNetworkNode
-
assertObject
public void assertObject(InternalFactHandle factHandle, PropagationContext context, ReteEvaluator reteEvaluator) This is the entry point into the network for all asserted Facts. Iterates a cache of matchingObjectTypdeNodes asserting the Fact. If the cache does not exist it first iteraes and builds the cache.- Specified by:
assertObjectin interfaceObjectSink- Parameters:
factHandle- The FactHandle of the fact to assertcontext- ThePropagationContextof theWorkingMemoryactionreteEvaluator- The working memory session.
-
retractObject
public void retractObject(InternalFactHandle handle, PropagationContext context, ReteEvaluator reteEvaluator) Retract a fact object from thisRuleBaseand the specifiedWorkingMemory.- Parameters:
handle- The handle of the fact to retract.reteEvaluator- The working memory session.
-
modifyObject
public void modifyObject(InternalFactHandle factHandle, ModifyPreviousTuples modifyPreviousTuples, PropagationContext context, ReteEvaluator reteEvaluator) - Specified by:
modifyObjectin interfaceObjectSink
-
addObjectSink
Adds theObjectSinkso that it may receiveObjectspropagated from thisObjectSource.- Overrides:
addObjectSinkin classObjectSource- Parameters:
objectSink- TheObjectSinkto receive propagatedObjects. Rete only acceptsObjectTypeNodes as parameters to this method, though.
-
removeObjectSink
Description copied from class:ObjectSourceRemoves theObjectSink- Overrides:
removeObjectSinkin classObjectSource- Parameters:
objectSink- TheObjectSinkto remove
-
doAttach
-
networkUpdated
Description copied from class:BaseNodeA method that is called for all nodes whose network below them changed, after the change is complete, providing them with an opportunity for state update- Overrides:
networkUpdatedin classObjectSource
-
doRemove
Description copied from class:BaseNodeRemoves the node from the network. Usually from the parentObjectSourceorTupleSource- Overrides:
doRemovein classObjectSource
-
getEntryPointNode
-
getObjectTypeNodes
-
getObjectTypeNodes
-
getRuleBase
- Overrides:
getRuleBasein classObjectSource
-
equals
-
updateSink
- Specified by:
updateSinkin classObjectSource
-
getEntryPointNodes
-
byPassModifyToBetaNode
public void byPassModifyToBetaNode(InternalFactHandle factHandle, ModifyPreviousTuples modifyPreviousTuples, PropagationContext context, ReteEvaluator reteEvaluator) - Specified by:
byPassModifyToBetaNodein interfaceObjectSink
-
calculateDeclaredMask
public org.drools.util.bitmask.BitMask calculateDeclaredMask(Pattern pattern, ObjectType modifiedType, List<String> settableProperties) - Specified by:
calculateDeclaredMaskin classObjectSource
-