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

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

public class MRUConflictSet
extends AbstractConflictSet

A conflict set whose conflict resolution policy is one that the most recently fired rules have priority over the remaining ones.


Field Summary
 
Fields inherited from class org.jscience.computing.ai.expertsystem.conflict.AbstractConflictSet
debug, listeners
 
Constructor Summary
MRUConflictSet()
          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.
 boolean isEmpty()
          Checks whether this set has any elements.
 ConflictSetElement nextElement()
          Returns the next rule to be fired.
 void removeElementsWith(java.lang.Object obj)
          Remove all elements from this set that uses the given object in its instantiations.
 
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

MRUConflictSet

public MRUConflictSet()
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.


insertElement

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

Parameters:
element - a conflict set element that holds the rule index as well as the objects bound to the rule declarations.

isEmpty

public boolean isEmpty()
Checks whether this set has any elements.

Returns:
false if there is at least one fireable rule in this set; true otherwise.

nextElement

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

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

removeElementsWith

public void removeElementsWith(java.lang.Object obj)
Remove all elements from this set that uses the given object in its instantiations.

Parameters:
obj - the given object