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:
MemoryFactory<WindowNode.WindowMemory>,NetworkNode,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.
-
-
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, partitionsEnabled
-
-
Constructor Summary
Constructors Constructor Description WindowNode()WindowNode(int id, List<AlphaNodeFieldConstraint> constraints, List<Behavior> behaviors, ObjectSource objectSource, BuildContext context)Construct aWindowNodewith a unique id using the provided list ofAlphaNodeFieldConstraintand the givenObjectSource.
-
Method Summary
-
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
addAssociation, addAssociation, attach, getAssociatedRules, getAssociatedRuleSize, getAssociationsSize, getAssociationsSize, getId, getMemoryId, getPartitionId, getSinks, hashCode, initMemoryId, isAssociatedWith, isStreamMode, remove, 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.core.common.NetworkNode
getAssociatedRules, getAssociatedRuleSize, getAssociationsSize, getAssociationsSize, getId, getPartitionId, isAssociatedWith
-
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, List<AlphaNodeFieldConstraint> constraints, List<Behavior> 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 interfaceNetworkNode
-
getConstraints
public List<AlphaNodeFieldConstraint> getConstraints()
Returns theFieldConstraints- Returns:
FieldConstraints
-
getBehaviors
public Behavior[] 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>
-
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 EntryPointId getEntryPoint()
-
calculateDeclaredMask
public BitMask calculateDeclaredMask(ObjectType modifiedType, List<String> settableProperties)
- Specified by:
calculateDeclaredMaskin classObjectSource
-
getRightInputOtnId
public ObjectTypeNode.Id getRightInputOtnId()
- Specified by:
getRightInputOtnIdin interfaceRightTupleSink
-
setRightInputOtnId
public void setRightInputOtnId(ObjectTypeNode.Id rightInputOtnId)
-
-