org.jscience.computing.ai.expertsystem.conflict
Interface ConflictSet

All Known Implementing Classes:
AbstractConflictSet, DefaultConflictSet, LRUConflictSet, MRUConflictSet, NaturalConflictSet, OneShotConflictSet, PriorityConflictSet

public interface ConflictSet

Defines the required operations that a conflict set should implement. The conflict set is the place where the fireable rules are stored, and one of them is to be chosen to fire at some moment.
It's up to the implementing classes to determine the policy used to select which rule to fire.

The implementations of the conflict set must also be able to notify any registered listener that some element has been added to or removed from the conflict set.


Method Summary
 void addInternalConflictSetListener(InternalConflictSetListener l)
          Adds the specified listener to receive events from this conflict set.
 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.
 void removeInternalConflictSetListener(InternalConflictSetListener l)
          Removes the specified listener so that it no longer receives events from this conflict set.
 

Method Detail

addInternalConflictSetListener

void addInternalConflictSetListener(InternalConflictSetListener l)
Adds the specified listener to receive events from this conflict set.

Parameters:
l - the conflict set listener

flush

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


insertElement

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

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

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 the conflict set.
Throws:
NoMoreElementsException - if there aren't any more elements in this conflict set.

removeElementsWith

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

removeInternalConflictSetListener

void removeInternalConflictSetListener(InternalConflictSetListener l)
Removes the specified listener so that it no longer receives events from this conflict set.

Parameters:
l - the conflict set listener