Class TerminalNode
- java.lang.Object
-
- jadex.rules.rulesystem.rete.nodes.AbstractNode
-
- jadex.rules.rulesystem.rete.nodes.TerminalNode
-
- All Implemented Interfaces:
INode
,ITupleConsumerNode
,java.lang.Cloneable
public class TerminalNode extends AbstractNode implements ITupleConsumerNode
A terminal node stores the full matches and notifies the agenda of the activated conditions.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TerminalNode.ReteVariableAssignments
The rete variable assignment help extracting values for varaibles.
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map
extractors
A mapping for fetching variable values (variable -> extractor).protected AttributeSet
indirects
The set of indirect attributes.protected AttributeSet
relevants
The set of relevant attributes.protected IRule
rule
The rule of the terminal node.protected ITupleSourceNode
tsource
The tuple source.-
Fields inherited from class jadex.rules.rulesystem.rete.nodes.AbstractNode
clones, nodeid
-
-
Constructor Summary
Constructors Constructor Description TerminalNode(int nodeid, IRule rule, java.util.Map extractors)
Create a new node.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTuple(Tuple tuple, IOAVState state, ReteMemory mem, AbstractAgenda agenda)
Send an tuple to this node.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.AttributeSet
getIndirectAttributes()
Get the set of indirect attribute types.java.util.Collection
getNodeMemory(ReteMemory mem)
Get the memory for this node.AttributeSet
getRelevantAttributes()
Get the set of relevant attribute types.IRule
getRule()
Get the rule.ITupleSourceNode
getTupleSource()
Get the tuple source of this node.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
modifyTuple(Tuple tuple, int tupleindex, OAVAttributeType type, java.lang.Object oldvalue, java.lang.Object newvalue, IOAVState state, ReteMemory mem, AbstractAgenda agenda)
Modify a tuple in this node.void
removeTuple(Tuple tuple, IOAVState state, ReteMemory mem, AbstractAgenda agenda)
Remove a tuple from this node.void
setTupleSource(ITupleSourceNode node)
Set the tuple source of this node.-
Methods inherited from class jadex.rules.rulesystem.rete.nodes.AbstractNode
checkNodeConsistency, clone, equals, getNodeId, hashCode, toString, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jadex.rules.rulesystem.rete.nodes.INode
checkNodeConsistency, clone, getNodeId
-
-
-
-
Field Detail
-
tsource
protected ITupleSourceNode tsource
The tuple source.
-
extractors
protected java.util.Map extractors
A mapping for fetching variable values (variable -> extractor).
-
rule
protected IRule rule
The rule of the terminal node.
-
relevants
protected volatile AttributeSet relevants
The set of relevant attributes.
-
indirects
protected volatile AttributeSet indirects
The set of indirect attributes.
-
-
Constructor Detail
-
TerminalNode
public TerminalNode(int nodeid, IRule rule, java.util.Map extractors)
Create a new node.
-
-
Method Detail
-
addTuple
public void addTuple(Tuple tuple, IOAVState state, ReteMemory mem, AbstractAgenda agenda)
Send an tuple to this node.- Specified by:
addTuple
in interfaceITupleConsumerNode
- Parameters:
tuple
- The tuple.
-
removeTuple
public void removeTuple(Tuple tuple, IOAVState state, ReteMemory mem, AbstractAgenda agenda)
Remove a tuple from this node.- Specified by:
removeTuple
in interfaceITupleConsumerNode
- Parameters:
tuple
- The tuple.
-
modifyTuple
public void modifyTuple(Tuple tuple, 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:
modifyTuple
in interfaceITupleConsumerNode
- Parameters:
tuple
- The tuple.
-
modifyIndirectObject
public 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:
modifyIndirectObject
in interfaceINode
- Parameters:
object
- The changed object.
-
setTupleSource
public void setTupleSource(ITupleSourceNode node)
Set the tuple source of this node.- Specified by:
setTupleSource
in interfaceITupleConsumerNode
- Parameters:
node
- The tuple source node.
-
getTupleSource
public ITupleSourceNode getTupleSource()
Get the tuple source of this node.- Specified by:
getTupleSource
in interfaceITupleConsumerNode
- Returns:
- The object source node.
-
createNodeMemory
public java.lang.Object createNodeMemory(IOAVState state)
Create the node memory.- Specified by:
createNodeMemory
in interfaceINode
- Parameters:
state
- The state.- Returns:
- The node memory.
-
getNodeMemory
public java.util.Collection getNodeMemory(ReteMemory mem)
Get the memory for this node.- Specified by:
getNodeMemory
in interfaceINode
- Returns:
- The memory.
-
getRelevantAttributes
public AttributeSet getRelevantAttributes()
Get the set of relevant attribute types.- Specified by:
getRelevantAttributes
in interfaceINode
-
getIndirectAttributes
public 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:
getIndirectAttributes
in interfaceINode
- Returns:
- The relevant attribute types.
-
getRule
public IRule getRule()
Get the rule.- Returns:
- The rule.
-
doClone
protected 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:
doClone
in classAbstractNode
- Parameters:
theclone
- The clone.
-
-