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

ReteTuple - JBoss RULES 3.0.6 API 英文版文档


org.drools.reteoo
Class ReteTuple

java.lang.Object
  extended by org.drools.util.AbstractBaseLinkedListNode
      extended by org.drools.util.BaseMultiLinkedListNode
          extended by org.drools.reteoo.ReteTuple
All Implemented Interfaces:
java.io.Serializable, Tuple, LinkedListNode, MultiLinkedListNode

public class ReteTuple
extends BaseMultiLinkedListNode
implements Tuple, java.io.Serializable

Rete-OO Tuple implementation. A ReteTuple implements LinkedListNode so that it can referenced in a LinkedList, this allows for fast removal, without searching; as ReteTuples are add sequentially to a nodes memory (LinkedList), but removed randomly. Each ReteTuple has a Map of matches. The key is the matching FactHandleImpl and the value is the TupleMatch, which is also referenced in the ObjectMatches LinkedList.

Each ReteTuple also reference a TupleKey which is special array of FactHandles representing the Columns in a Rule. The TupleKey also provide the hashCode implementation for ReteTuple.

See Also:
Tuple, TupleMatch, TupleKey, Serialized Form

Constructor Summary
ReteTuple(DefaultFactHandle handle)
          Creates a ReteTuple with the handle at the specified column in the TupleKey.
 
Method Summary
 void addLinkedTuple(LinkedListNode node)
          Specifies the tuple as the result of NotNode propagation.
 void addTupleMatch(DefaultFactHandle handle, TupleMatch node)
           
 void clearLinkedTuple()
           
 boolean dependsOn(FactHandle handle)
          Determine if this tuple depends upon a specified object.
 boolean equals(java.lang.Object object)
           
 InternalFactHandle get(Declaration declaration)
          Returns the FactHandle for the given Declaration, which in turn specifcy the Column that they depend on.
 InternalFactHandle get(int col)
          Returns the FactHandle for the given column index.
 Activation getActivation()
           
 InternalFactHandle[] getFactHandles()
           
 LinkedList getLinkedTuples()
          Returns the tuple from the result of NotNode propagation.
 long getRecency()
           
 TupleMatch getTupleMatch(DefaultFactHandle handle)
           
 java.util.Map getTupleMatches()
           
 int hashCode()
           
 int matchesSize()
           
 TupleMatch removeMatch(DefaultFactHandle handle)
           
 void setActivation(Activation activation)
           
 java.lang.String toString()
           
 
Methods inherited from class org.drools.util.BaseMultiLinkedListNode
getChild, getOuterList, setChild, setOuterList
 
Methods inherited from class org.drools.util.AbstractBaseLinkedListNode
getNext, getPrevious, setNext, setPrevious
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.drools.util.LinkedListNode
getNext, getPrevious, setNext, setPrevious
 

Constructor Detail

ReteTuple

public ReteTuple(DefaultFactHandle handle)
Creates a ReteTuple with the handle at the specified column in the TupleKey.

Parameters:
column - The column position of the handle in the TupleKey
handle - The FactHandleImpl to be placed in the TupleKey at the given column position.
workingMemory - The WorkingMemory session.
Method Detail

getRecency

public long getRecency()
Specified by:
getRecency in interface Tuple

getFactHandles

public InternalFactHandle[] getFactHandles()
Specified by:
getFactHandles in interface Tuple

dependsOn

public boolean dependsOn(FactHandle handle)
Determine if this tuple depends upon a specified object.

Specified by:
dependsOn in interface Tuple
Parameters:
handle - The object handle to test.
Returns:
true if this tuple depends upon the specified object, otherwise false.

get

public InternalFactHandle get(int col)
Description copied from interface: Tuple
Returns the FactHandle for the given column index. If the column is empty It returns null.

Specified by:
get in interface Tuple
Parameters:
col - The index of the column from which the FactHandleImpl is to be returned
Returns:
The FactHandle

get

public InternalFactHandle get(Declaration declaration)
Description copied from interface: Tuple
Returns the FactHandle for the given Declaration, which in turn specifcy the Column that they depend on.

Specified by:
get in interface Tuple
Parameters:
declaration - The Declaration which specifies the Column
Returns:
The FactHandle

setActivation

public void setActivation(Activation activation)
Specified by:
setActivation in interface Tuple

getActivation

public Activation getActivation()

addLinkedTuple

public void addLinkedTuple(LinkedListNode node)
Specifies the tuple as the result of NotNode propagation.

Parameters:
tuple - The ReteTuple

getLinkedTuples

public LinkedList getLinkedTuples()
Returns the tuple from the result of NotNode propagation. If there has been no NotNode propagation then it returns null.

Returns:
The ReteTuple

clearLinkedTuple

public void clearLinkedTuple()

addTupleMatch

public void addTupleMatch(DefaultFactHandle handle,
                          TupleMatch node)

matchesSize

public int matchesSize()

getTupleMatches

public java.util.Map getTupleMatches()

getTupleMatch

public TupleMatch getTupleMatch(DefaultFactHandle handle)

removeMatch

public TupleMatch removeMatch(DefaultFactHandle handle)

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object