org.jscience.computing.ai.expertsystem.conflict
Class NaturalConflictSet

java.lang.Object
  extended by org.jscience.computing.ai.expertsystem.conflict.AbstractConflictSet
      extended by org.jscience.computing.ai.expertsystem.conflict.DefaultConflictSet
          extended by org.jscience.computing.ai.expertsystem.conflict.NaturalConflictSet
All Implemented Interfaces:
ConflictSet

public class NaturalConflictSet
extends DefaultConflictSet

A conflict set whose conflict resolution policy specifies that no rule can be fired more than once with the same objects. This conflict set requires a large amount of memory to store the history of rule firing, so it must be used with care. It also tends to get inefficient when the history grows.


Field Summary
 
Fields inherited from class org.jscience.computing.ai.expertsystem.conflict.AbstractConflictSet
debug, listeners
 
Constructor Summary
NaturalConflictSet()
          Class constructor.
 
Method Summary
 void flush()
          Removes all rules from this conflict set, as well as cleaning any history that might have been stored.
 void insertElement(ConflictSetElement element)
          Inserts a rule instantiation.
 ConflictSetElement nextElement()
          Returns the next rule to be fired.
 
Methods inherited from class org.jscience.computing.ai.expertsystem.conflict.DefaultConflictSet
isEmpty, removeElementsWith
 
Methods inherited from class org.jscience.computing.ai.expertsystem.conflict.AbstractConflictSet
addInternalConflictSetListener, elementAdded, elementRemoved, removeElementsWith_1D, removeElementsWith_2D, removeInternalConflictSetListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NaturalConflictSet

public NaturalConflictSet()
Class constructor.

Method Detail

flush

public void flush()
Removes all rules from this conflict set, as well as cleaning any history that might have been stored.

Specified by:
flush in interface ConflictSet
Overrides:
flush in class DefaultConflictSet

insertElement

public void insertElement(ConflictSetElement element)
Inserts a rule instantiation.

Specified by:
insertElement in interface ConflictSet
Overrides:
insertElement in class DefaultConflictSet
Parameters:
element - a conflict set element that holds the rule index as well as the objects bound to the rule declarations.

nextElement

public ConflictSetElement nextElement()
                               throws NoMoreElementsException
Returns the next rule to be fired.

Specified by:
nextElement in interface ConflictSet
Overrides:
nextElement in class DefaultConflictSet
Returns:
a conflict set element among those that have been inserted in this object, according to the policy defined in the conflict set.
Throws:
NoMoreElementsException - if there aren't any more elements in this conflict set.