Package org.drools.core.reteoo
Class ObjectTypeNode
java.lang.Object
org.drools.core.common.BaseNode
org.drools.core.reteoo.ObjectSource
org.drools.core.reteoo.ObjectTypeNode
- All Implemented Interfaces:
Serializable,NetworkNode,ObjectSink,Sink
- Direct Known Subclasses:
ReteObjectTypeNode
ObjectTypeNodes are responsible for filtering and propagating the matching
fact assertions propagated from the Rete node using ObjectType interface.
The assert and retract methods do not attempt to filter as this is the role of the Rete
node which builds up a cache of matching ObjectTypdeNodess for each asserted object, using
the matches(Object object) method. Incorrect propagation in these methods is not checked and
will result in ClassCastExpcections later on in the network.
Filters Objects coming from the Rete using a
ObjectType semantic module.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ObjectTypeNodeIdprotected ObjectTypeTheObjectTypesemantic module.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
ConstructorsConstructorDescriptionObjectTypeNode(int id, EntryPointNode source, ObjectType objectType, BuildContext context) Construct given a semanticObjectTypeand the provided unique id. -
Method Summary
Modifier and TypeMethodDescriptionvoidassertInitialFact(InternalFactHandle factHandle, PropagationContext context, ReteEvaluator reteEvaluator) voidassertObject(InternalFactHandle factHandle, PropagationContext context, ReteEvaluator reteEvaluator) Propagate theFactHandleimplthrough theRetenetwork.voidbyPassModifyToBetaNode(InternalFactHandle factHandle, ModifyPreviousTuples modifyPreviousTuples, PropagationContext context, ReteEvaluator reteEvaluator) org.drools.util.bitmask.BitMaskcalculateDeclaredMask(Pattern pattern, ObjectType modifiedType, List<String> settableProperties) protected voidvoiddoAttach(BuildContext context) Rete needs to know that this ObjectTypeNode has been addedprotected booleandoRemove(RuleRemovalContext context, ReteooBuilder builder) OTN needs to override remove to avoid releasing the node ID, since OTN are never removed from the rulebase in the current implementationstatic voiddoRetractObject(InternalFactHandle factHandle, PropagationContext context, ReteEvaluator reteEvaluator) booleanstatic voidexpireLeftTuple(TupleImpl leftTuple) static voidexpireRightTuple(TupleImpl rightTuple) longgetFactHandlesIterator(InternalWorkingMemory workingMemory) Retrieve the semanticObjectTypedifferentiator.intReturns the partition ID for which this node belongs tointgetType()booleanisAssignableFrom(ObjectType objectType) voidvoidmodifyObject(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 updatevoidpropagateAssert(InternalFactHandle factHandle, PropagationContext context, ReteEvaluator reteEvaluator) booleanremove(RuleRemovalContext context, ReteooBuilder builder) OTN needs to override remove to avoid releasing the node ID, since OTN are never removed from the rulebase in the current implementationprotected voidstatic voidretractLeftTuples(InternalFactHandle factHandle, PropagationContext context, ReteEvaluator reteEvaluator) static voidretractLeftTuples(InternalFactHandle factHandle, PropagationContext context, ReteEvaluator reteEvaluator, int partition) voidretractObject(InternalFactHandle factHandle, PropagationContext context, ReteEvaluator reteEvaluator) Retract theFactHandleimplfrom theRetenetwork.voidretractObject(InternalFactHandle factHandle, PropagationContext context, ReteEvaluator reteEvaluator, int partition) static voidretractRightTuples(InternalFactHandle factHandle, PropagationContext context, ReteEvaluator reteEvaluator) static voidretractRightTuples(InternalFactHandle factHandle, PropagationContext context, ReteEvaluator reteEvaluator, int partition) voidsetExpirationOffset(long expirationOffset) voidtoString()voidupdateSink(ObjectSink sink, PropagationContext context, InternalWorkingMemory workingMemory) protected static voidupdateTupleSinkId(ObjectTypeNode otn, ObjectSource source) Methods inherited from class org.drools.core.reteoo.ObjectSource
addObjectSink, getDeclaredMask, getObjectSinkPropagator, getObjectTypeNode, getParentObjectSource, getRuleBase, initDeclaredMask, isInUse, removeObjectSink, resetInferredMask, setObjectSinkPropagator, setParentObjectSource, setPartitionId, setPartitionIdWithSinks, setSourcePartitionId, updateMaskMethods inherited from class org.drools.core.common.BaseNode
addAssociatedTerminal, addAssociation, addAssociation, attach, getAssociatedRules, getAssociatedTerminalsSize, getAssociationsSize, getId, getMemoryId, getSinks, hasAssociatedTerminal, hashCode, initMemoryId, isAssociatedWith, isStreamMode, removeAssociatedTerminal, removeAssociation, setId, setStreamModeMethods 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, getSinks, hasAssociatedTerminal, isAssociatedWith, isRightInputIsRiaNode, removeAssociatedTerminal
-
Field Details
-
objectType
TheObjectTypesemantic module. -
idGenerator
-
DEFAULT_ID
-
-
Constructor Details
-
ObjectTypeNode
public ObjectTypeNode() -
ObjectTypeNode
Construct given a semanticObjectTypeand the provided unique id. AllObjectTypdeNodehave node memory.- Parameters:
id- The unique id for the node.objectType- The semantic object-type differentiator.
-
-
Method Details
-
getOtnIdCounter
public int getOtnIdCounter() -
setupParallelExecution
-
getType
public int getType()- Specified by:
getTypein interfaceNetworkNode
-
getObjectType
Retrieve the semanticObjectTypedifferentiator.- Returns:
- The semantic
ObjectTypedifferentiator.
-
getPartitionId
Returns the partition ID for which this node belongs to- Specified by:
getPartitionIdin interfaceNetworkNode- Overrides:
getPartitionIdin classBaseNode
-
calculateDeclaredMask
public org.drools.util.bitmask.BitMask calculateDeclaredMask(Pattern pattern, ObjectType modifiedType, List<String> settableProperties) - Specified by:
calculateDeclaredMaskin classObjectSource
-
isAssignableFrom
-
assertInitialFact
public void assertInitialFact(InternalFactHandle factHandle, PropagationContext context, ReteEvaluator reteEvaluator) -
checkDirty
protected void checkDirty() -
assertObject
public void assertObject(InternalFactHandle factHandle, PropagationContext context, ReteEvaluator reteEvaluator) Propagate theFactHandleimplthrough theRetenetwork. AllFactHandleImplshould be remembered in the node memory, so that later runtime rule attachmnents can have the matched facts propagated to them.- Specified by:
assertObjectin interfaceObjectSink- Parameters:
factHandle- The fact handle.context- The propagation context.reteEvaluator- The working memory session.
-
propagateAssert
public void propagateAssert(InternalFactHandle factHandle, PropagationContext context, ReteEvaluator reteEvaluator) -
retractObject
public void retractObject(InternalFactHandle factHandle, PropagationContext context, ReteEvaluator reteEvaluator) Retract theFactHandleimplfrom theRetenetwork. Also remove theFactHandleImplfrom the node memory.- Parameters:
factHandle- The fact handle.context- The propagation context.reteEvaluator- The working memory session.
-
retractObject
public void retractObject(InternalFactHandle factHandle, PropagationContext context, ReteEvaluator reteEvaluator, int partition) -
doRetractObject
public static void doRetractObject(InternalFactHandle factHandle, PropagationContext context, ReteEvaluator reteEvaluator) -
expireLeftTuple
-
expireRightTuple
-
retractLeftTuples
public static void retractLeftTuples(InternalFactHandle factHandle, PropagationContext context, ReteEvaluator reteEvaluator) -
retractLeftTuples
public static void retractLeftTuples(InternalFactHandle factHandle, PropagationContext context, ReteEvaluator reteEvaluator, int partition) -
retractRightTuples
public static void retractRightTuples(InternalFactHandle factHandle, PropagationContext context, ReteEvaluator reteEvaluator) -
retractRightTuples
public static void retractRightTuples(InternalFactHandle factHandle, PropagationContext context, ReteEvaluator reteEvaluator, int partition) -
resetIdGenerator
protected void resetIdGenerator() -
modifyObject
public void modifyObject(InternalFactHandle factHandle, ModifyPreviousTuples modifyPreviousTuples, PropagationContext context, ReteEvaluator reteEvaluator) - Specified by:
modifyObjectin interfaceObjectSink
-
updateSink
public void updateSink(ObjectSink sink, PropagationContext context, InternalWorkingMemory workingMemory) - Specified by:
updateSinkin classObjectSource
-
getFactHandlesIterator
-
doAttach
Rete needs to know that this ObjectTypeNode has been added -
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
-
updateTupleSinkId
-
nextOtnId
-
remove
OTN needs to override remove to avoid releasing the node ID, since OTN are never removed from the rulebase in the current implementation -
doRemove
OTN needs to override remove to avoid releasing the node ID, since OTN are never removed from the rulebase in the current implementation- Overrides:
doRemovein classObjectSource
-
toString
-
equals
-
getEntryPoint
- Returns:
- the entryPoint
-
getExpirationOffset
public long getExpirationOffset() -
setExpirationOffset
public void setExpirationOffset(long expirationOffset) -
mergeExpirationOffset
-
byPassModifyToBetaNode
public void byPassModifyToBetaNode(InternalFactHandle factHandle, ModifyPreviousTuples modifyPreviousTuples, PropagationContext context, ReteEvaluator reteEvaluator) - Specified by:
byPassModifyToBetaNodein interfaceObjectSink
-