Class SplitNode
- java.lang.Object
- 
- jadex.rules.rulesystem.rete.nodes.AbstractNode
- 
- jadex.rules.rulesystem.rete.nodes.SplitNode
 
 
- 
- All Implemented Interfaces:
- INode,- IObjectConsumerNode,- IObjectSourceNode,- java.lang.Cloneable
 
 public class SplitNode extends AbstractNode implements IObjectConsumerNode, IObjectSourceNode A split node has the purpose of generating virtual facts for multislot bindings that use a non-multi variable or variable patterns.
- 
- 
Field SummaryFields Modifier and Type Field Description protected OAVAttributeTypeattrThe values extractor.protected IValueExtractorextractorThe values extractor.protected AttributeSetindirectsThe set of indirect attributes.protected intmin_valuesThe minimum number of required values.static java.lang.StringMULTIThe constant for a multi variable.static java.lang.StringMULTI_DUMMYThe constant for a dummy multi variable.protected IObjectConsumerNode[]oconsumersThe object consumers.protected IObjectSourceNodeosourceThe object source.protected AttributeSetrelevantsThe set of relevant attributes.static java.lang.StringSINGLEThe constant for a single variable.protected java.lang.String[]splitpatternThe splitpattern (multi, single or multi dummy).- 
Fields inherited from class jadex.rules.rulesystem.rete.nodes.AbstractNodeclones, nodeid
 
- 
 - 
Constructor SummaryConstructors Constructor Description SplitNode(int nodeid, IValueExtractor extractor, OAVAttributeType attr, java.lang.String[] splitpattern)Create a new node.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddObject(java.lang.Object object, IOAVState state, ReteMemory mem, AbstractAgenda agenda)Send a new object to this node.voidaddObjectConsumer(IObjectConsumerNode node)Add an object consumer node.protected booleancontains(IOAVState state, java.util.Collection coll, java.lang.Object o)Check if an object is contained in a collection.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 voidgenerateBindings(int weight, int cur, int[] binding, java.lang.Object object, java.lang.Object[] values, java.util.List ret)Generate all possible bindings for a list of values.protected VirtualFactgenerateVirtualFact(java.lang.Object object, int[] binding, java.lang.Object[] values)Generate a virtual fact for a found binding.protected java.util.CollectiongenerateVirtualFacts(java.lang.Object object, IOAVState state)Generate virtual facts.OAVAttributeTypegetAttribute()Get the attribute.AttributeSetgetIndirectAttributes()Get the set of indirect attribute types.java.util.CollectiongetNodeMemory(ReteMemory mem)Get the memory for this node.IObjectConsumerNode[]getObjectConsumers()Get all object consumer nodes.IObjectSourceNodegetObjectSource()Get the object source of this node.AttributeSetgetRelevantAttributes()Get the set of relevant attribute types.java.lang.String[]getSplitPattern()Get the split pattern.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.voidmodifyObject(java.lang.Object object, OAVAttributeType type, java.lang.Object oldvalue, java.lang.Object newvalue, IOAVState state, ReteMemory mem, AbstractAgenda agenda)Propagate an object change to this node.protected voidpropagateAdditionToObjectConsumers(java.lang.Object object, IOAVState state, ReteMemory mem, AbstractAgenda agenda)Propagate a new object to all object consumers.protected voidpropagateModificationToObjectConsumers(java.lang.Object object, 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 voidpropagateRemovalToObjectConsumers(java.lang.Object object, IOAVState state, ReteMemory mem, AbstractAgenda agenda)Propagate a removed object to all object consumers.voidremoveObject(java.lang.Object object, IOAVState state, ReteMemory mem, AbstractAgenda agenda)Send a removed object to this node.voidremoveObjectConsumer(IObjectConsumerNode node)Remove an object consumer.voidsetObjectSource(IObjectSourceNode node)Set the object source of this node.java.lang.StringtoString()Get the string representation.- 
Methods inherited from class jadex.rules.rulesystem.rete.nodes.AbstractNodecheckNodeConsistency, clone, equals, getNodeId, hashCode, 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- 
MULTIpublic static final java.lang.String MULTI The constant for a multi variable.- See Also:
- Constant Field Values
 
 - 
SINGLEpublic static final java.lang.String SINGLE The constant for a single variable.- See Also:
- Constant Field Values
 
 - 
MULTI_DUMMYpublic static final java.lang.String MULTI_DUMMY The constant for a dummy multi variable.- See Also:
- Constant Field Values
 
 - 
osourceprotected IObjectSourceNode osource The object source.
 - 
oconsumersprotected IObjectConsumerNode[] oconsumers The object consumers.
 - 
relevantsprotected volatile AttributeSet relevants The set of relevant attributes.
 - 
indirectsprotected volatile AttributeSet indirects The set of indirect attributes.
 - 
attrprotected OAVAttributeType attr The values extractor.
 - 
extractorprotected IValueExtractor extractor The values extractor.
 - 
splitpatternprotected java.lang.String[] splitpattern The splitpattern (multi, single or multi dummy).
 - 
min_valuesprotected int min_values The minimum number of required values.
 
- 
 - 
Constructor Detail- 
SplitNodepublic SplitNode(int nodeid, IValueExtractor extractor, OAVAttributeType attr, java.lang.String[] splitpattern)Create a new node.- Parameters:
- state- The state.
 
 
- 
 - 
Method Detail- 
addObjectpublic void addObject(java.lang.Object object, IOAVState state, ReteMemory mem, AbstractAgenda agenda)Send a new object to this node.- Specified by:
- addObjectin interface- IObjectConsumerNode
- Parameters:
- object- The object.
 
 - 
removeObjectpublic void removeObject(java.lang.Object object, IOAVState state, ReteMemory mem, AbstractAgenda agenda)Send a removed object to this node.- Specified by:
- removeObjectin interface- IObjectConsumerNode
- Parameters:
- object- The object.
 
 - 
modifyObjectpublic void modifyObject(java.lang.Object object, 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:
- object- 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:
- object- 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.
 
 - 
addObjectConsumerpublic void addObjectConsumer(IObjectConsumerNode node) Add an object consumer node.- Specified by:
- addObjectConsumerin interface- IObjectSourceNode
- Parameters:
- node- A new consumer node.
 
 - 
removeObjectConsumerpublic void removeObjectConsumer(IObjectConsumerNode node) Remove an object consumer.- Specified by:
- removeObjectConsumerin interface- IObjectSourceNode
- 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- IObjectSourceNode
- Returns:
- The memory.
 
 - 
getObjectConsumerspublic IObjectConsumerNode[] getObjectConsumers() Get all object consumer nodes.- Specified by:
- getObjectConsumersin interface- IObjectSourceNode
- Returns:
- All object consumer nodes.
 
 - 
createNodeMemorypublic java.lang.Object createNodeMemory(IOAVState state) Create the node memory.- Specified by:
- createNodeMemoryin interface- INode
- Parameters:
- state- The state.
- Returns:
- The node memory.
 
 - 
propagateAdditionToObjectConsumersprotected void propagateAdditionToObjectConsumers(java.lang.Object object, IOAVState state, ReteMemory mem, AbstractAgenda agenda)Propagate a new object to all object consumers.- Parameters:
- object- The new object.
 
 - 
propagateRemovalToObjectConsumersprotected void propagateRemovalToObjectConsumers(java.lang.Object object, IOAVState state, ReteMemory mem, AbstractAgenda agenda)Propagate a removed object to all object consumers.- Parameters:
- object- The new object.
 
 - 
propagateModificationToObjectConsumersprotected void propagateModificationToObjectConsumers(java.lang.Object object, 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.
 
 - 
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
- Returns:
- The relevant attribute types.
 
 - 
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.
 
 - 
getAttributepublic OAVAttributeType getAttribute() Get the attribute.- Returns:
- The attribute.
 
 - 
generateVirtualFactsprotected java.util.Collection generateVirtualFacts(java.lang.Object object, IOAVState state)Generate virtual facts.- Parameters:
- object- The object.
- state- The state.
 
 - 
generateBindingsprotected void generateBindings(int weight, int cur, int[] binding, java.lang.Object object, java.lang.Object[] values, java.util.List ret)Generate all possible bindings for a list of values.- Parameters:
- weight- The number of values to distribute on variables.
- cur- The current variable number.
- binding- Results are stored in this binding array (contains for each variable how many values it should store).
- values- The values to distribute.
- ret- The result list containing all found bindings (in form of virtual facts).
 
 - 
generateVirtualFactprotected VirtualFact generateVirtualFact(java.lang.Object object, int[] binding, java.lang.Object[] values) Generate a virtual fact for a found binding.- Parameters:
- binding- The number of values for each variable.
- values- The multislot values.
- Returns:
- A virtual fact with one binding.
 
 - 
getSplitPatternpublic java.lang.String[] getSplitPattern() Get the split pattern.
 - 
toStringpublic java.lang.String toString() Get the string representation.- Overrides:
- toStringin class- AbstractNode
- Returns:
- The string representation.
 
 - 
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.
 
 - 
containsprotected boolean contains(IOAVState state, java.util.Collection coll, java.lang.Object o) Check if an object is contained in a collection. Avoid the need for an "IdentityArrayList".
 
- 
 
-