org.drools.reteoo
Class WindowNode
java.lang.Object
org.drools.common.BaseNode
org.drools.reteoo.ObjectSource
org.drools.reteoo.WindowNode
- All Implemented Interfaces:
- Externalizable, Serializable, NetworkNode, NodeMemory, ObjectSink, ObjectSinkNode, Sink
public class WindowNode
- extends ObjectSource
- implements ObjectSinkNode, NodeMemory
WindowNodes are nodes in the Rete 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
|
Method Summary |
void |
assertObject(InternalFactHandle factHandle,
PropagationContext context,
InternalWorkingMemory workingMemory)
|
void |
attach(BuildContext context)
Attaches the node into the network. |
void |
byPassModifyToBetaNode(InternalFactHandle factHandle,
ModifyPreviousTuples modifyPreviousTuples,
PropagationContext context,
InternalWorkingMemory workingMemory)
|
long |
calculateDeclaredMask(List<String> settableProperties)
|
Memory |
createMemory(RuleBaseConfiguration config)
Creates the WindowNode's memory. |
boolean |
equals(Object object)
|
Behavior[] |
getBehaviors()
Returns the list of behaviors for this window node |
List<AlphaNodeFieldConstraint> |
getConstraints()
Returns the FieldConstraints |
EntryPoint |
getEntryPoint()
|
ObjectSinkNode |
getNextObjectSinkNode()
Returns the next node |
ObjectSinkNode |
getPreviousObjectSinkNode()
Returns the previous node |
int |
hashCode()
The hashCode return is simply the unique id of the node. |
void |
modifyObject(InternalFactHandle factHandle,
ModifyPreviousTuples modifyPreviousTuples,
PropagationContext context,
InternalWorkingMemory workingMemory)
|
void |
readExternal(ObjectInput in)
|
void |
retractObject(InternalFactHandle factHandle,
PropagationContext context,
InternalWorkingMemory workingMemory)
Retract the FactHandle from the WindowNode. |
void |
setNextObjectSinkNode(ObjectSinkNode next)
Sets the next node |
void |
setPreviousObjectSinkNode(ObjectSinkNode previous)
Sets the previous node |
String |
toString()
|
void |
updateSink(ObjectSink sink,
PropagationContext context,
InternalWorkingMemory workingMemory)
|
void |
writeExternal(ObjectOutput out)
|
| Methods inherited from class org.drools.reteoo.ObjectSource |
addObjectSink, doRemove, getDeclaredMask, getObjectTypeNode, getParentObjectSource, getSinkPropagator, initDeclaredMask, isInUse, networkUpdated, removeObjectSink, resetInferredMask, updateMask |
WindowNode
public WindowNode()
WindowNode
public WindowNode(int id,
List<AlphaNodeFieldConstraint> constraints,
List<Behavior> behaviors,
ObjectSource objectSource,
BuildContext context)
- Construct a
WindowNode with a unique id using the provided
list of AlphaNodeFieldConstraint and the given ObjectSource.
- Parameters:
id - Node's IDconstraints - Node's constraintsbehaviors - list of behaviors for this window nodeobjectSource - Node's object source
readExternal
public void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
- Specified by:
readExternal in interface Externalizable- Overrides:
readExternal in class ObjectSource
- Throws:
IOException
ClassNotFoundException
writeExternal
public void writeExternal(ObjectOutput out)
throws IOException
- Specified by:
writeExternal in interface Externalizable- Overrides:
writeExternal in class ObjectSource
- Throws:
IOException
getConstraints
public List<AlphaNodeFieldConstraint> getConstraints()
- Returns the
FieldConstraints
- Returns:
FieldConstraints
getBehaviors
public Behavior[] getBehaviors()
- Returns the list of behaviors for this window node
- Returns:
attach
public void attach(BuildContext context)
- Description copied from class:
BaseNode
- Attaches the node into the network. Usually to the parent
ObjectSource or TupleSource
- Specified by:
attach in class BaseNode
assertObject
public void assertObject(InternalFactHandle factHandle,
PropagationContext context,
InternalWorkingMemory workingMemory)
- Specified by:
assertObject in interface ObjectSink
modifyObject
public void modifyObject(InternalFactHandle factHandle,
ModifyPreviousTuples modifyPreviousTuples,
PropagationContext context,
InternalWorkingMemory workingMemory)
- Specified by:
modifyObject in interface ObjectSink
retractObject
public void retractObject(InternalFactHandle factHandle,
PropagationContext context,
InternalWorkingMemory workingMemory)
- Retract the
FactHandle from the WindowNode.
This method is for the node benefit only as the node itself will not
propagate retracts down the network, relying on the standard Rete
retract algorithm implemented by the ObjectTypeNode to do it.
- Parameters:
factHandle - The fact handle.context - The propagation contextworkingMemory - The working memory session.
byPassModifyToBetaNode
public void byPassModifyToBetaNode(InternalFactHandle factHandle,
ModifyPreviousTuples modifyPreviousTuples,
PropagationContext context,
InternalWorkingMemory workingMemory)
- Specified by:
byPassModifyToBetaNode in interface ObjectSink
updateSink
public void updateSink(ObjectSink sink,
PropagationContext context,
InternalWorkingMemory workingMemory)
- Specified by:
updateSink in class ObjectSource
createMemory
public Memory createMemory(RuleBaseConfiguration config)
- Creates the WindowNode's memory.
- Specified by:
createMemory in interface NodeMemory
toString
public String toString()
- Overrides:
toString in class BaseNode
hashCode
public int hashCode()
- Description copied from class:
BaseNode
- The hashCode return is simply the unique id of the node. It is expected that base classes will also implement equals(Object object).
- Overrides:
hashCode in class BaseNode
equals
public boolean equals(Object object)
- Overrides:
equals in class Object
getNextObjectSinkNode
public ObjectSinkNode getNextObjectSinkNode()
- Returns the next node
- Specified by:
getNextObjectSinkNode in interface ObjectSinkNode
- Returns:
- The next ObjectSinkNode
setNextObjectSinkNode
public void setNextObjectSinkNode(ObjectSinkNode next)
- Sets the next node
- Specified by:
setNextObjectSinkNode in interface ObjectSinkNode
- Parameters:
next - The next ObjectSinkNode
getPreviousObjectSinkNode
public ObjectSinkNode getPreviousObjectSinkNode()
- Returns the previous node
- Specified by:
getPreviousObjectSinkNode in interface ObjectSinkNode
- Returns:
- The previous ObjectSinkNode
setPreviousObjectSinkNode
public void setPreviousObjectSinkNode(ObjectSinkNode previous)
- Sets the previous node
- Specified by:
setPreviousObjectSinkNode in interface ObjectSinkNode
- Parameters:
previous - The previous ObjectSinkNode
getEntryPoint
public EntryPoint getEntryPoint()
calculateDeclaredMask
public long calculateDeclaredMask(List<String> settableProperties)
- Specified by:
calculateDeclaredMask in class ObjectSource
Copyright © 2001-2012 JBoss by Red Hat. All Rights Reserved.