jeops.conflict
Interface ConflictSet

All Known Implementing Classes:
AbstractConflictSet

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.

Version:
0.03 08 Jun 2000 The conflict set is now a source of ConflictSetEvents.
Author:
Carlos Figueira Filho (csff@cin.ufpe.br)

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

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

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 the 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

removeInternalConflictSetListener

public 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