Package org.drools.core.common
Class BaseNode
- java.lang.Object
-
- org.drools.core.common.BaseNode
-
- All Implemented Interfaces:
java.io.Serializable
,org.drools.base.common.NetworkNode
- Direct Known Subclasses:
AbstractTerminalNode
,LeftTupleSource
,ObjectSource
public abstract class BaseNode extends java.lang.Object implements org.drools.base.common.NetworkNode
The base class for all Rete nodes.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Set<org.kie.api.definition.rule.Rule>
associations
protected int
hashcode
protected int
id
protected int
memoryId
protected org.drools.base.common.RuleBasePartitionId
partitionId
protected boolean
partitionsEnabled
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addAssociatedTerminal(org.drools.base.reteoo.BaseTerminalNode terminalNode)
void
addAssociation(BuildContext context, org.kie.api.definition.rule.Rule rule)
void
addAssociation(org.kie.api.definition.rule.Rule rule)
Associates this node with the give rulevoid
attach(BuildContext context)
Attaches the node into the network.void
doAttach(BuildContext context)
protected abstract boolean
doRemove(RuleRemovalContext context, ReteooBuilder builder)
Removes the node from the network.org.kie.api.definition.rule.Rule[]
getAssociatedRules()
int
getAssociatedTerminalsSize()
int
getAssociationsSize()
int
getId()
int
getMemoryId()
abstract ObjectTypeNode
getObjectTypeNode()
org.drools.base.common.RuleBasePartitionId
getPartitionId()
Returns the partition ID for which this node belongs toorg.drools.base.common.NetworkNode[]
getSinks()
boolean
hasAssociatedTerminal(org.drools.base.reteoo.BaseTerminalNode terminalNode)
int
hashCode()
protected void
initMemoryId(BuildContext context)
boolean
isAssociatedWith(org.kie.api.definition.rule.Rule rule)
abstract boolean
isInUse()
Returns true in case the current node is in use (is referenced by any other node)boolean
isStreamMode()
abstract 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 updateboolean
remove(RuleRemovalContext context, ReteooBuilder builder)
void
removeAssociatedTerminal(org.drools.base.reteoo.BaseTerminalNode terminalNode)
boolean
removeAssociation(org.kie.api.definition.rule.Rule rule, RuleRemovalContext context)
Removes the association to the given rule from the associations map.void
setId(int id)
void
setPartitionId(BuildContext context, org.drools.base.common.RuleBasePartitionId partitionId)
Sets the partition this node belongs tovoid
setPartitionsEnabled(boolean partitionsEnabled)
protected void
setStreamMode(boolean streamMode)
java.lang.String
toString()
-
-
-
Field Detail
-
id
protected int id
-
memoryId
protected int memoryId
-
partitionId
protected org.drools.base.common.RuleBasePartitionId partitionId
-
partitionsEnabled
protected boolean partitionsEnabled
-
associations
protected java.util.Set<org.kie.api.definition.rule.Rule> associations
-
hashcode
protected int hashcode
-
-
Method Detail
-
getId
public int getId()
- Specified by:
getId
in interfaceorg.drools.base.common.NetworkNode
-
setId
public void setId(int id)
-
getMemoryId
public int getMemoryId()
-
initMemoryId
protected void initMemoryId(BuildContext context)
-
isStreamMode
public boolean isStreamMode()
-
setStreamMode
protected void setStreamMode(boolean streamMode)
-
attach
public void attach(BuildContext context)
Attaches the node into the network. Usually to the parentObjectSource
orTupleSource
-
doAttach
public void doAttach(BuildContext context)
-
networkUpdated
public abstract 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
-
remove
public boolean remove(RuleRemovalContext context, ReteooBuilder builder)
-
doRemove
protected abstract boolean doRemove(RuleRemovalContext context, ReteooBuilder builder)
Removes the node from the network. Usually from the parentObjectSource
orTupleSource
-
isInUse
public abstract boolean isInUse()
Returns true in case the current node is in use (is referenced by any other node)
-
getObjectTypeNode
public abstract ObjectTypeNode getObjectTypeNode()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getPartitionId
public org.drools.base.common.RuleBasePartitionId getPartitionId()
Returns the partition ID for which this node belongs to- Specified by:
getPartitionId
in interfaceorg.drools.base.common.NetworkNode
-
setPartitionId
public void setPartitionId(BuildContext context, org.drools.base.common.RuleBasePartitionId partitionId)
Sets the partition this node belongs to
-
setPartitionsEnabled
public void setPartitionsEnabled(boolean partitionsEnabled)
-
addAssociation
public void addAssociation(org.kie.api.definition.rule.Rule rule)
Associates this node with the give rule
-
addAssociation
public void addAssociation(BuildContext context, org.kie.api.definition.rule.Rule rule)
-
removeAssociation
public boolean removeAssociation(org.kie.api.definition.rule.Rule rule, RuleRemovalContext context)
Removes the association to the given rule from the associations map.
-
getAssociationsSize
public int getAssociationsSize()
-
getAssociatedRules
public org.kie.api.definition.rule.Rule[] getAssociatedRules()
- Specified by:
getAssociatedRules
in interfaceorg.drools.base.common.NetworkNode
-
isAssociatedWith
public boolean isAssociatedWith(org.kie.api.definition.rule.Rule rule)
- Specified by:
isAssociatedWith
in interfaceorg.drools.base.common.NetworkNode
-
addAssociatedTerminal
public void addAssociatedTerminal(org.drools.base.reteoo.BaseTerminalNode terminalNode)
- Specified by:
addAssociatedTerminal
in interfaceorg.drools.base.common.NetworkNode
-
removeAssociatedTerminal
public void removeAssociatedTerminal(org.drools.base.reteoo.BaseTerminalNode terminalNode)
- Specified by:
removeAssociatedTerminal
in interfaceorg.drools.base.common.NetworkNode
-
getAssociatedTerminalsSize
public int getAssociatedTerminalsSize()
- Specified by:
getAssociatedTerminalsSize
in interfaceorg.drools.base.common.NetworkNode
-
hasAssociatedTerminal
public boolean hasAssociatedTerminal(org.drools.base.reteoo.BaseTerminalNode terminalNode)
- Specified by:
hasAssociatedTerminal
in interfaceorg.drools.base.common.NetworkNode
-
hashCode
public final int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
getSinks
public org.drools.base.common.NetworkNode[] getSinks()
- Specified by:
getSinks
in interfaceorg.drools.base.common.NetworkNode
-
-