站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss RULES 4.0.0.11754MR2 API 英文版文档

AlphaNode (Drools 4.0.0.11754MR2 API) - JBoss RULES 4.0.0.11754MR2 API 英文版文档


org.drools.reteoo
Class AlphaNode

java.lang.Object
  extended by org.drools.common.BaseNode
      extended by org.drools.reteoo.ObjectSource
          extended by org.drools.reteoo.AlphaNode
All Implemented Interfaces:
Serializable, NetworkNode, NodeMemory, ObjectSink, ObjectSinkNode

public class AlphaNode
extends ObjectSource
implements ObjectSinkNode, NodeMemory

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.

Author:
Mark Proctor, Bob McWhirter
See Also:
AlphaNodeFieldConstraint, Serialized Form

Field Summary
 
Fields inherited from class org.drools.reteoo.ObjectSource
objectSource, sink
 
Fields inherited from class org.drools.common.BaseNode
hasMemory, id, sharedCount
 
Constructor Summary
AlphaNode(int id, AlphaNodeFieldConstraint constraint, ObjectSource objectSource)
          Construct an AlphaNode with a unique id using the provided FieldConstraint and the given ObjectSource.
AlphaNode(int id, AlphaNodeFieldConstraint constraint, ObjectSource objectSource, boolean hasMemory, int alphaNodeHashingThreshold)
          Construct an AlphaNode with a unique id using the provided FieldConstraint and the given ObjectSource.
 
Method Summary
 void assertObject(InternalFactHandle handle, PropagationContext context, InternalWorkingMemory workingMemory)
          Assert a new FactHandleImpl.
 void attach()
          Attaches the node into the network.
 void attach(InternalWorkingMemory[] workingMemories)
           
 Object createMemory(RuleBaseConfiguration config)
          Creates a HashSet for the AlphaNode's memory.
 boolean equals(Object object)
           
 AlphaNodeFieldConstraint getConstraint()
          Retruns the FieldConstraint
 ObjectSinkNode getNextObjectSinkNode()
          Returns the next node
 ObjectSinkNode getPreviousObjectSinkNode()
          Returns the previous node
 int hashCode()
          The hashCode return is simply the unique id of the node.
 void remove(BaseNode node, InternalWorkingMemory[] workingMemories)
          Removes the node from teh network.
 void retractObject(InternalFactHandle handle, PropagationContext context, InternalWorkingMemory workingMemory)
          Retract an existing FactHandleImpl.
 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)
           
 
Methods inherited from class org.drools.reteoo.ObjectSource
addObjectSink, getSinkPropagator, removeObjectSink
 
Methods inherited from class org.drools.common.BaseNode
addShare, getId, getSharedCount, hasMemory, isInUse, isShared, removeShare, setHasMemory
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.drools.common.NodeMemory
getId
 

Constructor Detail

AlphaNode

public AlphaNode(int id,
                 AlphaNodeFieldConstraint constraint,
                 ObjectSource objectSource)
Construct an AlphaNode with a unique id using the provided FieldConstraint and the given ObjectSource. Nodes created in this way will have a local memory by default.

Parameters:
id -
constraint -
objectSource -

AlphaNode

public AlphaNode(int id,
                 AlphaNodeFieldConstraint constraint,
                 ObjectSource objectSource,
                 boolean hasMemory,
                 int alphaNodeHashingThreshold)
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 ID
constraint - Node's constraints
objectSource - Node's object source
hasMemory - true if node shall be configured with local memory. False otherwise.
Method Detail

getConstraint

public AlphaNodeFieldConstraint getConstraint()
Retruns the FieldConstraint

Returns:
FieldConstraint

attach

public void attach()
Description copied from class: BaseNode
Attaches the node into the network. Usually to the parent ObjectSource or TupleSource

Specified by:
attach in class BaseNode

attach

public void attach(InternalWorkingMemory[] workingMemories)
Specified by:
attach in class BaseNode

assertObject

public void assertObject(InternalFactHandle handle,
                         PropagationContext context,
                         InternalWorkingMemory workingMemory)
                  throws FactException
Description copied from interface: ObjectSink
Assert a new FactHandleImpl.

Specified by:
assertObject in interface ObjectSink
Parameters:
handle - The asserted FactHandle/code>.
context - The PropagationContext of the WorkingMemory action.
workingMemory - the WorkingMemory session.
Throws:
FactException

retractObject

public void retractObject(InternalFactHandle handle,
                          PropagationContext context,
                          InternalWorkingMemory workingMemory)
Description copied from interface: ObjectSink
Retract an existing FactHandleImpl.

Specified by:
retractObject in interface ObjectSink
Parameters:
handle - The FactHandle/code> to retract.
context - The PropagationContext of the WorkingMemory action.
workingMemory - the WorkingMemory session.

updateSink

public void updateSink(ObjectSink sink,
                       PropagationContext context,
                       InternalWorkingMemory workingMemory)
Specified by:
updateSink in class ObjectSource

remove

public void remove(BaseNode node,
                   InternalWorkingMemory[] workingMemories)
Description copied from class: BaseNode
Removes the node from teh network. Usually from the parent ObjectSource or TupleSource

Specified by:
remove in class BaseNode

createMemory

public Object createMemory(RuleBaseConfiguration config)
Creates a HashSet for the AlphaNode's memory.

Specified by:
createMemory in interface NodeMemory

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

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


Copyright © 2001-2007 JBoss Inc.. All Rights Reserved.