public class ObjectTypeNode extends ObjectSource implements ObjectSink, Externalizable, MemoryFactory<ObjectTypeNode.ObjectTypeNodeMemory>
ObjectTypeNodes are responsible for filtering and propagating the matching
fact assertions propagated from the Rete
node using ObjectType
interface.
The assert and retract methods do not attempt to filter as this is the role of the Rete
node which builds up a cache of matching ObjectTypdeNodes
s for each asserted object, using
the matches(Object object)
method. Incorrect propagation in these methods is not checked and
will result in ClassCastExpcections
later on in the network.
Filters Objects
coming from the Rete
using a
ObjectType
semantic module.
Rete
,
Serialized FormModifier and Type | Class and Description |
---|---|
static class |
ObjectTypeNode.ExpireJob |
static class |
ObjectTypeNode.ExpireJobContext |
static class |
ObjectTypeNode.ExpireJobContextTimerInputMarshaller |
static class |
ObjectTypeNode.ExpireJobContextTimerOutputMarshaller |
static class |
ObjectTypeNode.Id |
static class |
ObjectTypeNode.InitialFactObjectTypeNodeMemory |
static class |
ObjectTypeNode.ObjectTypeNodeMemory |
Modifier and Type | Field and Description |
---|---|
protected CompiledNetwork |
compiledNetwork |
static ObjectTypeNode.Id |
DEFAULT_ID |
protected boolean |
dirty |
protected org.drools.core.reteoo.ObjectTypeNode.IdGenerator |
idGenerator |
protected ObjectType |
objectType
The
ObjectType semantic module. |
declaredMask, inferredMask, sink, source
associations, id, partitionId, partitionsEnabled
Constructor and Description |
---|
ObjectTypeNode() |
ObjectTypeNode(int id,
EntryPointNode source,
ObjectType objectType,
BuildContext context)
Construct given a semantic
ObjectType and the provided
unique id. |
Modifier and Type | Method and Description |
---|---|
void |
assertInitialFact(InternalFactHandle factHandle,
PropagationContext context,
InternalWorkingMemory workingMemory) |
void |
assertObject(InternalFactHandle factHandle,
PropagationContext context,
InternalWorkingMemory workingMemory)
Propagate the
FactHandleimpl through the Rete network. |
void |
attach(BuildContext context)
Rete needs to know that this ObjectTypeNode has been added
|
void |
byPassModifyToBetaNode(InternalFactHandle factHandle,
ModifyPreviousTuples modifyPreviousTuples,
PropagationContext context,
InternalWorkingMemory workingMemory) |
BitMask |
calculateDeclaredMask(List<String> settableProperties) |
ObjectTypeNode.ObjectTypeNodeMemory |
createMemory(RuleBaseConfiguration config,
InternalWorkingMemory wm)
Creates memory for the node using PrimitiveLongMap as its optimised for storage and reteivals of Longs.
|
protected boolean |
doRemove(RuleRemovalContext context,
ReteooBuilder builder,
InternalWorkingMemory[] workingMemories)
OTN needs to override remove to avoid releasing the node ID, since OTN are
never removed from the rulebase in the current implementation
|
static void |
doRetractObject(InternalFactHandle factHandle,
PropagationContext context,
InternalWorkingMemory workingMemory) |
boolean |
equals(Object object) |
EntryPointId |
getEntryPoint() |
long |
getExpirationOffset() |
ObjectType |
getObjectType()
Retrieve the semantic
ObjectType differentiator. |
int |
getOtnIdCounter() |
short |
getType() |
int |
hashCode()
Uses he hashCode() of the underlying ObjectType implementation.
|
boolean |
isAssignableFrom(ObjectType objectType) |
boolean |
isObjectMemoryEnabled() |
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 oportunity
for state update
|
ObjectTypeNode.Id |
nextOtnId() |
void |
propagateAssert(InternalFactHandle factHandle,
PropagationContext context,
InternalWorkingMemory workingMemory) |
void |
readExternal(ObjectInput in) |
boolean |
remove(RuleRemovalContext context,
ReteooBuilder builder,
InternalWorkingMemory[] workingMemories)
OTN needs to override remove to avoid releasing the node ID, since OTN are
never removed from the rulebase in the current implementation
|
protected void |
resetIdGenerator() |
void |
retractObject(InternalFactHandle factHandle,
PropagationContext context,
InternalWorkingMemory workingMemory)
Retract the
FactHandleimpl from the Rete network. |
void |
setCompiledNetwork(CompiledNetwork compiledNetwork) |
void |
setExpirationOffset(long expirationOffset) |
void |
setObjectMemoryEnabled(boolean objectMemoryEnabled) |
String |
toString() |
void |
updateSink(ObjectSink sink,
PropagationContext context,
InternalWorkingMemory workingMemory) |
protected static void |
updateTupleSinkId(ObjectTypeNode otn,
ObjectSource source) |
void |
writeExternal(ObjectOutput out) |
addObjectSink, getDeclaredMask, getKnowledgeBase, getObjectTypeNode, getParentObjectSource, getSinkPropagator, initDeclaredMask, isInUse, removeObjectSink, resetInferredMask, updateMask
addAssociation, addAssociation, getAssociationsSize, getAssociationsSize, getId, getPartitionId, isAssociatedWith, isStreamMode, removeAssociation, setId, setPartitionId, setStreamMode
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getAssociationsSize, getAssociationsSize, getId, getPartitionId, isAssociatedWith
getId
protected ObjectType objectType
ObjectType
semantic module.protected CompiledNetwork compiledNetwork
protected transient boolean dirty
protected transient org.drools.core.reteoo.ObjectTypeNode.IdGenerator idGenerator
public static final ObjectTypeNode.Id DEFAULT_ID
public ObjectTypeNode()
public ObjectTypeNode(int id, EntryPointNode source, ObjectType objectType, BuildContext context)
ObjectType
and the provided
unique id. All ObjectTypdeNode
have node memory.id
- The unique id for the node.objectType
- The semantic object-type differentiator.public int getOtnIdCounter()
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
readExternal
in class ObjectSource
IOException
ClassNotFoundException
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
writeExternal
in class ObjectSource
IOException
public short getType()
getType
in interface NetworkNode
public ObjectType getObjectType()
ObjectType
differentiator.ObjectType
differentiator.public BitMask calculateDeclaredMask(List<String> settableProperties)
calculateDeclaredMask
in class ObjectSource
public boolean isAssignableFrom(ObjectType objectType)
public void setCompiledNetwork(CompiledNetwork compiledNetwork)
public void assertInitialFact(InternalFactHandle factHandle, PropagationContext context, InternalWorkingMemory workingMemory)
public void assertObject(InternalFactHandle factHandle, PropagationContext context, InternalWorkingMemory workingMemory)
FactHandleimpl
through the Rete
network. All
FactHandleImpl
should be remembered in the node memory, so that later runtime rule attachmnents
can have the matched facts propagated to them.assertObject
in interface ObjectSink
factHandle
- The fact handle.context
- The propagation context.workingMemory
- The working memory session.public void propagateAssert(InternalFactHandle factHandle, PropagationContext context, InternalWorkingMemory workingMemory)
public void retractObject(InternalFactHandle factHandle, PropagationContext context, InternalWorkingMemory workingMemory)
FactHandleimpl
from the Rete
network. Also remove the
FactHandleImpl
from the node memory.factHandle
- The fact handle.context
- The propagation context.workingMemory
- The working memory session.public static void doRetractObject(InternalFactHandle factHandle, PropagationContext context, InternalWorkingMemory workingMemory)
protected void resetIdGenerator()
public void modifyObject(InternalFactHandle factHandle, ModifyPreviousTuples modifyPreviousTuples, PropagationContext context, InternalWorkingMemory workingMemory)
modifyObject
in interface ObjectSink
public void updateSink(ObjectSink sink, PropagationContext context, InternalWorkingMemory workingMemory)
updateSink
in class ObjectSource
public void attach(BuildContext context)
public void networkUpdated(UpdateContext updateContext)
BaseNode
networkUpdated
in class ObjectSource
protected static void updateTupleSinkId(ObjectTypeNode otn, ObjectSource source)
public ObjectTypeNode.Id nextOtnId()
public boolean remove(RuleRemovalContext context, ReteooBuilder builder, InternalWorkingMemory[] workingMemories)
protected boolean doRemove(RuleRemovalContext context, ReteooBuilder builder, InternalWorkingMemory[] workingMemories)
doRemove
in class ObjectSource
public ObjectTypeNode.ObjectTypeNodeMemory createMemory(RuleBaseConfiguration config, InternalWorkingMemory wm)
createMemory
in interface MemoryFactory<ObjectTypeNode.ObjectTypeNodeMemory>
public boolean isObjectMemoryEnabled()
public void setObjectMemoryEnabled(boolean objectMemoryEnabled)
public int hashCode()
public EntryPointId getEntryPoint()
public long getExpirationOffset()
public void setExpirationOffset(long expirationOffset)
public void byPassModifyToBetaNode(InternalFactHandle factHandle, ModifyPreviousTuples modifyPreviousTuples, PropagationContext context, InternalWorkingMemory workingMemory)
byPassModifyToBetaNode
in interface ObjectSink
Copyright © 2001–2016 JBoss by Red Hat. All rights reserved.