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, MemoryFactory, NetworkNode, ObjectSink, ObjectSinkNode, Sink
public class AlphaNode
- extends ObjectSource
- implements ObjectSinkNode, MemoryFactory
AlphaNodes are nodes in the Rete network used
to apply FieldConstraint<.code>s on asserted fact
objects where the FieldConstraints have no dependencies on any other of the facts in the current Rule.
- See Also:
AlphaNodeFieldConstraint,
Serialized Form
|
Method Summary |
void |
addObjectSink(ObjectSink objectSink)
Adds the ObjectSink so that it may receive
FactHandleImpl propagated from this
ObjectSource. |
void |
assertObject(InternalFactHandle factHandle,
PropagationContext context,
InternalWorkingMemory workingMemory)
|
void |
attach(BuildContext context)
Attaches the node into the network. |
void |
byPassModifyToBetaNode(InternalFactHandle factHandle,
ModifyPreviousTuples modifyPreviousTuples,
PropagationContext context,
InternalWorkingMemory workingMemory)
|
long |
calculateDeclaredMask(List<String> settableProperties)
|
int |
calculateHashCode()
|
Memory |
createMemory(RuleBaseConfiguration config,
InternalWorkingMemory wm)
Creates a HashSet for the AlphaNode's memory. |
boolean |
equals(Object object)
|
AlphaNodeFieldConstraint |
getConstraint()
Retruns the FieldConstraint |
long |
getDeclaredMask()
|
long |
getInferredMask()
|
ObjectSinkNode |
getNextObjectSinkNode()
Returns the next node |
ObjectSinkNode |
getPreviousObjectSinkNode()
Returns the previous node |
short |
getType()
|
int |
hashCode()
The hashCode return is simply the unique id of the node. |
void |
modifyObject(InternalFactHandle factHandle,
ModifyPreviousTuples modifyPreviousTuples,
PropagationContext context,
InternalWorkingMemory workingMemory)
|
void |
readExternal(ObjectInput in)
|
void |
setNextObjectSinkNode(ObjectSinkNode next)
Sets the next node |
void |
setPreviousObjectSinkNode(ObjectSinkNode previous)
Sets the previous node |
String |
toString()
|
void |
updateSink(ObjectSink sink,
PropagationContext context,
InternalWorkingMemory workingMemory)
|
void |
writeExternal(ObjectOutput out)
|
AlphaNode
public AlphaNode()
AlphaNode
public AlphaNode(int id,
AlphaNodeFieldConstraint constraint,
ObjectSource objectSource,
BuildContext context)
- Construct an
AlphaNode with a unique id using the provided
FieldConstraint and the given ObjectSource.
Set the boolean flag to true if the node is supposed to have local
memory, or false otherwise. Memory is optional for AlphaNodes
and is only of benefic when adding additional Rules at runtime.
- Parameters:
id - Node's IDconstraint - Node's constraintsobjectSource - Node's object source
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
getConstraint
public AlphaNodeFieldConstraint getConstraint()
- Retruns the
FieldConstraint
- Returns:
FieldConstraint
getType
public short getType()
- Specified by:
getType in interface NetworkNode
attach
public void attach(BuildContext context)
- Description copied from class:
BaseNode
- Attaches the node into the network. Usually to the parent
ObjectSource or TupleSource
- Specified by:
attach in class BaseNode
assertObject
public void assertObject(InternalFactHandle factHandle,
PropagationContext context,
InternalWorkingMemory workingMemory)
- Specified by:
assertObject in interface ObjectSink
modifyObject
public void modifyObject(InternalFactHandle factHandle,
ModifyPreviousTuples modifyPreviousTuples,
PropagationContext context,
InternalWorkingMemory workingMemory)
- Specified by:
modifyObject in interface ObjectSink
byPassModifyToBetaNode
public void byPassModifyToBetaNode(InternalFactHandle factHandle,
ModifyPreviousTuples modifyPreviousTuples,
PropagationContext context,
InternalWorkingMemory workingMemory)
- Specified by:
byPassModifyToBetaNode in interface ObjectSink
updateSink
public void updateSink(ObjectSink sink,
PropagationContext context,
InternalWorkingMemory workingMemory)
- Specified by:
updateSink in class ObjectSource
createMemory
public Memory createMemory(RuleBaseConfiguration config,
InternalWorkingMemory wm)
- Creates a HashSet for the AlphaNode's memory.
- Specified by:
createMemory in interface MemoryFactory
toString
public String toString()
- Overrides:
toString in class BaseNode
hashCode
public int hashCode()
- Description copied from class:
BaseNode
- The hashCode return is simply the unique id of the node. It is expected that base classes will also implement equals(Object object).
- Overrides:
hashCode in class BaseNode
calculateHashCode
public int calculateHashCode()
equals
public boolean equals(Object object)
- Overrides:
equals in class Object
getNextObjectSinkNode
public ObjectSinkNode getNextObjectSinkNode()
- Returns the next node
- Specified by:
getNextObjectSinkNode in interface ObjectSinkNode
- Returns:
- The next ObjectSinkNode
setNextObjectSinkNode
public void setNextObjectSinkNode(ObjectSinkNode next)
- Sets the next node
- Specified by:
setNextObjectSinkNode in interface ObjectSinkNode
- Parameters:
next - The next ObjectSinkNode
getPreviousObjectSinkNode
public ObjectSinkNode getPreviousObjectSinkNode()
- Returns the previous node
- Specified by:
getPreviousObjectSinkNode in interface ObjectSinkNode
- Returns:
- The previous ObjectSinkNode
setPreviousObjectSinkNode
public void setPreviousObjectSinkNode(ObjectSinkNode previous)
- Sets the previous node
- Specified by:
setPreviousObjectSinkNode in interface ObjectSinkNode
- Parameters:
previous - The previous ObjectSinkNode
calculateDeclaredMask
public long calculateDeclaredMask(List<String> settableProperties)
- Specified by:
calculateDeclaredMask in class ObjectSource
getDeclaredMask
public long getDeclaredMask()
- Overrides:
getDeclaredMask in class ObjectSource
getInferredMask
public long getInferredMask()
addObjectSink
public void addObjectSink(ObjectSink objectSink)
- Description copied from class:
ObjectSource
- Adds the
ObjectSink so that it may receive
FactHandleImpl propagated from this
ObjectSource.
- Overrides:
addObjectSink in class ObjectSource
- Parameters:
objectSink - The ObjectSink to receive propagated
FactHandleImpl.
Copyright © 2001-2014 JBoss by Red Hat. All Rights Reserved.