TuplesMatches -
The tuples that are matched with the handle. the left memory is a LinkedList
of ReteTuples
which maintains a HashMa
,
where the keys are the matching FactHandleImpl
s and the value is populated TupleMatche
es, the keys are matched fact handles.
TupleMatch
maintains a List
of resulting joins, where there is joined ReteTuple
per TupleSink
.
- See Also:
- Serialized Form
Method Summary |
void |
addShare()
Each time a node is shared a counter is increased. |
protected void |
addTupleSink(org.drools.reteoo.TupleSink tupleSink)
Adds the TupleSink so that it may receive
Tuples propagated from this TupleSource . |
void |
assertObject(DefaultFactHandle handle,
PropagationContext context,
ReteooWorkingMemory workingMemory)
Assert a new FactHandleImpl from the right input. |
void |
assertTuple(ReteTuple leftTuple,
PropagationContext context,
ReteooWorkingMemory workingMemory)
Assert a new ReteTuple from the left input. |
void |
attach()
Attaches the node into the network. |
void |
attach(ReteooWorkingMemory[] workingMemories)
|
protected TupleMatch |
attemptJoin(ReteTuple leftTuple,
DefaultFactHandle handle,
ObjectMatches objectMatches,
BetaNodeBinder binder,
ReteooWorkingMemory workingMemory)
|
java.lang.Object |
createMemory(RuleBaseConfiguration config)
Creates a BetaMemory for the BetaNode's memory. |
boolean |
equals(java.lang.Object object)
|
FieldConstraint[] |
getConstraints()
|
int |
getId()
Returns the unique id that represents the node in the Rete network |
java.util.List |
getPropagatedTuples(ReteooWorkingMemory workingMemory,
org.drools.reteoo.TupleSink sink)
Returns the list of propagated tuples |
int |
getSharedCount()
Returns the number of times the node is shared |
java.util.List |
getTupleSinks()
Retrieve the TupleSinks that receive propagated
Tuples s. |
int |
hashCode()
The hashCode return is simply the unique id of the node. |
boolean |
hasMemory()
Indicates whether the node has any memory. |
boolean |
isInUse()
Returns true in case the current node is in use (is referenced by any other node) |
boolean |
isShared()
Indicates whether the node is shared. |
void |
modifyObject(DefaultFactHandle handle,
PropagationContext context,
ReteooWorkingMemory workingMemory)
|
void |
modifyTuple(ReteTuple leftTuple,
PropagationContext context,
ReteooWorkingMemory workingMemory)
|
protected void |
propagateAssertTuple(ReteTuple tuple,
DefaultFactHandle handle,
PropagationContext context,
ReteooWorkingMemory workingMemory)
Propagates a new tuple adding the given fact handle to the tuple
before propagating. |
protected void |
propagateAssertTuple(ReteTuple tuple,
PropagationContext context,
ReteooWorkingMemory workingMemory)
|
protected void |
propagateAssertTuple(ReteTuple tuple,
TupleMatch tupleMatch,
PropagationContext context,
ReteooWorkingMemory workingMemory)
Propagate the assertion of a ReteTuple to this node's
TupleSink . |
protected void |
propagateModifyTuple(ReteTuple tuple,
PropagationContext context,
ReteooWorkingMemory workingMemory)
|
protected void |
propagateModifyTuple(TupleMatch tupleMatch,
PropagationContext context,
ReteooWorkingMemory workingMemory)
|
protected void |
propagateRetractTuple(ReteTuple tuple,
PropagationContext context,
ReteooWorkingMemory workingMemory)
|
protected void |
propagateRetractTuple(TupleMatch tupleMatch,
PropagationContext context,
ReteooWorkingMemory workingMemory)
|
void |
remove(org.drools.reteoo.BaseNode node,
ReteooWorkingMemory[] workingMemories)
Removes the node from teh network. |
void |
removeShare()
Each time a node is unshared a counter is decreased. |
protected void |
removeTupleSink(org.drools.reteoo.TupleSink tupleSink)
Removes the TupleSink |
void |
retractObject(DefaultFactHandle handle,
PropagationContext context,
ReteooWorkingMemory workingMemory)
Retract the FactHandleImpl . |
void |
retractTuple(ReteTuple leftTuple,
PropagationContext context,
ReteooWorkingMemory workingMemory)
Retract the
ReteTuple, any resulting proppagated joins are also retracted. |
protected void |
setHasMemory(boolean hasMemory)
Specifies with the node has any memory. |
java.lang.String |
toString()
|
void |
updateNewNode(ReteooWorkingMemory workingMemory,
PropagationContext context)
When nodes are added to the network that already has data. that existing data must be repropagated to the new node. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
tupleSinks
protected java.util.List tupleSinks
- The destination for
Tuples
.
id
protected final int id
attachingNewNode
protected boolean attachingNewNode
hasMemory
protected boolean hasMemory
sharedCount
protected int sharedCount
assertTuple
public void assertTuple(ReteTuple leftTuple,
PropagationContext context,
ReteooWorkingMemory workingMemory)
- Assert a new
ReteTuple
from the left input. It iterates
over the right FactHandleImpl
's if no matches are found
the a copy of the ReteTuple
is made and propagated.
- Parameters:
tuple
- The Tuple
being asserted.context
- The PropagationContext
workingMemory
- The working memory seesion.
assertObject
public void assertObject(DefaultFactHandle handle,
PropagationContext context,
ReteooWorkingMemory workingMemory)
- Assert a new
FactHandleImpl
from the right input. If it
matches any left ReteTuple's that already has propagations then those
propagations are retracted.
- Parameters:
handle
- The FactHandleImpl
being asserted.context
- The PropagationContext
workingMemory
- The working memory seesion.
retractObject
public void retractObject(DefaultFactHandle handle,
PropagationContext context,
ReteooWorkingMemory workingMemory)
- Retract the
FactHandleImpl
. If the handle has any
ReteTuple
matches then those matches copied are propagated
as new joins.
- Parameters:
handle
- the being retractedcontext
- The PropagationContext
workingMemory
- The working memory seesion.
- Throws:
AssertionException
retractTuple
public void retractTuple(ReteTuple leftTuple,
PropagationContext context,
ReteooWorkingMemory workingMemory)
- Retract the
ReteTuple, any resulting proppagated joins are also retracted.
- Parameters:
key
- The tuple key.context
- The PropagationContext
workingMemory
- The working memory seesion.
modifyTuple
public void modifyTuple(ReteTuple leftTuple,
PropagationContext context,
ReteooWorkingMemory workingMemory)
modifyObject
public void modifyObject(DefaultFactHandle handle,
PropagationContext context,
ReteooWorkingMemory workingMemory)
updateNewNode
public void updateNewNode(ReteooWorkingMemory workingMemory,
PropagationContext context)
- When nodes are added to the network that already has data. that existing data must be repropagated to the new node.
This new propagation may result in one or more assertions, so a PropagationContext and the workingMemory for the facts
must be provided.
- Parameters:
workingMemory
- The WorkingMemorycontext
- The PropagationContext
getPropagatedTuples
public java.util.List getPropagatedTuples(ReteooWorkingMemory workingMemory,
org.drools.reteoo.TupleSink sink)
- Returns the list of propagated tuples
- Returns:
getConstraints
public FieldConstraint[] getConstraints()
attach
public void attach()
- Attaches the node into the network. Usually to the parent
ObjectSource
or TupleSource
attach
public void attach(ReteooWorkingMemory[] workingMemories)
remove
public void remove(org.drools.reteoo.BaseNode node,
ReteooWorkingMemory[] workingMemories)
- Removes the node from teh network. Usually from the parent
ObjectSource
or TupleSource
toString
public java.lang.String toString()
hashCode
public int hashCode()
- The hashCode return is simply the unique id of the node. It is expected that base classes will also implement equals(Object object).
equals
public boolean equals(java.lang.Object object)
- Overrides:
equals
in class java.lang.Object
createMemory
public java.lang.Object createMemory(RuleBaseConfiguration config)
- Creates a BetaMemory for the BetaNode's memory.
- Specified by:
createMemory
in interface NodeMemory
addTupleSink
protected void addTupleSink(org.drools.reteoo.TupleSink tupleSink)
- Adds the
TupleSink
so that it may receive
Tuples
propagated from this TupleSource
.
- Parameters:
tupleSink
- The TupleSink
to receive propagated
Tuples
.
removeTupleSink
protected void removeTupleSink(org.drools.reteoo.TupleSink tupleSink)
- Removes the
TupleSink
- Parameters:
tupleSink
- The TupleSink
to remove
attemptJoin
protected TupleMatch attemptJoin(ReteTuple leftTuple,
DefaultFactHandle handle,
ObjectMatches objectMatches,
BetaNodeBinder binder,
ReteooWorkingMemory workingMemory)
propagateAssertTuple
protected void propagateAssertTuple(ReteTuple tuple,
TupleMatch tupleMatch,
PropagationContext context,
ReteooWorkingMemory workingMemory)
- Propagate the assertion of a
ReteTuple
to this node's
TupleSink
.
- Parameters:
tuple
- The ReteTuple
to propagate.context
- The PropagationContext
of the
WorkingMemory actionworkingMemory
- the WorkingMemory
session.
propagateAssertTuple
protected void propagateAssertTuple(ReteTuple tuple,
PropagationContext context,
ReteooWorkingMemory workingMemory)
propagateAssertTuple
protected void propagateAssertTuple(ReteTuple tuple,
DefaultFactHandle handle,
PropagationContext context,
ReteooWorkingMemory workingMemory)
- Propagates a new tuple adding the given fact handle to the tuple
before propagating.
- Parameters:
tuple
- The base tuple for propagationhandle
- The handle to add to the tuple when propagatingcontext
- workingMemory
-
propagateRetractTuple
protected void propagateRetractTuple(TupleMatch tupleMatch,
PropagationContext context,
ReteooWorkingMemory workingMemory)
propagateRetractTuple
protected void propagateRetractTuple(ReteTuple tuple,
PropagationContext context,
ReteooWorkingMemory workingMemory)
propagateModifyTuple
protected void propagateModifyTuple(TupleMatch tupleMatch,
PropagationContext context,
ReteooWorkingMemory workingMemory)
propagateModifyTuple
protected void propagateModifyTuple(ReteTuple tuple,
PropagationContext context,
ReteooWorkingMemory workingMemory)
getTupleSinks
public java.util.List getTupleSinks()
- Retrieve the
TupleSinks
that receive propagated
Tuples
s.
- Returns:
- The
TupleSinks
that receive propagated
Tuples
.
getId
public int getId()
- Description copied from interface:
ReteooNode
- Returns the unique id that represents the node in the Rete network
- Specified by:
getId
in interface ReteooNode
- Returns:
- unique int value
setHasMemory
protected void setHasMemory(boolean hasMemory)
- Specifies with the node has any memory.
- Parameters:
hasMemory
-
hasMemory
public boolean hasMemory()
- Indicates whether the node has any memory.
- Returns:
addShare
public void addShare()
- Each time a node is shared a counter is increased.
removeShare
public void removeShare()
- Each time a node is unshared a counter is decreased.
isShared
public boolean isShared()
- Indicates whether the node is shared.
- Returns:
isInUse
public boolean isInUse()
- Returns true in case the current node is in use (is referenced by any other node)
- Returns:
getSharedCount
public int getSharedCount()
- Returns the number of times the node is shared
- Returns:
- int value indicating the share count.