public class Rete extends ObjectSource implements Externalizable, ObjectSink
Object
. All objects are asserted into
the Rete node where it propagates to all matching ObjectTypeNodes.
The first time an instance of a Class type is asserted it does a full
iteration of all ObjectTyppeNodes looking for matches, any matches are
then cached in a HashMap which is used for future assertions.
While Rete extends ObjectSource nad implements ObjectSink it nulls the
methods attach(), remove() and updateNewNode() as this is the root node
they are no applicableObjectTypeNode
,
Serialized FormalphaNodeHashingThreshold, declaredMask, inferredMask, sink, source
associations, hashcode, id, memoryId, partitionId, partitionsEnabled
Constructor and Description |
---|
Rete() |
Rete(InternalKnowledgeBase kBase) |
Modifier and Type | Method and Description |
---|---|
void |
addObjectSink(ObjectSink objectSink)
Adds the
ObjectSink so that it may receive
Objects propagated from this ObjectSource . |
void |
assertObject(InternalFactHandle factHandle,
PropagationContext context,
InternalWorkingMemory workingMemory)
This is the entry point into the network for all asserted Facts.
|
void |
attach(BuildContext context)
Attaches the node into the network.
|
void |
byPassModifyToBetaNode(InternalFactHandle factHandle,
ModifyPreviousTuples modifyPreviousTuples,
PropagationContext context,
InternalWorkingMemory workingMemory) |
BitMask |
calculateDeclaredMask(Class modifiedClass,
List<String> settableProperties) |
protected boolean |
doRemove(RuleRemovalContext context,
ReteooBuilder builder)
Removes the node from the network.
|
boolean |
equals(Object object) |
EntryPointNode |
getEntryPointNode(EntryPointId entryPoint) |
Map<EntryPointId,EntryPointNode> |
getEntryPointNodes() |
InternalKnowledgeBase |
getKnowledgeBase() |
List<ObjectTypeNode> |
getObjectTypeNodes() |
Map<ObjectType,ObjectTypeNode> |
getObjectTypeNodes(EntryPointId entryPoint) |
short |
getType() |
void |
modifyObject(InternalFactHandle factHandle,
ModifyPreviousTuples modifyPreviousTuples,
PropagationContext context,
InternalWorkingMemory workingMemory) |
void |
networkUpdated(UpdateContext updateContext)
A method that is called for all nodes whose network below them
changed, after the change is complete, providing them with an opportunity
for state update
|
void |
readExternal(ObjectInput in) |
void |
removeObjectSink(ObjectSink objectSink)
Removes the
ObjectSink |
void |
retractObject(InternalFactHandle handle,
PropagationContext context,
InternalWorkingMemory workingMemory)
Retract a fact object from this
RuleBase and the specified
WorkingMemory . |
void |
updateSink(ObjectSink sink,
PropagationContext context,
InternalWorkingMemory workingMemory) |
void |
writeExternal(ObjectOutput out) |
getDeclaredMask, getObjectSinkPropagator, getObjectTypeNode, getParentObjectSource, initDeclaredMask, isInUse, resetInferredMask, setObjectSinkPropagator, setParentObjectSource, setPartitionId, setPartitionIdWithSinks, setSourcePartitionId, updateMask
addAssociation, addAssociation, getAssociatedRules, getAssociatedRuleSize, getAssociationsSize, getAssociationsSize, getId, getMemoryId, getPartitionId, getSinks, hashCode, initMemoryId, isAssociatedWith, isStreamMode, remove, removeAssociation, setId, setPartitionsEnabled, setStreamMode, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getAssociatedRuleSize, getAssociationsSize, getAssociationsSize, getId, getPartitionId, isAssociatedWith
public Rete()
public Rete(InternalKnowledgeBase kBase)
public short getType()
getType
in interface NetworkNode
public void assertObject(InternalFactHandle factHandle, PropagationContext context, InternalWorkingMemory workingMemory)
ObjectTypdeNode
s asserting the Fact. If the cache does not
exist it first iteraes and builds the cache.assertObject
in interface ObjectSink
factHandle
- The FactHandle of the fact to assertcontext
- The PropagationContext
of the WorkingMemory
actionworkingMemory
- The working memory session.public void retractObject(InternalFactHandle handle, PropagationContext context, InternalWorkingMemory workingMemory)
RuleBase
and the specified
WorkingMemory
.handle
- The handle of the fact to retract.workingMemory
- The working memory session.public void modifyObject(InternalFactHandle factHandle, ModifyPreviousTuples modifyPreviousTuples, PropagationContext context, InternalWorkingMemory workingMemory)
modifyObject
in interface ObjectSink
public void addObjectSink(ObjectSink objectSink)
ObjectSink
so that it may receive
Objects
propagated from this ObjectSource
.addObjectSink
in class ObjectSource
objectSink
- The ObjectSink
to receive propagated
Objects
. Rete only accepts ObjectTypeNode
s
as parameters to this method, though.public void removeObjectSink(ObjectSink objectSink)
ObjectSource
ObjectSink
removeObjectSink
in class ObjectSource
objectSink
- The ObjectSink
to removepublic void attach(BuildContext context)
BaseNode
ObjectSource
or TupleSource
public void networkUpdated(UpdateContext updateContext)
BaseNode
networkUpdated
in class ObjectSource
protected boolean doRemove(RuleRemovalContext context, ReteooBuilder builder)
BaseNode
ObjectSource
or TupleSource
doRemove
in class ObjectSource
public EntryPointNode getEntryPointNode(EntryPointId entryPoint)
public List<ObjectTypeNode> getObjectTypeNodes()
public Map<ObjectType,ObjectTypeNode> getObjectTypeNodes(EntryPointId entryPoint)
public InternalKnowledgeBase getKnowledgeBase()
getKnowledgeBase
in class ObjectSource
public void updateSink(ObjectSink sink, PropagationContext context, InternalWorkingMemory workingMemory)
updateSink
in class ObjectSource
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
writeExternal
in class ObjectSource
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
readExternal
in class ObjectSource
IOException
ClassNotFoundException
public Map<EntryPointId,EntryPointNode> getEntryPointNodes()
public void byPassModifyToBetaNode(InternalFactHandle factHandle, ModifyPreviousTuples modifyPreviousTuples, PropagationContext context, InternalWorkingMemory workingMemory)
byPassModifyToBetaNode
in interface ObjectSink
public BitMask calculateDeclaredMask(Class modifiedClass, List<String> settableProperties)
calculateDeclaredMask
in class ObjectSource
Copyright © 2001–2019 JBoss by Red Hat. All rights reserved.