public abstract class AbstractBetaNode extends AbstractNode implements IObjectConsumerNode, ITupleConsumerNode, ITupleSourceNode
Modifier and Type | Field and Description |
---|---|
protected IConstraintEvaluator[] |
evaluators
The constraint evaluator.
|
protected ConstraintIndexer[] |
indexers
The indexed constraint indexers.
|
protected AttributeSet |
indirects
The set of indirect attributes.
|
protected IObjectSourceNode |
osource
The object source.
|
protected AttributeSet |
relevants
The set of relevant attributes.
|
protected ITupleConsumerNode[] |
tconsumers
The tuple consumers.
|
protected ITupleSourceNode |
tsource
The tuple source.
|
clones, nodeid
Constructor and Description |
---|
AbstractBetaNode(int nodeid,
IConstraintEvaluator[] evaluators,
ConstraintIndexer[] xevaluators)
Create a new beta node.
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
addMatch(Tuple left,
java.lang.Object right,
IOAVState state,
ReteMemory mem,
AbstractAgenda agenda)
Add a match to the node memory and propagate if necessary.
|
void |
addObject(java.lang.Object right,
IOAVState state,
ReteMemory mem,
AbstractAgenda agenda)
Send an object to this node.
|
void |
addTuple(Tuple left,
IOAVState state,
ReteMemory mem,
AbstractAgenda agenda)
Send a tuple to this node.
|
void |
addTupleConsumer(ITupleConsumerNode node)
Add an tuple consumer node.
|
protected boolean |
checkNonindexedConstraints(Tuple left,
java.lang.Object right,
IOAVState state)
Check the non-indexed constraints for the given left/right values.
|
java.lang.Object |
createNodeMemory(IOAVState state)
Create the node memory.
|
protected void |
doClone(java.lang.Object theclone)
Do clone makes a deep clone without regarding cycles.
|
protected java.util.Collection |
fetchObjectMemory(IOAVState state,
Tuple left,
ReteMemory mem)
Fetch the object memory for a given object.
|
protected java.util.Collection |
fetchTupleMemory(IOAVState state,
java.lang.Object right,
ReteMemory mem)
Fetch the tuple memory for a given object.
|
IConstraintEvaluator[] |
getConstraintEvaluators()
Get the evaluators.
|
ConstraintIndexer[] |
getConstraintIndexers()
Get the indexers.
|
AttributeSet |
getIndirectAttributes()
Get the set of indirect attribute types.
|
java.util.Collection |
getNodeMemory(ReteMemory mem)
Get the memory for this node.
|
IObjectSourceNode |
getObjectSource()
Get the object source of this node.
|
AttributeSet |
getRelevantAttributes()
Get the set of relevant attribute types.
|
ITupleConsumerNode[] |
getTupleConsumers()
Get all tuple consumer nodes.
|
ITupleSourceNode |
getTupleSource()
Get the tuple source of this node.
|
protected java.util.Collection |
identityIntersection(IOAVState state,
java.util.Collection c1,
java.util.Collection c2)
Compute the intersection of two collections.
|
protected java.util.Collection |
intersection(IOAVState state,
java.util.Collection c1,
java.util.Collection c2)
Compute the intersection of two collections.
|
boolean |
isAffected(OAVAttributeType attr)
Test if the node is affected from a modification.
|
protected abstract boolean |
isMatchContained(IOAVState state,
Tuple left,
java.lang.Object right,
ReteMemory mem)
Check if a match is contained.
|
void |
modifyIndirectObject(java.lang.Object object,
OAVAttributeType type,
java.lang.Object oldvalue,
java.lang.Object newvalue,
IOAVState state,
ReteMemory mem,
AbstractAgenda agenda)
Propagate an indirect object change to this node.
|
void |
modifyObject(java.lang.Object right,
OAVAttributeType type,
java.lang.Object oldvalue,
java.lang.Object newvalue,
IOAVState state,
ReteMemory mem,
AbstractAgenda agenda)
Propagate an object change to this node.
|
void |
modifyTuple(Tuple left,
int tupleindex,
OAVAttributeType type,
java.lang.Object oldvalue,
java.lang.Object newvalue,
IOAVState state,
ReteMemory mem,
AbstractAgenda agenda)
Modify a tuple in this node.
|
protected abstract void |
propagateModification(Tuple left,
java.lang.Object right,
int tupleindex,
OAVAttributeType type,
java.lang.Object oldvalue,
java.lang.Object newvalue,
IOAVState state,
ReteMemory mem,
AbstractAgenda agenda)
Propagate a change of a tuple in the result memory.
|
protected abstract void |
removeMatch(Tuple left,
java.lang.Object right,
IOAVState state,
ReteMemory mem,
AbstractAgenda agenda)
Remove a match from the node memory and propagate if necessary.
|
void |
removeObject(java.lang.Object right,
IOAVState state,
ReteMemory mem,
AbstractAgenda agenda)
Remove an object from this node.
|
void |
removeTuple(Tuple left,
IOAVState state,
ReteMemory mem,
AbstractAgenda agenda)
Remove a tuple from this node.
|
void |
removeTupleConsumer(ITupleConsumerNode node)
Remove an tuple consumer.
|
void |
setObjectSource(IObjectSourceNode node)
Set the object source of this node.
|
void |
setTupleSource(ITupleSourceNode node)
Set the tuple source of this node.
|
checkNodeConsistency, clone, equals, getNodeId, hashCode, toString, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
checkNodeConsistency, clone, getNodeId
protected ITupleConsumerNode[] tconsumers
protected IObjectSourceNode osource
protected ITupleSourceNode tsource
protected IConstraintEvaluator[] evaluators
protected ConstraintIndexer[] indexers
protected volatile AttributeSet relevants
protected volatile AttributeSet indirects
public AbstractBetaNode(int nodeid, IConstraintEvaluator[] evaluators, ConstraintIndexer[] xevaluators)
public void addTupleConsumer(ITupleConsumerNode node)
addTupleConsumer
in interface ITupleSourceNode
node
- A new consumer node.public void removeTupleConsumer(ITupleConsumerNode node)
removeTupleConsumer
in interface ITupleSourceNode
node
- The consumer node.public java.util.Collection getNodeMemory(ReteMemory mem)
getNodeMemory
in interface INode
getNodeMemory
in interface ITupleSourceNode
public ITupleConsumerNode[] getTupleConsumers()
getTupleConsumers
in interface ITupleSourceNode
public void addTuple(Tuple left, IOAVState state, ReteMemory mem, AbstractAgenda agenda)
addTuple
in interface ITupleConsumerNode
tuple
- The tuple.public void removeTuple(Tuple left, IOAVState state, ReteMemory mem, AbstractAgenda agenda)
removeTuple
in interface ITupleConsumerNode
tuple
- The tuple.public void modifyTuple(Tuple left, int tupleindex, OAVAttributeType type, java.lang.Object oldvalue, java.lang.Object newvalue, IOAVState state, ReteMemory mem, AbstractAgenda agenda)
modifyTuple
in interface ITupleConsumerNode
left
- The tuple.public void setTupleSource(ITupleSourceNode node)
setTupleSource
in interface ITupleConsumerNode
node
- The tuple source node.public ITupleSourceNode getTupleSource()
getTupleSource
in interface ITupleConsumerNode
public void addObject(java.lang.Object right, IOAVState state, ReteMemory mem, AbstractAgenda agenda)
addObject
in interface IObjectConsumerNode
object
- The object.public void removeObject(java.lang.Object right, IOAVState state, ReteMemory mem, AbstractAgenda agenda)
removeObject
in interface IObjectConsumerNode
object
- The object.public void modifyObject(java.lang.Object right, OAVAttributeType type, java.lang.Object oldvalue, java.lang.Object newvalue, IOAVState state, ReteMemory mem, AbstractAgenda agenda)
modifyObject
in interface IObjectConsumerNode
right
- The new object.public void modifyIndirectObject(java.lang.Object object, OAVAttributeType type, java.lang.Object oldvalue, java.lang.Object newvalue, IOAVState state, ReteMemory mem, AbstractAgenda agenda)
modifyIndirectObject
in interface INode
id
- The changed object.public void setObjectSource(IObjectSourceNode node)
setObjectSource
in interface IObjectConsumerNode
node
- The object source node.public IObjectSourceNode getObjectSource()
getObjectSource
in interface IObjectConsumerNode
public java.lang.Object createNodeMemory(IOAVState state)
createNodeMemory
in interface INode
state
- The state.public ConstraintIndexer[] getConstraintIndexers()
public IConstraintEvaluator[] getConstraintEvaluators()
protected java.util.Collection intersection(IOAVState state, java.util.Collection c1, java.util.Collection c2)
c1
- The first collection.c2
- The second collection.protected java.util.Collection identityIntersection(IOAVState state, java.util.Collection c1, java.util.Collection c2)
c1
- The first collection.c2
- The second collection.protected java.util.Collection fetchTupleMemory(IOAVState state, java.lang.Object right, ReteMemory mem)
right
- The right object.mem
- The rete memory.state
- The state.protected java.util.Collection fetchObjectMemory(IOAVState state, Tuple left, ReteMemory mem)
left
- The left tuple.value
- The hash value (if any).type
- The attribute type (if any).tupleindex
- The tuple index of the changed object (if any).mem
- The rete memory.state
- The state.protected boolean checkNonindexedConstraints(Tuple left, java.lang.Object right, IOAVState state)
public boolean isAffected(OAVAttributeType attr)
type
- The attribute type.public AttributeSet getRelevantAttributes()
getRelevantAttributes
in interface INode
public AttributeSet getIndirectAttributes()
getIndirectAttributes
in interface INode
protected void doClone(java.lang.Object theclone)
doClone
in class AbstractNode
theclone
- The clone.protected abstract void addMatch(Tuple left, java.lang.Object right, IOAVState state, ReteMemory mem, AbstractAgenda agenda)
protected abstract void removeMatch(Tuple left, java.lang.Object right, IOAVState state, ReteMemory mem, AbstractAgenda agenda)
protected abstract void propagateModification(Tuple left, java.lang.Object right, int tupleindex, OAVAttributeType type, java.lang.Object oldvalue, java.lang.Object newvalue, IOAVState state, ReteMemory mem, AbstractAgenda agenda)
protected abstract boolean isMatchContained(IOAVState state, Tuple left, java.lang.Object right, ReteMemory mem)