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 ObjectTypdeNodess 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.
- See Also:
Rete,
Serialized Form
|
Method Summary |
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)
|
long |
calculateDeclaredMask(List<String> settableProperties)
|
Memory |
createMemory(RuleBaseConfiguration config)
Creates memory for the node using PrimitiveLongMap as its optimised for storage and reteivals of Longs. |
protected void |
doCollectAncestors(NodeSet nodeSet)
|
protected void |
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 |
boolean |
equals(Object object)
|
EntryPoint |
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)
|
boolean |
needsMaskUpdate()
|
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 |
readExternal(ObjectInput in)
|
void |
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)
|
void |
updateSinkOnAttach(BuildContext context,
PropagationContext propagationContext,
InternalWorkingMemory workingMemory)
|
protected static void |
updateTupleSinkId(ObjectTypeNode otn,
ObjectSource source)
|
void |
writeExternal(ObjectOutput out)
|
objectType
protected ObjectType objectType
- The
ObjectType semantic module.
job
public static final transient ObjectTypeNode.ExpireJob job
compiledNetwork
protected CompiledNetwork compiledNetwork
dirty
protected transient boolean dirty
idGenerator
protected transient org.drools.reteoo.ObjectTypeNode.IdGenerator idGenerator
DEFAULT_ID
public static ObjectTypeNode.Id DEFAULT_ID
ObjectTypeNode
public ObjectTypeNode()
ObjectTypeNode
public ObjectTypeNode(int id,
EntryPointNode source,
ObjectType objectType,
BuildContext context)
- Construct given a semantic
ObjectType and the provided
unique id. All ObjectTypdeNode have node memory.
- Parameters:
id - The unique id for the node.objectType - The semantic object-type differentiator.
getOtnIdCounter
public int getOtnIdCounter()
readExternal
public void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
- Specified by:
readExternal in interface Externalizable- Overrides:
readExternal in class ObjectSource
- Throws:
IOException
ClassNotFoundException
writeExternal
public void writeExternal(ObjectOutput out)
throws IOException
- Specified by:
writeExternal in interface Externalizable- Overrides:
writeExternal in class ObjectSource
- Throws:
IOException
getObjectType
public ObjectType getObjectType()
- Retrieve the semantic
ObjectType differentiator.
- Returns:
- The semantic
ObjectType differentiator.
getType
public short getType()
- Specified by:
getType in interface NetworkNode
calculateDeclaredMask
public long calculateDeclaredMask(List<String> settableProperties)
- Specified by:
calculateDeclaredMask in class ObjectSource
needsMaskUpdate
public boolean needsMaskUpdate()
- Overrides:
needsMaskUpdate in class ObjectSource
isAssignableFrom
public boolean isAssignableFrom(ObjectType objectType)
setCompiledNetwork
public void setCompiledNetwork(CompiledNetwork compiledNetwork)
assertObject
public void assertObject(InternalFactHandle factHandle,
PropagationContext context,
InternalWorkingMemory workingMemory)
- Propagate the
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.
- Specified by:
assertObject in interface ObjectSink
- Parameters:
factHandle - The fact handle.context - The propagation context.workingMemory - The working memory session.
retractObject
public void retractObject(InternalFactHandle factHandle,
PropagationContext context,
InternalWorkingMemory workingMemory)
- Retract the
FactHandleimpl from the Rete network. Also remove the
FactHandleImpl from the node memory.
- Parameters:
factHandle - The fact handle.context - The propagation context.workingMemory - The working memory session.
modifyObject
public void modifyObject(InternalFactHandle factHandle,
ModifyPreviousTuples modifyPreviousTuples,
PropagationContext context,
InternalWorkingMemory workingMemory)
- Specified by:
modifyObject in interface ObjectSink
resetIdGenerator
protected void resetIdGenerator()
updateSink
public void updateSink(ObjectSink sink,
PropagationContext context,
InternalWorkingMemory workingMemory)
- Specified by:
updateSink in class ObjectSource
attach
public void attach(BuildContext context)
- Rete needs to know that this ObjectTypeNode has been added
- Specified by:
attach in class BaseNode
updateSinkOnAttach
public void updateSinkOnAttach(BuildContext context,
PropagationContext propagationContext,
InternalWorkingMemory workingMemory)
- Specified by:
updateSinkOnAttach in class BaseNode
networkUpdated
public void networkUpdated(UpdateContext updateContext)
- Description copied from class:
BaseNode
- 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
- Overrides:
networkUpdated in class ObjectSource
updateTupleSinkId
protected static void updateTupleSinkId(ObjectTypeNode otn,
ObjectSource source)
nextOtnId
public ObjectTypeNode.Id nextOtnId()
remove
public void 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
- Overrides:
remove in class BaseNode
- See Also:
BaseNode.remove(RuleRemovalContext, ReteooBuilder, org.drools.common.InternalWorkingMemory[])
doRemove
protected void 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
- Overrides:
doRemove in class ObjectSource
doCollectAncestors
protected void doCollectAncestors(NodeSet nodeSet)
- Overrides:
doCollectAncestors in class ObjectSource
createMemory
public Memory createMemory(RuleBaseConfiguration config)
- Creates memory for the node using PrimitiveLongMap as its optimised for storage and reteivals of Longs.
However PrimitiveLongMap is not ideal for spase data. So it should be monitored incase its more optimal
to switch back to a standard HashMap.
- Specified by:
createMemory in interface NodeMemory
isObjectMemoryEnabled
public boolean isObjectMemoryEnabled()
setObjectMemoryEnabled
public void setObjectMemoryEnabled(boolean objectMemoryEnabled)
toString
public String toString()
- Overrides:
toString in class BaseNode
hashCode
public int hashCode()
- Uses he hashCode() of the underlying ObjectType implementation.
- Overrides:
hashCode in class BaseNode
equals
public boolean equals(Object object)
- Overrides:
equals in class Object
getEntryPoint
public EntryPoint getEntryPoint()
- Returns:
- the entryPoint
getExpirationOffset
public long getExpirationOffset()
setExpirationOffset
public void setExpirationOffset(long expirationOffset)
byPassModifyToBetaNode
public void byPassModifyToBetaNode(InternalFactHandle factHandle,
ModifyPreviousTuples modifyPreviousTuples,
PropagationContext context,
InternalWorkingMemory workingMemory)
- Specified by:
byPassModifyToBetaNode in interface ObjectSink
Copyright © 2001-2014 JBoss by Red Hat. All Rights Reserved.