Class CollectNode
- java.lang.Object
- 
- jadex.rules.rulesystem.rete.nodes.AbstractNode
- 
- jadex.rules.rulesystem.rete.nodes.CollectNode
 
 
- 
- All Implemented Interfaces:
- INode,- ITupleConsumerNode,- ITupleSourceNode,- java.lang.Cloneable
 
 public class CollectNode extends AbstractNode implements ITupleConsumerNode, ITupleSourceNode The purpose of a collect node is to compress a number of tuples to a new tuple, which contains a multi slot. Example: Incoming tuples are: [a, b, d1] [a, b, d2] [a, c, d3] [a, c, d1] -> [a, b, {d1, d2}] [a, c, {d3, d1}]
- 
- 
Field SummaryFields Modifier and Type Field Description protected IConstraintEvaluator[]evaluatorsThe constraint evaluator.protected AttributeSetindirectsThe set of indirect attributes.protected AttributeSetrelevantsThe set of relevant attributes.protected ITupleConsumerNode[]tconsumersThe tuple consumers.protected ITupleSourceNodetsourceThe tuple source.protected inttupleindexThe tuple index to collect.- 
Fields inherited from class jadex.rules.rulesystem.rete.nodes.AbstractNodeclones, nodeid
 
- 
 - 
Constructor SummaryConstructors Constructor Description CollectNode(int nodeid, int tupleindex, IConstraintEvaluator[] evaluators)Create a new beta node.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTuple(Tuple left, IOAVState state, ReteMemory mem, AbstractAgenda agenda)Send a tuple to this node.voidaddTupleConsumer(ITupleConsumerNode node)Add an tuple consumer node.protected booleancheckConstraints(Tuple left, IOAVState state)Check the constraints with respect to the object.protected TuplecreateIndexTuple(IOAVState state, Tuple tuple, ReteMemory mem)Create an index tuple from a tuple.java.lang.ObjectcreateNodeMemory(IOAVState state)Create the node memory.protected voiddoClone(java.lang.Object theclone)Do clone makes a deep clone without regarding cycles.IConstraintEvaluator[]getConstraintEvaluators()Get the evaluators.AttributeSetgetIndirectAttributes()Get the set of indirect attribute types.java.util.CollectiongetNodeMemory(ReteMemory mem)Get the memory for this node.AttributeSetgetRelevantAttributes()Get the set of relevant attribute types.ITupleConsumerNode[]getTupleConsumers()Get all tuple consumer nodes.intgetTupleIndex()Get the tuple index.ITupleSourceNodegetTupleSource()Get the tuple source of this node.booleanisAffected(OAVAttributeType attr)Test if the node is affected from a modification.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.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 voidpropagateAdditionToTupleConsumers(Tuple tuple, IOAVState state, ReteMemory mem, AbstractAgenda agenda)Propagate a new tuple to all tuple consumers.protected voidpropagateModificationToTupleConsumers(Tuple tuple, OAVAttributeType type, java.lang.Object oldvalue, java.lang.Object newvalue, IOAVState state, ReteMemory mem, AbstractAgenda agenda)Propagate a modified object to all object consumers.protected voidpropagateRemovalToTupleConsumers(Tuple tuple, IOAVState state, ReteMemory mem, AbstractAgenda agenda)Propagate a removed tuple to all tuple consumers.voidremoveTuple(Tuple left, IOAVState state, ReteMemory mem, AbstractAgenda agenda)Remove a tuple from this node.voidremoveTupleConsumer(ITupleConsumerNode node)Remove an tuple consumer.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.
 - 
tsourceprotected ITupleSourceNode tsource The tuple source.
 - 
evaluatorsprotected IConstraintEvaluator[] evaluators The constraint evaluator.
 - 
relevantsprotected volatile AttributeSet relevants The set of relevant attributes.
 - 
indirectsprotected volatile AttributeSet indirects The set of indirect attributes.
 - 
tupleindexprotected int tupleindex The tuple index to collect.
 
- 
 - 
Constructor Detail- 
CollectNodepublic CollectNode(int nodeid, int tupleindex, IConstraintEvaluator[] evaluators)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.
 
 - 
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:
- object- The changed object.
 
 - 
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.
 
 - 
createNodeMemorypublic java.lang.Object createNodeMemory(IOAVState state) Create the node memory.- Specified by:
- createNodeMemoryin interface- INode
- Parameters:
- state- The state.
- Returns:
- The node memory.
 
 - 
getConstraintEvaluatorspublic IConstraintEvaluator[] getConstraintEvaluators() Get the evaluators.- Returns:
- The evaluators.
 
 - 
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.
 
 - 
getTupleIndexpublic int getTupleIndex() Get the tuple index.- Returns:
- The tuple index.
 
 - 
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.
 
 - 
checkConstraintsprotected boolean checkConstraints(Tuple left, IOAVState state) Check the constraints with respect to the object.- Returns:
- True, if object fits constraints.
 
 - 
createIndexTupleprotected Tuple createIndexTuple(IOAVState state, Tuple tuple, ReteMemory mem) Create an index tuple from a tuple. The index tuple excludes the index position at which the compression happens (and all elements thereafter -> why, could be the last node?).- Parameters:
- tuple- The tuple.
- Returns:
- The index tuple.
 
 - 
propagateAdditionToTupleConsumersprotected void propagateAdditionToTupleConsumers(Tuple tuple, IOAVState state, ReteMemory mem, AbstractAgenda agenda) Propagate a new tuple to all tuple consumers.- Parameters:
- object- The new object.
 
 - 
propagateRemovalToTupleConsumersprotected void propagateRemovalToTupleConsumers(Tuple tuple, IOAVState state, ReteMemory mem, AbstractAgenda agenda) Propagate a removed tuple to all tuple consumers.- Parameters:
- object- The new object.
 
 - 
propagateModificationToTupleConsumersprotected void propagateModificationToTupleConsumers(Tuple tuple, OAVAttributeType type, java.lang.Object oldvalue, java.lang.Object newvalue, IOAVState state, ReteMemory mem, AbstractAgenda agenda) Propagate a modified object to all object consumers.- Parameters:
- object- The new object.
 
 
- 
 
-