Class AbstractBetaNode
- java.lang.Object
- 
- jadex.rules.rulesystem.rete.nodes.AbstractNode
- 
- jadex.rules.rulesystem.rete.nodes.AbstractBetaNode
 
 
- 
- All Implemented Interfaces:
- INode,- IObjectConsumerNode,- ITupleConsumerNode,- ITupleSourceNode,- java.lang.Cloneable
 
 public abstract class AbstractBetaNode extends AbstractNode implements IObjectConsumerNode, ITupleConsumerNode, ITupleSourceNode A beta node has the purpose to perform a constraints check between (at least) two objects. The beta node has to incoming coming connections which both can activate the node.
- 
- 
Field SummaryFields Modifier and Type Field Description protected IConstraintEvaluator[]evaluatorsThe constraint evaluator.protected ConstraintIndexer[]indexersThe indexed constraint indexers.protected AttributeSetindirectsThe set of indirect attributes.protected IObjectSourceNodeosourceThe object source.protected AttributeSetrelevantsThe set of relevant attributes.protected ITupleConsumerNode[]tconsumersThe tuple consumers.protected ITupleSourceNodetsourceThe tuple source.- 
Fields inherited from class jadex.rules.rulesystem.rete.nodes.AbstractNodeclones, nodeid
 
- 
 - 
Constructor SummaryConstructors Constructor Description AbstractBetaNode(int nodeid, IConstraintEvaluator[] evaluators, ConstraintIndexer[] xevaluators)Create a new beta node.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidaddMatch(Tuple left, java.lang.Object right, IOAVState state, ReteMemory mem, AbstractAgenda agenda)Add a match to the node memory and propagate if necessary.voidaddObject(java.lang.Object right, IOAVState state, ReteMemory mem, AbstractAgenda agenda)Send an object to this node.voidaddTuple(Tuple left, IOAVState state, ReteMemory mem, AbstractAgenda agenda)Send a tuple to this node.voidaddTupleConsumer(ITupleConsumerNode node)Add an tuple consumer node.protected booleancheckNonindexedConstraints(Tuple left, java.lang.Object right, IOAVState state)Check the non-indexed constraints for the given left/right values.java.lang.ObjectcreateNodeMemory(IOAVState state)Create the node memory.protected voiddoClone(java.lang.Object theclone)Do clone makes a deep clone without regarding cycles.protected java.util.CollectionfetchObjectMemory(IOAVState state, Tuple left, ReteMemory mem)Fetch the object memory for a given object.protected java.util.CollectionfetchTupleMemory(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.AttributeSetgetIndirectAttributes()Get the set of indirect attribute types.java.util.CollectiongetNodeMemory(ReteMemory mem)Get the memory for this node.IObjectSourceNodegetObjectSource()Get the object source of this node.AttributeSetgetRelevantAttributes()Get the set of relevant attribute types.ITupleConsumerNode[]getTupleConsumers()Get all tuple consumer nodes.ITupleSourceNodegetTupleSource()Get the tuple source of this node.protected java.util.CollectionidentityIntersection(IOAVState state, java.util.Collection c1, java.util.Collection c2)Compute the intersection of two collections.protected java.util.Collectionintersection(IOAVState state, java.util.Collection c1, java.util.Collection c2)Compute the intersection of two collections.booleanisAffected(OAVAttributeType attr)Test if the node is affected from a modification.protected abstract booleanisMatchContained(IOAVState state, Tuple left, java.lang.Object right, ReteMemory mem)Check if a match is contained.voidmodifyIndirectObject(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.voidmodifyObject(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.voidmodifyTuple(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 voidpropagateModification(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 voidremoveMatch(Tuple left, java.lang.Object right, IOAVState state, ReteMemory mem, AbstractAgenda agenda)Remove a match from the node memory and propagate if necessary.voidremoveObject(java.lang.Object right, IOAVState state, ReteMemory mem, AbstractAgenda agenda)Remove an object from this node.voidremoveTuple(Tuple left, IOAVState state, ReteMemory mem, AbstractAgenda agenda)Remove a tuple from this node.voidremoveTupleConsumer(ITupleConsumerNode node)Remove an tuple consumer.voidsetObjectSource(IObjectSourceNode node)Set the object source of this node.voidsetTupleSource(ITupleSourceNode node)Set the tuple source of this node.- 
Methods inherited from class jadex.rules.rulesystem.rete.nodes.AbstractNodecheckNodeConsistency, clone, equals, getNodeId, hashCode, toString, toString
 - 
Methods inherited from class java.lang.Objectfinalize, getClass, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface jadex.rules.rulesystem.rete.nodes.INodecheckNodeConsistency, clone, getNodeId
 
- 
 
- 
- 
- 
Field Detail- 
tconsumersprotected ITupleConsumerNode[] tconsumers The tuple consumers.
 - 
osourceprotected IObjectSourceNode osource The object source.
 - 
tsourceprotected ITupleSourceNode tsource The tuple source.
 - 
evaluatorsprotected IConstraintEvaluator[] evaluators The constraint evaluator.
 - 
indexersprotected ConstraintIndexer[] indexers The indexed constraint indexers.
 - 
relevantsprotected volatile AttributeSet relevants The set of relevant attributes.
 - 
indirectsprotected volatile AttributeSet indirects The set of indirect attributes.
 
- 
 - 
Constructor Detail- 
AbstractBetaNodepublic AbstractBetaNode(int nodeid, IConstraintEvaluator[] evaluators, ConstraintIndexer[] xevaluators)Create a new beta node.
 
- 
 - 
Method Detail- 
addTupleConsumerpublic void addTupleConsumer(ITupleConsumerNode node) Add an tuple consumer node.- Specified by:
- addTupleConsumerin interface- ITupleSourceNode
- Parameters:
- node- A new consumer node.
 
 - 
removeTupleConsumerpublic void removeTupleConsumer(ITupleConsumerNode node) Remove an tuple consumer.- Specified by:
- removeTupleConsumerin interface- ITupleSourceNode
- Parameters:
- node- The consumer node.
 
 - 
getNodeMemorypublic java.util.Collection getNodeMemory(ReteMemory mem) Get the memory for this node.- Specified by:
- getNodeMemoryin interface- INode
- Specified by:
- getNodeMemoryin interface- ITupleSourceNode
- Returns:
- The memory.
 
 - 
getTupleConsumerspublic ITupleConsumerNode[] getTupleConsumers() Get all tuple consumer nodes.- Specified by:
- getTupleConsumersin interface- ITupleSourceNode
- Returns:
- All tuple consumer nodes.
 
 - 
addTuplepublic void addTuple(Tuple left, IOAVState state, ReteMemory mem, AbstractAgenda agenda) Send a tuple to this node.- Specified by:
- addTuplein interface- ITupleConsumerNode
- Parameters:
- tuple- The tuple.
 
 - 
removeTuplepublic void removeTuple(Tuple left, IOAVState state, ReteMemory mem, AbstractAgenda agenda) Remove a tuple from this node.- Specified by:
- removeTuplein interface- ITupleConsumerNode
- Parameters:
- tuple- The tuple.
 
 - 
modifyTuplepublic 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.- Specified by:
- modifyTuplein interface- ITupleConsumerNode
- Parameters:
- left- The tuple.
 
 - 
setTupleSourcepublic void setTupleSource(ITupleSourceNode node) Set the tuple source of this node.- Specified by:
- setTupleSourcein interface- ITupleConsumerNode
- Parameters:
- node- The tuple source node.
 
 - 
getTupleSourcepublic ITupleSourceNode getTupleSource() Get the tuple source of this node.- Specified by:
- getTupleSourcein interface- ITupleConsumerNode
- Returns:
- The object source node.
 
 - 
addObjectpublic void addObject(java.lang.Object right, IOAVState state, ReteMemory mem, AbstractAgenda agenda)Send an object to this node.- Specified by:
- addObjectin interface- IObjectConsumerNode
- Parameters:
- object- The object.
 
 - 
removeObjectpublic void removeObject(java.lang.Object right, IOAVState state, ReteMemory mem, AbstractAgenda agenda)Remove an object from this node.- Specified by:
- removeObjectin interface- IObjectConsumerNode
- Parameters:
- object- The object.
 
 - 
modifyObjectpublic 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.- Specified by:
- modifyObjectin interface- IObjectConsumerNode
- Parameters:
- right- The new object.
 
 - 
modifyIndirectObjectpublic 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.- Specified by:
- modifyIndirectObjectin interface- INode
- Parameters:
- id- The changed object.
 
 - 
setObjectSourcepublic void setObjectSource(IObjectSourceNode node) Set the object source of this node.- Specified by:
- setObjectSourcein interface- IObjectConsumerNode
- Parameters:
- node- The object source node.
 
 - 
getObjectSourcepublic IObjectSourceNode getObjectSource() Get the object source of this node.- Specified by:
- getObjectSourcein interface- IObjectConsumerNode
- Returns:
- The object source node.
 
 - 
createNodeMemorypublic java.lang.Object createNodeMemory(IOAVState state) Create the node memory.- Specified by:
- createNodeMemoryin interface- INode
- Parameters:
- state- The state.
- Returns:
- The node memory.
 
 - 
getConstraintIndexerspublic ConstraintIndexer[] getConstraintIndexers() Get the indexers.- Returns:
- The indexers.
 
 - 
getConstraintEvaluatorspublic IConstraintEvaluator[] getConstraintEvaluators() Get the evaluators.- Returns:
- The evaluators.
 
 - 
intersectionprotected java.util.Collection intersection(IOAVState state, java.util.Collection c1, java.util.Collection c2) Compute the intersection of two collections.- Parameters:
- c1- The first collection.
- c2- The second collection.
- Returns:
- The intersection.
 
 - 
identityIntersectionprotected java.util.Collection identityIntersection(IOAVState state, java.util.Collection c1, java.util.Collection c2) Compute the intersection of two collections.- Parameters:
- c1- The first collection.
- c2- The second collection.
- Returns:
- The intersection.
 
 - 
fetchTupleMemoryprotected java.util.Collection fetchTupleMemory(IOAVState state, java.lang.Object right, ReteMemory mem) Fetch the tuple memory for a given object.- Parameters:
- right- The right object.
- mem- The rete memory.
- state- The state.
- Returns:
- The tuple memory matching that object (or complete).
 
 - 
fetchObjectMemoryprotected java.util.Collection fetchObjectMemory(IOAVState state, Tuple left, ReteMemory mem) Fetch the object memory for a given object.- Parameters:
- 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.
- Returns:
- The tuple memory matching that object (or complete).
 
 - 
checkNonindexedConstraintsprotected boolean checkNonindexedConstraints(Tuple left, java.lang.Object right, IOAVState state) Check the non-indexed constraints for the given left/right values.
 - 
isAffectedpublic boolean isAffected(OAVAttributeType attr) Test if the node is affected from a modification.- Parameters:
- type- The attribute type.
- Returns:
- True, if possibly affected.
 
 - 
getRelevantAttributespublic AttributeSet getRelevantAttributes() Get the set of relevant attribute types.- Specified by:
- getRelevantAttributesin interface- INode
 
 - 
getIndirectAttributespublic AttributeSet getIndirectAttributes() Get the set of indirect attribute types. I.e. attributes of objects, which are not part of an object conditions (e.g. for chained extractors)- Specified by:
- getIndirectAttributesin interface- INode
- Returns:
- The relevant attribute types.
 
 - 
doCloneprotected void doClone(java.lang.Object theclone) Do clone makes a deep clone without regarding cycles. Method is overridden by subclasses to actually incorporate their attributes.- Specified by:
- doClonein class- AbstractNode
- Parameters:
- theclone- The clone.
 
 - 
addMatchprotected 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.
 - 
removeMatchprotected 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.
 - 
propagateModificationprotected 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.
 - 
isMatchContainedprotected abstract boolean isMatchContained(IOAVState state, Tuple left, java.lang.Object right, ReteMemory mem) Check if a match is contained.
 
- 
 
-