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

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


org.drools.common
Class BaseNode

java.lang.Object
  extended by org.drools.common.BaseNode
All Implemented Interfaces:
Serializable, NetworkNode
Direct Known Subclasses:
ObjectSource, QueryTerminalNode, RuleTerminalNode, TupleSource

public abstract class BaseNode
extends Object
implements NetworkNode

The base class for all Rete nodes.

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

Field Summary
protected  boolean hasMemory
           
protected  int id
           
protected  int sharedCount
           
 
Constructor Summary
BaseNode(int id)
          All nodes have a unique id, set in the constructor.
 
Method Summary
 void addShare()
          Each time a node is shared a counter is increased.
abstract  void attach()
          Attaches the node into the network.
abstract  void attach(InternalWorkingMemory[] workingMemories)
           
 int getId()
          Returns the unique id that represents the node in the Rete network
 int getSharedCount()
          Returns the number of times the node is shared
 int hashCode()
          The hashCode return is simply the unique id of the node.
 boolean hasMemory()
          Indicates whether the node has any memory.
 boolean isInUse()
          Returns true in case the current node is in use (is referenced by any other node)
 boolean isShared()
          Indicates whether the node is shared.
abstract  void remove(BaseNode node, InternalWorkingMemory[] workingMemories)
          Removes the node from teh network.
 void removeShare()
          Each time a node is unshared a counter is decreased.
protected  void setHasMemory(boolean hasMemory)
          Specifies with the node has any memory.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

id

protected final int id

hasMemory

protected boolean hasMemory

sharedCount

protected int sharedCount
Constructor Detail

BaseNode

public BaseNode(int id)
All nodes have a unique id, set in the constructor.

Parameters:
id - The unique id
Method Detail

getId

public int getId()
Description copied from interface: NetworkNode
Returns the unique id that represents the node in the Rete network

Specified by:
getId in interface NetworkNode
Returns:
unique int value

setHasMemory

protected void setHasMemory(boolean hasMemory)
Specifies with the node has any memory.

Parameters:
hasMemory -

hasMemory

public boolean hasMemory()
Indicates whether the node has any memory.

Returns:

attach

public abstract void attach()
Attaches the node into the network. Usually to the parent ObjectSource or TupleSource


attach

public abstract void attach(InternalWorkingMemory[] workingMemories)

remove

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


addShare

public void addShare()
Each time a node is shared a counter is increased.


removeShare

public void removeShare()
Each time a node is unshared a counter is decreased.


isShared

public boolean isShared()
Indicates whether the node is shared.

Returns:

isInUse

public boolean isInUse()
Returns true in case the current node is in use (is referenced by any other node)

Returns:

getSharedCount

public int getSharedCount()
Returns the number of times the node is shared

Returns:
int value indicating the share count.

hashCode

public int hashCode()
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 Object

toString

public String toString()
Overrides:
toString in class Object


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