choco.prop
Class ConstraintEventQueue

java.lang.Object
  extended by choco.prop.ConstraintEventQueue
All Implemented Interfaces:
EventQueue

public class ConstraintEventQueue
extends java.lang.Object
implements EventQueue

Implements an EventQueue for managing the constraint awake events.


Constructor Summary
ConstraintEventQueue(PropagationEngine engine)
          Constructs a new queue for the specified engine.
 
Method Summary
 void add(PropagationEvent event)
          Adds a new constraint in the right part of the set (will not be propagated).
 void flushEventQueue()
          Removes all the events from the queue.
 PropagationEvent get(int idx)
          returns the i-th pending event in the queue
 boolean isEmpty()
          Checks if the queue is empty.
 PropagationEvent popEvent()
          Pops the next var to propagate.
 void propagateOneEvent()
          Propagates one var in the queue.
 void propagateSomeEvents()
          Propagates one var in the queue.
 boolean pushEvent(PropagationEvent event)
          Adds a new var in the queue.
 void remove(PropagationEvent event)
          Removes the var from the left part.
 int size()
          returns the number of pending events in the queue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstraintEventQueue

public ConstraintEventQueue(PropagationEngine engine)
Constructs a new queue for the specified engine.

Method Detail

isEmpty

public boolean isEmpty()
Checks if the queue is empty.

Specified by:
isEmpty in interface EventQueue

popEvent

public PropagationEvent popEvent()
Pops the next var to propagate.

Specified by:
popEvent in interface EventQueue

pushEvent

public boolean pushEvent(PropagationEvent event)
Adds a new var in the queue.

Specified by:
pushEvent in interface EventQueue
Returns:
True if the var had to be added.

flushEventQueue

public void flushEventQueue()
Removes all the events from the queue.

Specified by:
flushEventQueue in interface EventQueue

add

public void add(PropagationEvent event)
Adds a new constraint in the right part of the set (will not be propagated). It should be done just after creating the constraint.


remove

public void remove(PropagationEvent event)
Removes the var from the left part.

Specified by:
remove in interface EventQueue

propagateSomeEvents

public void propagateSomeEvents()
                         throws ContradictionException
Propagates one var in the queue.

Specified by:
propagateSomeEvents in interface EventQueue
Throws:
ContradictionException

propagateOneEvent

public void propagateOneEvent()
                       throws ContradictionException
Propagates one var in the queue.

Specified by:
propagateOneEvent in interface EventQueue
Throws:
ContradictionException

size

public int size()
Description copied from interface: EventQueue
returns the number of pending events in the queue

Specified by:
size in interface EventQueue
Returns:
the number of pending events in the queue

get

public PropagationEvent get(int idx)
Description copied from interface: EventQueue
returns the i-th pending event in the queue

Specified by:
get in interface EventQueue
Parameters:
idx - the index of the event
Returns:
null if the index is inproper (idx<0 or idx>=size())