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>
WindowNodes
are nodes in theRete
network 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 class
WindowNode.WindowMemory
-
Field Summary
Fields Modifier and Type Field Description protected BehaviorManager
behavior
-
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, partitionsEnabled
-
-
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 aWindowNode
with a unique id using the provided list ofAlphaNodeFieldConstraint
and the givenObjectSource
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
assertObject(InternalFactHandle factHandle, PropagationContext pctx, ReteEvaluator reteEvaluator)
void
byPassModifyToBetaNode(InternalFactHandle factHandle, ModifyPreviousTuples modifyPreviousTuples, PropagationContext context, ReteEvaluator reteEvaluator)
org.drools.core.util.bitmask.BitMask
calculateDeclaredMask(org.drools.base.base.ObjectType modifiedType, java.util.List<java.lang.String> settableProperties)
WindowNode.WindowMemory
createMemory(RuleBaseConfiguration config, ReteEvaluator reteEvaluator)
Creates the WindowNode's memory.void
doAttach(BuildContext context)
boolean
equals(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 theFieldConstraints
org.drools.base.rule.EntryPointId
getEntryPoint()
ObjectSinkNode
getNextObjectSinkNode()
Returns the next nodeObjectSinkNode
getPreviousObjectSinkNode()
Returns the previous nodeObjectTypeNode.Id
getRightInputOtnId()
short
getType()
void
modifyObject(InternalFactHandle factHandle, ModifyPreviousTuples modifyPreviousTuples, PropagationContext context, ReteEvaluator reteEvaluator)
void
modifyRightTuple(RightTuple rightTuple, PropagationContext context, ReteEvaluator reteEvaluator)
void
retractRightTuple(RightTuple rightTuple, PropagationContext pctx, ReteEvaluator reteEvaluator)
void
setNextObjectSinkNode(ObjectSinkNode next)
Sets the next nodevoid
setPreviousObjectSinkNode(ObjectSinkNode previous)
Sets the previous nodevoid
setRightInputOtnId(ObjectTypeNode.Id rightInputOtnId)
java.lang.String
toString()
void
updateSink(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, setPartitionsEnabled, 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 aWindowNode
with a unique id using the provided list ofAlphaNodeFieldConstraint
and 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:
getType
in 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:
assertObject
in interfaceObjectSink
-
retractRightTuple
public void retractRightTuple(RightTuple rightTuple, PropagationContext pctx, ReteEvaluator reteEvaluator)
- Specified by:
retractRightTuple
in interfaceRightTupleSink
-
modifyRightTuple
public void modifyRightTuple(RightTuple rightTuple, PropagationContext context, ReteEvaluator reteEvaluator)
- Specified by:
modifyRightTuple
in interfaceRightTupleSink
-
modifyObject
public void modifyObject(InternalFactHandle factHandle, ModifyPreviousTuples modifyPreviousTuples, PropagationContext context, ReteEvaluator reteEvaluator)
- Specified by:
modifyObject
in interfaceObjectSink
-
byPassModifyToBetaNode
public void byPassModifyToBetaNode(InternalFactHandle factHandle, ModifyPreviousTuples modifyPreviousTuples, PropagationContext context, ReteEvaluator reteEvaluator)
- Specified by:
byPassModifyToBetaNode
in interfaceObjectSink
-
updateSink
public void updateSink(ObjectSink sink, PropagationContext context, InternalWorkingMemory workingMemory)
- Specified by:
updateSink
in classObjectSource
-
createMemory
public WindowNode.WindowMemory createMemory(RuleBaseConfiguration config, ReteEvaluator reteEvaluator)
Creates the WindowNode's memory.- Specified by:
createMemory
in interfaceMemoryFactory<WindowNode.WindowMemory>
-
equals
public boolean equals(java.lang.Object object)
- Overrides:
equals
in classjava.lang.Object
-
getNextObjectSinkNode
public ObjectSinkNode getNextObjectSinkNode()
Returns the next node- Specified by:
getNextObjectSinkNode
in interfaceObjectSinkNode
- Returns:
- The next ObjectSinkNode
-
setNextObjectSinkNode
public void setNextObjectSinkNode(ObjectSinkNode next)
Sets the next node- Specified by:
setNextObjectSinkNode
in interfaceObjectSinkNode
- Parameters:
next
- The next ObjectSinkNode
-
getPreviousObjectSinkNode
public ObjectSinkNode getPreviousObjectSinkNode()
Returns the previous node- Specified by:
getPreviousObjectSinkNode
in interfaceObjectSinkNode
- Returns:
- The previous ObjectSinkNode
-
setPreviousObjectSinkNode
public void setPreviousObjectSinkNode(ObjectSinkNode previous)
Sets the previous node- Specified by:
setPreviousObjectSinkNode
in interfaceObjectSinkNode
- Parameters:
previous
- The previous ObjectSinkNode
-
getEntryPoint
public org.drools.base.rule.EntryPointId getEntryPoint()
-
calculateDeclaredMask
public org.drools.core.util.bitmask.BitMask calculateDeclaredMask(org.drools.base.base.ObjectType modifiedType, java.util.List<java.lang.String> settableProperties)
- Specified by:
calculateDeclaredMask
in classObjectSource
-
getRightInputOtnId
public ObjectTypeNode.Id getRightInputOtnId()
- Specified by:
getRightInputOtnId
in interfaceRightTupleSink
-
setRightInputOtnId
public void setRightInputOtnId(ObjectTypeNode.Id rightInputOtnId)
-
-