choco.prop
Class VarEventQueue

java.lang.Object
  extended by choco.prop.VarEventQueue
All Implemented Interfaces:
EventQueue
Direct Known Subclasses:
PalmVarEventQueue

public class VarEventQueue
extends java.lang.Object
implements EventQueue


Field Summary
protected  PropagationEvent lastPopped
          The last popped var (may be useful for flushing popping events).
protected  PriorityQueue queue
          A priority queue with all the var.
 
Constructor Summary
VarEventQueue()
           
 
Method Summary
 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 propagateOneEvent()
          Propagates one single event from the queue (usefull for tracing)
 void propagateSomeEvents()
          Propagates some events: in fact all the events of the queue, since there are the most important events.
 boolean pushEvent(PropagationEvent event)
          Adds an event to the queue.
 void remove(PropagationEvent event)
          Removes an event.
 int size()
          returns the number of pending events in the queue
 void updatePriority(PropagationEvent event)
          Updates the priority level of an event (after adding a basic var).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

queue

protected PriorityQueue queue
A priority queue with all the var. Default number of priority levels: 5 from 0 (most important) to 4.


lastPopped

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

Constructor Detail

VarEventQueue

public VarEventQueue()
Method Detail

isEmpty

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

Specified by:
isEmpty in interface EventQueue

propagateSomeEvents

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

Specified by:
propagateSomeEvents 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

updatePriority

public void updatePriority(PropagationEvent event)
Updates the priority level of an event (after adding a basic var).


flushEventQueue

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

Specified by:
flushEventQueue in interface EventQueue

remove

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