choco.cp.solver.propagation
Class ConstraintEventQueue

java.lang.Object
  extended by choco.cp.solver.propagation.ConstraintEventQueue
All Implemented Interfaces:
EventQueue

public class ConstraintEventQueue
extends Object
implements EventQueue

Implements an EventQueue for managing the constraint awake events.


Field Summary
 
Fields inherited from interface choco.kernel.solver.propagation.queue.EventQueue
LOGGER
 
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 clear()
          Clear datastructures for safe reuses
 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 propagateAllEvents()
          Propagates one var in the queue.
 void propagateOneEvent()
          Propagates one var in the queue.
 boolean pushEvent(PropagationEvent event)
          Adds a new var in the queue.
 boolean 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

clear

public void clear()
Clear datastructures for safe reuses

Specified by:
clear in interface EventQueue

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 boolean remove(PropagationEvent event)
Removes the var from the left part.

Specified by:
remove in interface EventQueue

propagateAllEvents

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

Specified by:
propagateAllEvents 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())


Copyright © 2012. All Rights Reserved.