choco.cp.solver.propagation
Class VariableEventQueue

java.lang.Object
  extended by choco.cp.solver.propagation.VariableEventQueue
All Implemented Interfaces:
EventQueue
Direct Known Subclasses:
BlockingVarEventQueue, ObservableVarEventQueue

public class VariableEventQueue
extends Object
implements EventQueue


Field Summary
protected  PropagationEvent lastPopped
          The last popped var (may be useful for flushing popping events).
protected  Queue<PropagationEvent> queue
          FIFO queue to deal with variable events
 
Fields inherited from interface choco.kernel.solver.propagation.queue.EventQueue
LOGGER
 
Constructor Summary
VariableEventQueue()
           
 
Method Summary
 void clear()
          Clear datastructures for safe reuses
 void flushEventQueue()
          Removes all the events (including the popping one).
 PropagationEvent get(int idx)
          returns the i-th pending event in the queue
 boolean isEmpty()
          Checks if the queue is empty.
 PropagationEvent popEvent()
          Pops an event to propagate.
 void propagateAllEvents()
          Propagates some events: in fact all the events of the queue, since there are the most important events.
 void propagateOneEvent()
          Propagates one single event from the queue (usefull for tracing)
 boolean pushEvent(PropagationEvent event)
          Adds an event to the queue.
 boolean remove(PropagationEvent event)
          Removes an event.
 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
 

Field Detail

queue

protected Queue<PropagationEvent> queue
FIFO queue to deal with variable events


lastPopped

protected PropagationEvent lastPopped
The last popped var (may be useful for flushing popping events).

Constructor Detail

VariableEventQueue

public VariableEventQueue()
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

propagateAllEvents

public void propagateAllEvents()
                        throws ContradictionException
Propagates some events: in fact all the events of the queue, since there are the most important events.

Specified by:
propagateAllEvents in interface EventQueue
Throws:
ContradictionException

propagateOneEvent

public void propagateOneEvent()
                       throws ContradictionException
Propagates one single event from the queue (usefull for tracing)

Specified by:
propagateOneEvent in interface EventQueue
Throws:
ContradictionException

popEvent

public PropagationEvent popEvent()
Pops an event to propagate.

Specified by:
popEvent in interface EventQueue

pushEvent

public boolean pushEvent(PropagationEvent event)
Adds an event to the queue.

Specified by:
pushEvent in interface EventQueue

flushEventQueue

public void flushEventQueue()
Removes all the events (including the popping one).

Specified by:
flushEventQueue in interface EventQueue

remove

public boolean remove(PropagationEvent event)
Removes an event. This method should not be useful for variable events.

Specified by:
remove in interface EventQueue

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.