public class SplitNode extends AbstractNode implements IObjectConsumerNode, IObjectSourceNode
Modifier and Type | Field and Description |
---|---|
protected OAVAttributeType |
attr
The values extractor.
|
protected IValueExtractor |
extractor
The values extractor.
|
protected AttributeSet |
indirects
The set of indirect attributes.
|
protected int |
min_values
The minimum number of required values.
|
static java.lang.String |
MULTI
The constant for a multi variable.
|
static java.lang.String |
MULTI_DUMMY
The constant for a dummy multi variable.
|
protected IObjectConsumerNode[] |
oconsumers
The object consumers.
|
protected IObjectSourceNode |
osource
The object source.
|
protected AttributeSet |
relevants
The set of relevant attributes.
|
static java.lang.String |
SINGLE
The constant for a single variable.
|
protected java.lang.String[] |
splitpattern
The splitpattern (multi, single or multi dummy).
|
clones, nodeid
Constructor and Description |
---|
SplitNode(int nodeid,
IValueExtractor extractor,
OAVAttributeType attr,
java.lang.String[] splitpattern)
Create a new node.
|
Modifier and Type | Method and Description |
---|---|
void |
addObject(java.lang.Object object,
IOAVState state,
ReteMemory mem,
AbstractAgenda agenda)
Send a new object to this node.
|
void |
addObjectConsumer(IObjectConsumerNode node)
Add an object consumer node.
|
protected boolean |
contains(IOAVState state,
java.util.Collection coll,
java.lang.Object o)
Check if an object is contained in a collection.
|
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 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.
|
protected VirtualFact |
generateVirtualFact(java.lang.Object object,
int[] binding,
java.lang.Object[] values)
Generate a virtual fact for a found binding.
|
protected java.util.Collection |
generateVirtualFacts(java.lang.Object object,
IOAVState state)
Generate virtual facts.
|
OAVAttributeType |
getAttribute()
Get the attribute.
|
AttributeSet |
getIndirectAttributes()
Get the set of indirect attribute types.
|
java.util.Collection |
getNodeMemory(ReteMemory mem)
Get the memory for this node.
|
IObjectConsumerNode[] |
getObjectConsumers()
Get all object consumer nodes.
|
IObjectSourceNode |
getObjectSource()
Get the object source of this node.
|
AttributeSet |
getRelevantAttributes()
Get the set of relevant attribute types.
|
java.lang.String[] |
getSplitPattern()
Get the split pattern.
|
boolean |
isAffected(OAVAttributeType attr)
Test if the node is affected from a modification.
|
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 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 void |
propagateAdditionToObjectConsumers(java.lang.Object object,
IOAVState state,
ReteMemory mem,
AbstractAgenda agenda)
Propagate a new object to all object consumers.
|
protected 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.
|
protected void |
propagateRemovalToObjectConsumers(java.lang.Object object,
IOAVState state,
ReteMemory mem,
AbstractAgenda agenda)
Propagate a removed object to all object consumers.
|
void |
removeObject(java.lang.Object object,
IOAVState state,
ReteMemory mem,
AbstractAgenda agenda)
Send a removed object to this node.
|
void |
removeObjectConsumer(IObjectConsumerNode node)
Remove an object consumer.
|
void |
setObjectSource(IObjectSourceNode node)
Set the object source of this node.
|
java.lang.String |
toString()
Get the string representation.
|
checkNodeConsistency, clone, equals, getNodeId, hashCode, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
checkNodeConsistency, clone, getNodeId
public static final java.lang.String MULTI
public static final java.lang.String SINGLE
public static final java.lang.String MULTI_DUMMY
protected IObjectSourceNode osource
protected IObjectConsumerNode[] oconsumers
protected volatile AttributeSet relevants
protected volatile AttributeSet indirects
protected OAVAttributeType attr
protected IValueExtractor extractor
protected java.lang.String[] splitpattern
protected int min_values
public SplitNode(int nodeid, IValueExtractor extractor, OAVAttributeType attr, java.lang.String[] splitpattern)
state
- The state.public void addObject(java.lang.Object object, IOAVState state, ReteMemory mem, AbstractAgenda agenda)
addObject
in interface IObjectConsumerNode
object
- The object.public void removeObject(java.lang.Object object, IOAVState state, ReteMemory mem, AbstractAgenda agenda)
removeObject
in interface IObjectConsumerNode
object
- The object.public void modifyObject(java.lang.Object object, OAVAttributeType type, java.lang.Object oldvalue, java.lang.Object newvalue, IOAVState state, ReteMemory mem, AbstractAgenda agenda)
modifyObject
in interface IObjectConsumerNode
object
- 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
object
- 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 void addObjectConsumer(IObjectConsumerNode node)
addObjectConsumer
in interface IObjectSourceNode
node
- A new consumer node.public void removeObjectConsumer(IObjectConsumerNode node)
removeObjectConsumer
in interface IObjectSourceNode
node
- The consumer node.public java.util.Collection getNodeMemory(ReteMemory mem)
getNodeMemory
in interface INode
getNodeMemory
in interface IObjectSourceNode
public IObjectConsumerNode[] getObjectConsumers()
getObjectConsumers
in interface IObjectSourceNode
public java.lang.Object createNodeMemory(IOAVState state)
createNodeMemory
in interface INode
state
- The state.protected void propagateAdditionToObjectConsumers(java.lang.Object object, IOAVState state, ReteMemory mem, AbstractAgenda agenda)
object
- The new object.protected void propagateRemovalToObjectConsumers(java.lang.Object object, IOAVState state, ReteMemory mem, AbstractAgenda agenda)
object
- The new object.protected void propagateModificationToObjectConsumers(java.lang.Object object, OAVAttributeType type, java.lang.Object oldvalue, java.lang.Object newvalue, IOAVState state, ReteMemory mem, AbstractAgenda agenda)
object
- The new object.public boolean isAffected(OAVAttributeType attr)
type
- The attribute type.public AttributeSet getRelevantAttributes()
getRelevantAttributes
in interface INode
public AttributeSet getIndirectAttributes()
getIndirectAttributes
in interface INode
public OAVAttributeType getAttribute()
protected java.util.Collection generateVirtualFacts(java.lang.Object object, IOAVState state)
object
- The object.state
- The state.protected void generateBindings(int weight, int cur, int[] binding, java.lang.Object object, java.lang.Object[] values, java.util.List ret)
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).protected VirtualFact generateVirtualFact(java.lang.Object object, int[] binding, java.lang.Object[] values)
binding
- The number of values for each variable.values
- The multislot values.public java.lang.String[] getSplitPattern()
public java.lang.String toString()
toString
in class AbstractNode
protected void doClone(java.lang.Object theclone)
doClone
in class AbstractNode
theclone
- The clone.protected boolean contains(IOAVState state, java.util.Collection coll, java.lang.Object o)