edu.cs.ai.kreator.logic.prolog
Class NodeCollection

java.lang.Object
  extended by edu.cs.ai.kreator.logic.prolog.NodeCollection

public class NodeCollection
extends java.lang.Object

Stores nodes of RuleSLDNode and VariableSLDNode to prevent unnecessary computations and to detect cycles.

Author:
Matthias Thimm

Constructor Summary
NodeCollection()
          Constructs a new node collection without nodes.
 
Method Summary
 void addNode(AbstractSldNode node)
          Adds a new node to this collection.
 boolean containsAtom(GeneralizedAtom atom)
          Determines whether there is a variable node in this collection with the given atom.
 VariableSldNode getNode(GeneralizedAtom atom)
          Determines whether there is a variable node in this collection with the given atom and if that is the case, returns the node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeCollection

public NodeCollection()
Constructs a new node collection without nodes.

Method Detail

addNode

public void addNode(AbstractSldNode node)
Adds a new node to this collection.

Parameters:
node - a rule node or a variable node.

containsAtom

public boolean containsAtom(GeneralizedAtom atom)
Determines whether there is a variable node in this collection with the given atom.

Parameters:
atom - a bayesian atom
Returns:
"true" iff there is a variable node in this collection with the given atom.

getNode

public VariableSldNode getNode(GeneralizedAtom atom)
Determines whether there is a variable node in this collection with the given atom and if that is the case, returns the node.

Parameters:
atom - a bayesian atom.
Returns:
a variable node with the given atom or "null" if there is no such node.