Package org.drools.core.reteoo
Class AlphaNode
- java.lang.Object
-
- org.drools.core.common.BaseNode
-
- org.drools.core.reteoo.ObjectSource
-
- org.drools.core.reteoo.AlphaNode
-
- All Implemented Interfaces:
Externalizable
,Serializable
,NetworkNode
,ObjectSink
,ObjectSinkNode
,Sink
public class AlphaNode extends ObjectSource implements ObjectSinkNode
AlphaNodes
are nodes in theRete
network used to applyFieldConstraint<.code>s on asserted fact objects where the
FieldConstraint
s have no dependencies on any other of the facts in the currentRule
.- See Also:
AlphaNodeFieldConstraint
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected AlphaNodeFieldConstraint
constraint
TheFieldConstraint
-
Fields inherited from class org.drools.core.reteoo.ObjectSource
alphaNodeHashingThreshold, alphaNodeRangeIndexThreshold, declaredMask, inferredMask, sink, source
-
Fields inherited from class org.drools.core.common.BaseNode
associations, hashcode, id, memoryId, partitionId, partitionsEnabled
-
-
Constructor Summary
Constructors Constructor Description AlphaNode()
AlphaNode(int id, AlphaNodeFieldConstraint constraint, ObjectSource objectSource, BuildContext context)
Construct anAlphaNode
with a unique id using the providedFieldConstraint
and the givenObjectSource
.
-
Method Summary
-
Methods inherited from class org.drools.core.reteoo.ObjectSource
addObjectSink, doRemove, getKnowledgeBase, getObjectSinkPropagator, getObjectTypeNode, getParentObjectSource, initDeclaredMask, isInUse, networkUpdated, removeObjectSink, resetInferredMask, setObjectSinkPropagator, setParentObjectSource, setPartitionIdWithSinks, setSourcePartitionId, updateMask
-
Methods inherited from class org.drools.core.common.BaseNode
addAssociation, addAssociation, attach, getAssociatedRules, getAssociatedRuleSize, getAssociationsSize, getAssociationsSize, getId, getMemoryId, getPartitionId, getSinks, hashCode, initMemoryId, isAssociatedWith, isStreamMode, remove, removeAssociation, setId, setPartitionsEnabled, setStreamMode
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.drools.core.common.NetworkNode
getAssociatedRules, getAssociatedRuleSize, getAssociationsSize, getAssociationsSize, getId, getPartitionId, isAssociatedWith
-
Methods inherited from interface org.drools.core.reteoo.ObjectSinkNode
setPartitionIdWithSinks
-
-
-
-
Field Detail
-
constraint
protected AlphaNodeFieldConstraint constraint
TheFieldConstraint
-
-
Constructor Detail
-
AlphaNode
public AlphaNode()
-
AlphaNode
public AlphaNode(int id, AlphaNodeFieldConstraint constraint, ObjectSource objectSource, BuildContext context)
Construct anAlphaNode
with a unique id using the providedFieldConstraint
and the givenObjectSource
. Set the boolean flag to true if the node is supposed to have local memory, or false otherwise. Memory is optional forAlphaNode
s and is only of benefic when adding additionalRule
s at runtime.- Parameters:
id
- Node's IDconstraint
- Node's constraintsobjectSource
- Node's object source
-
-
Method Detail
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternal
in interfaceExternalizable
- Overrides:
readExternal
in classObjectSource
- Throws:
IOException
ClassNotFoundException
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternal
in interfaceExternalizable
- Overrides:
writeExternal
in classObjectSource
- Throws:
IOException
-
getConstraint
public AlphaNodeFieldConstraint getConstraint()
Retruns theFieldConstraint
- Returns:
FieldConstraint
-
getType
public short getType()
- Specified by:
getType
in interfaceNetworkNode
-
doAttach
public void doAttach(BuildContext context)
-
setPartitionId
public void setPartitionId(BuildContext context, RuleBasePartitionId partitionId)
Description copied from class:BaseNode
Sets the partition this node belongs to- Overrides:
setPartitionId
in classObjectSource
-
assertObject
public void assertObject(InternalFactHandle factHandle, PropagationContext context, InternalWorkingMemory workingMemory)
- Specified by:
assertObject
in interfaceObjectSink
-
modifyObject
public void modifyObject(InternalFactHandle factHandle, ModifyPreviousTuples modifyPreviousTuples, PropagationContext context, InternalWorkingMemory workingMemory)
- Specified by:
modifyObject
in interfaceObjectSink
-
byPassModifyToBetaNode
public void byPassModifyToBetaNode(InternalFactHandle factHandle, ModifyPreviousTuples modifyPreviousTuples, PropagationContext context, InternalWorkingMemory workingMemory)
- Specified by:
byPassModifyToBetaNode
in interfaceObjectSink
-
updateSink
public void updateSink(ObjectSink sink, PropagationContext context, InternalWorkingMemory workingMemory)
- Specified by:
updateSink
in classObjectSource
-
getNextObjectSinkNode
public ObjectSinkNode getNextObjectSinkNode()
Returns the next node- Specified by:
getNextObjectSinkNode
in interfaceObjectSinkNode
- Returns:
- The next ObjectSinkNode
-
setNextObjectSinkNode
public void setNextObjectSinkNode(ObjectSinkNode next)
Sets the next node- Specified by:
setNextObjectSinkNode
in interfaceObjectSinkNode
- Parameters:
next
- The next ObjectSinkNode
-
getPreviousObjectSinkNode
public ObjectSinkNode getPreviousObjectSinkNode()
Returns the previous node- Specified by:
getPreviousObjectSinkNode
in interfaceObjectSinkNode
- Returns:
- The previous ObjectSinkNode
-
setPreviousObjectSinkNode
public void setPreviousObjectSinkNode(ObjectSinkNode previous)
Sets the previous node- Specified by:
setPreviousObjectSinkNode
in interfaceObjectSinkNode
- Parameters:
previous
- The previous ObjectSinkNode
-
calculateDeclaredMask
public BitMask calculateDeclaredMask(Class modifiedClass, List<String> settableProperties)
- Specified by:
calculateDeclaredMask
in classObjectSource
-
getDeclaredMask
public BitMask getDeclaredMask()
- Overrides:
getDeclaredMask
in classObjectSource
-
getInferredMask
public BitMask getInferredMask()
-
-