jeops.conflict
Class OneShotConflictSet

java.lang.Object
  |
  +--jeops.conflict.AbstractConflictSet
        |
        +--jeops.conflict.OneShotConflictSet

public class OneShotConflictSet
extends AbstractConflictSet

A conflict set whose conflict resolution policy specifies that no rule can be fired more than once.

Version:
0.01 24 May 2000
Author:
Carlos Figueira Filho (csff@cin.ufpe.br)

Field Summary
private  java.util.Vector fireableRules
          The vector where the fireable rules are stored.
private  java.util.Vector history
          The history of rule firings.
private  int size
          The number of elements in this conflict set.
 
Fields inherited from class jeops.conflict.AbstractConflictSet
debug, listeners
 
Constructor Summary
OneShotConflictSet()
          Class constructor.
 
Method Summary
private  void ensureFireableRulesCapacity(int size)
          Auxiliar method that ensures that the fireable rules vector has as many elements as the given integer.
 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 jeops.conflict.AbstractConflictSet
addInternalConflictSetListener, elementAdded, elementRemoved, fireInternalElementAddedEvent, fireInternalElementRemovedEvent, removeElementsWith_1D, removeElementsWith_2D, removeInternalConflictSetListener
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

fireableRules

private java.util.Vector fireableRules
The vector where the fireable rules are stored. It's actually a vector of vectors, to simulate a bidimensional matrix: the lines represent the rules and the columns will have their instantiations.

history

private java.util.Vector history
The history of rule firings. This vector stores boolean values indicating whether a rule has already been fired.

size

private int size
The number of elements in this conflict set.
Constructor Detail

OneShotConflictSet

public OneShotConflictSet()
Class constructor.
Method Detail

ensureFireableRulesCapacity

private void ensureFireableRulesCapacity(int size)
Auxiliar method that ensures that the fireable rules vector has as many elements as the given integer.
Parameters:
size - the size the vector must have.

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