jeops.engine
Class ConflictSet

java.lang.Object
  |
  +--jeops.engine.ConflictSet

public class ConflictSet
extends java.lang.Object

This classes models the conflict set of the inference engine. The conflict set is the place where the fireable rules are stored, and one of them is to be chosen to fire at the moment.
The user can determine the rule ordering policy used to choose the rule to fire. It can be achieved by using the setRuleSorter(RuleSorter) method.

Version:
0.01 13 Dez 1998
Author:
Carlos Figueira Filho (csff@di.ufpe.br)
See Also:
RuleSorter

Constructor Summary
ConflictSet()
          Creates a new conflict set, using the default rule sorter.
ConflictSet(RuleSorter ruleSorter)
          Creates a new conflict set, given its rule sorter.
 
Method Summary
 void flush()
          Removes all rules from this conflict set.
 void insertRule(Rule rule)
          Inserts a rule in this conflict set.
 boolean isEmpty()
          Checks whether this set has any elements.
 Rule nextRule()
          Returns the next rule to be fired.
 void removeNonFirebleRules()
          Re-test all instanciations of the rules in this set to check whether they're still fireable, removing those that aren't anymore.
 void removeRulesWith(java.lang.Object obj)
          Remove all rules from this set that uses the given object in its instantiations.
 void setRuleSorter(RuleSorter ruleSorter)
          Modifies this conflict set's rule sorter.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConflictSet

public ConflictSet()
Creates a new conflict set, using the default rule sorter.

ConflictSet

public ConflictSet(RuleSorter ruleSorter)
Creates a new conflict set, given its rule sorter.
Method Detail

flush

public void flush()
Removes all rules from this conflict set.

insertRule

public void insertRule(Rule rule)
Inserts a rule in this conflict set. The rule's symbolic table will be filled with the objects that made it fireable.
Parameters:
rule - the rule to be inserted.

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.

nextRule

public Rule nextRule()
              throws NoMoreRulesException
Returns the next rule to be fired. In the return of this method, the symbolic table of the table shall be correctly filled.
Returns:
the rule to be fired, among those that have been inserted in this object, according to the policy defined in the rule sorter.
Throws:
NoMoreRulesException - if there aren't any more rules to be fired.

removeNonFirebleRules

public void removeNonFirebleRules()
Re-test all instanciations of the rules in this set to check whether they're still fireable, removing those that aren't anymore. This method tends to be a little slow, so it must be used with care.

removeRulesWith

public void removeRulesWith(java.lang.Object obj)
Remove all rules from this set that uses the given object in its instantiations.
Parameters:
obj - the given object

setRuleSorter

public void setRuleSorter(RuleSorter ruleSorter)
Modifies this conflict set's rule sorter.
Parameters:
ruleSorter - the new rule sorter for this conflict set.