Package org.drools.core.reteoo
Class WindowNode
- java.lang.Object
-
- org.drools.core.common.BaseNode
-
- org.drools.core.reteoo.ObjectSource
-
- org.drools.core.reteoo.WindowNode
-
- All Implemented Interfaces:
java.io.Serializable,org.drools.base.common.NetworkNode,MemoryFactory<WindowNode.WindowMemory>,ObjectSink,ObjectSinkNode,RightTupleSink,Sink
public class WindowNode extends ObjectSource implements ObjectSinkNode, RightTupleSink, MemoryFactory<WindowNode.WindowMemory>
WindowNodesare nodes in theRetenetwork used to manage windows. They support multiple types of windows, like sliding windows, tumbling windows, etc. This class must act as a lock-gate for all working memory actions on it and propagated down the network in this branch, as there can be concurrent threads propagating events and expiring events working on this node at the same time. It requires it to be thread safe.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWindowNode.WindowMemory
-
Field Summary
Fields Modifier and Type Field Description protected BehaviorManagerbehavior-
Fields inherited from class org.drools.core.reteoo.ObjectSource
alphaNodeHashingThreshold, alphaNodeRangeIndexThreshold, declaredMask, inferredMask, sink, source
-
Fields inherited from class org.drools.core.common.BaseNode
associations, hashcode, id, memoryId, partitionId
-
-
Constructor Summary
Constructors Constructor Description WindowNode()WindowNode(int id, java.util.List<org.drools.base.rule.constraint.AlphaNodeFieldConstraint> constraints, java.util.List<BehaviorRuntime> behaviors, ObjectSource objectSource, BuildContext context)Construct aWindowNodewith a unique id using the provided list ofAlphaNodeFieldConstraintand the givenObjectSource.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidassertObject(InternalFactHandle factHandle, PropagationContext pctx, ReteEvaluator reteEvaluator)voidbyPassModifyToBetaNode(InternalFactHandle factHandle, ModifyPreviousTuples modifyPreviousTuples, PropagationContext context, ReteEvaluator reteEvaluator)org.drools.util.bitmask.BitMaskcalculateDeclaredMask(org.drools.base.base.ObjectType modifiedType, java.util.List<java.lang.String> settableProperties)WindowNode.WindowMemorycreateMemory(RuleBaseConfiguration config, ReteEvaluator reteEvaluator)Creates the WindowNode's memory.voiddoAttach(BuildContext context)booleanequals(java.lang.Object object)BehaviorRuntime[]getBehaviors()Returns the list of behaviors for this window nodejava.util.List<org.drools.base.rule.constraint.AlphaNodeFieldConstraint>getConstraints()Returns theFieldConstraintsorg.drools.base.rule.EntryPointIdgetEntryPoint()ObjectSinkNodegetNextObjectSinkNode()Returns the next nodeObjectSinkNodegetPreviousObjectSinkNode()Returns the previous nodeObjectTypeNode.IdgetRightInputOtnId()shortgetType()voidmodifyObject(InternalFactHandle factHandle, ModifyPreviousTuples modifyPreviousTuples, PropagationContext context, ReteEvaluator reteEvaluator)voidmodifyRightTuple(RightTuple rightTuple, PropagationContext context, ReteEvaluator reteEvaluator)voidretractRightTuple(RightTuple rightTuple, PropagationContext pctx, ReteEvaluator reteEvaluator)voidsetNextObjectSinkNode(ObjectSinkNode next)Sets the next nodevoidsetPreviousObjectSinkNode(ObjectSinkNode previous)Sets the previous nodevoidsetRightInputOtnId(ObjectTypeNode.Id rightInputOtnId)java.lang.StringtoString()voidupdateSink(ObjectSink sink, PropagationContext context, InternalWorkingMemory workingMemory)-
Methods inherited from class org.drools.core.reteoo.ObjectSource
addObjectSink, doRemove, getDeclaredMask, getObjectSinkPropagator, getObjectTypeNode, getParentObjectSource, getRuleBase, initDeclaredMask, isInUse, networkUpdated, removeObjectSink, resetInferredMask, setObjectSinkPropagator, setParentObjectSource, setPartitionId, setPartitionIdWithSinks, setSourcePartitionId, updateMask
-
Methods 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
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.drools.core.common.MemoryFactory
getMemoryId
-
Methods inherited from interface org.drools.base.common.NetworkNode
addAssociatedTerminal, getAssociatedRules, getAssociatedTerminalsSize, getId, getPartitionId, getSinks, hasAssociatedTerminal, isAssociatedWith, isRightInputIsRiaNode, removeAssociatedTerminal
-
Methods inherited from interface org.drools.core.reteoo.ObjectSinkNode
setPartitionIdWithSinks
-
-
-
-
Field Detail
-
behavior
protected BehaviorManager behavior
-
-
Constructor Detail
-
WindowNode
public WindowNode()
-
WindowNode
public WindowNode(int id, java.util.List<org.drools.base.rule.constraint.AlphaNodeFieldConstraint> constraints, java.util.List<BehaviorRuntime> behaviors, ObjectSource objectSource, BuildContext context)Construct aWindowNodewith a unique id using the provided list ofAlphaNodeFieldConstraintand the givenObjectSource.- Parameters:
id- Node's IDconstraints- Node's constraintsbehaviors- list of behaviors for this window nodeobjectSource- Node's object source
-
-
Method Detail
-
getType
public short getType()
- Specified by:
getTypein interfaceorg.drools.base.common.NetworkNode
-
getConstraints
public java.util.List<org.drools.base.rule.constraint.AlphaNodeFieldConstraint> getConstraints()
Returns theFieldConstraints- Returns:
FieldConstraints
-
getBehaviors
public BehaviorRuntime[] getBehaviors()
Returns the list of behaviors for this window node
-
doAttach
public void doAttach(BuildContext context)
-
assertObject
public void assertObject(InternalFactHandle factHandle, PropagationContext pctx, ReteEvaluator reteEvaluator)
- Specified by:
assertObjectin interfaceObjectSink
-
retractRightTuple
public void retractRightTuple(RightTuple rightTuple, PropagationContext pctx, ReteEvaluator reteEvaluator)
- Specified by:
retractRightTuplein interfaceRightTupleSink
-
modifyRightTuple
public void modifyRightTuple(RightTuple rightTuple, PropagationContext context, ReteEvaluator reteEvaluator)
- Specified by:
modifyRightTuplein interfaceRightTupleSink
-
modifyObject
public void modifyObject(InternalFactHandle factHandle, ModifyPreviousTuples modifyPreviousTuples, PropagationContext context, ReteEvaluator reteEvaluator)
- Specified by:
modifyObjectin interfaceObjectSink
-
byPassModifyToBetaNode
public void byPassModifyToBetaNode(InternalFactHandle factHandle, ModifyPreviousTuples modifyPreviousTuples, PropagationContext context, ReteEvaluator reteEvaluator)
- Specified by:
byPassModifyToBetaNodein interfaceObjectSink
-
updateSink
public void updateSink(ObjectSink sink, PropagationContext context, InternalWorkingMemory workingMemory)
- Specified by:
updateSinkin classObjectSource
-
createMemory
public WindowNode.WindowMemory createMemory(RuleBaseConfiguration config, ReteEvaluator reteEvaluator)
Creates the WindowNode's memory.- Specified by:
createMemoryin interfaceMemoryFactory<WindowNode.WindowMemory>
-
equals
public boolean equals(java.lang.Object object)
- Overrides:
equalsin classjava.lang.Object
-
getNextObjectSinkNode
public ObjectSinkNode getNextObjectSinkNode()
Returns the next node- Specified by:
getNextObjectSinkNodein interfaceObjectSinkNode- Returns:
- The next ObjectSinkNode
-
setNextObjectSinkNode
public void setNextObjectSinkNode(ObjectSinkNode next)
Sets the next node- Specified by:
setNextObjectSinkNodein interfaceObjectSinkNode- Parameters:
next- The next ObjectSinkNode
-
getPreviousObjectSinkNode
public ObjectSinkNode getPreviousObjectSinkNode()
Returns the previous node- Specified by:
getPreviousObjectSinkNodein interfaceObjectSinkNode- Returns:
- The previous ObjectSinkNode
-
setPreviousObjectSinkNode
public void setPreviousObjectSinkNode(ObjectSinkNode previous)
Sets the previous node- Specified by:
setPreviousObjectSinkNodein interfaceObjectSinkNode- Parameters:
previous- The previous ObjectSinkNode
-
getEntryPoint
public org.drools.base.rule.EntryPointId getEntryPoint()
-
calculateDeclaredMask
public org.drools.util.bitmask.BitMask calculateDeclaredMask(org.drools.base.base.ObjectType modifiedType, java.util.List<java.lang.String> settableProperties)- Specified by:
calculateDeclaredMaskin classObjectSource
-
getRightInputOtnId
public ObjectTypeNode.Id getRightInputOtnId()
- Specified by:
getRightInputOtnIdin interfaceRightTupleSink
-
setRightInputOtnId
public void setRightInputOtnId(ObjectTypeNode.Id rightInputOtnId)
-
-