org.jscience.computing.ai.expertsystem.rete
Class ReteNode

java.lang.Object
  extended by org.jscience.computing.ai.expertsystem.rete.ReteNode
Direct Known Subclasses:
ClassFilterReteNode, FilterReteNode, FinalReteNode, JoinReteNode

public abstract class ReteNode
extends java.lang.Object

A node in the Rete network. This class is the base for all kinds of nodes that exist in the implementation of the Rete network for JEOPS.


Constructor Summary
ReteNode(int numberInputs, int numberOutputs)
          Creates a new rete node.
 
Method Summary
 void addSuccessor(int input, ReteNode succNode, int succInput)
          Adds a connection from some input of this node to a given input of the given node.
 void addSuccessor(ReteNode succNode)
          Adds a connection from the only input of this node to the only input of the given node.
 void addSuccessor(ReteNode succNode, int succIndex)
          Adds a connection from the only input of this node to a given input of the given node.
 int getNumberInputs()
          Returns the number of inputs of this node.
 int getNumberOutputs()
          Returns the number of outputs of this node.
protected  java.util.List getSuccessors()
          Returns the successors of this node.
abstract  void newObject(java.lang.Object obj, int input)
          Informs this node that an object has arrived.
protected  void propagate(java.lang.Object obj, int input)
          Propagates the objects from this node to the successors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReteNode

public ReteNode(int numberInputs,
                int numberOutputs)
Creates a new rete node.

Parameters:
numberInputs - the number of inputs of this node.
numberOutputs - the number of inputs of this node.
Method Detail

addSuccessor

public void addSuccessor(int input,
                         ReteNode succNode,
                         int succInput)
Adds a connection from some input of this node to a given input of the given node.

Parameters:
input - the input of this node that is being connected to the given input of the successor node.
succNode - the successor to be added to this node.
succInput - the input in the successor node to where the propagated objects must be sent.

addSuccessor

public void addSuccessor(ReteNode succNode)
Adds a connection from the only input of this node to the only input of the given node.

Parameters:
succNode - the successor to be added to this node.

addSuccessor

public void addSuccessor(ReteNode succNode,
                         int succIndex)
Adds a connection from the only input of this node to a given input of the given node.

Parameters:
succNode - the successor to be added to this node.
succIndex - the input in the successor node to where the propagated objects must be sent.

getNumberInputs

public int getNumberInputs()
Returns the number of inputs of this node.

Returns:
the number of inputs of this node.

getNumberOutputs

public int getNumberOutputs()
Returns the number of outputs of this node.

Returns:
the number of outputs of this node.

getSuccessors

protected java.util.List getSuccessors()
Returns the successors of this node. Available only for subclasses.

Returns:
the successors of this node.

newObject

public abstract void newObject(java.lang.Object obj,
                               int input)
Informs this node that an object has arrived.

Parameters:
obj - the object that arrived at this node.
input - the input number of this node that is to receive the object.

propagate

protected void propagate(java.lang.Object obj,
                         int input)
Propagates the objects from this node to the successors. It's an auxiliar method that must be invoked by the subclasses in order to propagate the objects to the registered successors.

Parameters:
obj - the object to be propagated.
input - the input from which the object entered.