while (messageQueue.size()>0 && ((Message)messageQueue.get(0)).getDeliveryTime()==numExecutions+1) {
if (messageQueue.size()>0) { System.err.println("numWork=" + getWorkExecutions() + " numPhase=" + getPhaseExecutions() + " delivery time of front=" + ((Message)messageQueue.get(0)).getDeliveryTime()); }     while (messageQueue.size()>0 && ((Message)messageQueue.get(0)).getDeliveryTime()==workExecutions+1) {
    private void deliverMessages() {        // deliver before the next execution        while (messageQueue.size()>0 && ((Message)messageQueue.get(0)).getDeliveryTime()==numExecutions+1) {            Message m = (Message)messageQueue.removeFirst();            m.deliver(this);        }    }