ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.contactcenters.msk.stat
Class QueueSizeChecker

java.lang.Object
  extended by umontreal.iro.lecuyer.contactcenters.msk.stat.QueueSizeChecker
All Implemented Interfaces:
WaitingQueueListener, MeasureMatrix

public final class QueueSizeChecker
extends Object
implements WaitingQueueListener, MeasureMatrix

Computes the maximal queue size for every waiting queue and statistical period, during the simulation. An object of this class registers as a listener for every waiting queue of the model. Each time a contact enters a queue, the object checks that the queue size is not greater than the current maximum, and updates the maximum if necessary. When the model is simulated over multiple periods, such maxima are computed for each period. A queue-size checker is also a period-change listener, because at the beginning of periods, it needs to set the per-period initial maxima to the current queue size.


Constructor Summary
QueueSizeChecker(CallCenter cc, StatPeriod statP)
          Constructs a new queue-size checker using call center cc, and object statP to obtain statistical periods.
 
Method Summary
 void dequeued(DequeueEvent ev)
          This method is called when a contact is removed from a waiting queue, ev representing the corresponding dequeue event.
 void enqueued(DequeueEvent ev)
          This method is called after a contact was added to a queue.
 double getMeasure(int i, int p)
          Returns the measure corresponding to the index i and period p.
 int getNumMeasures()
          Returns the number of measures calculated by the implementation of this interface.
 int getNumPeriods()
          Returns the number of periods stored into this matrix of measures.
 void init()
          Resets the values of maxima to 0.
 void init(WaitingQueue queue)
          This method is called after the WaitingQueue.init() method is called for the waiting queue queue.
 void initForCurrentPeriod()
           
 void register()
          Registers this queue-size checker with the associated call center model.
 void regroupPeriods(int x)
          Increases the length of stored periods by regrouping them.
 void setNumMeasures(int nm)
          Sets the number of measures to nm.
 void setNumPeriods(int np)
          Sets the number of periods of this matrix to np.
 void unregister()
          Unregisters this queue-size checker with the associated model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueueSizeChecker

public QueueSizeChecker(CallCenter cc,
                        StatPeriod statP)
Constructs a new queue-size checker using call center cc, and object statP to obtain statistical periods.

Method Detail

init

public void init()
Resets the values of maxima to 0.

Specified by:
init in interface MeasureMatrix

initForCurrentPeriod

public void initForCurrentPeriod()

register

public void register()
Registers this queue-size checker with the associated call center model. The method adds this object to the list of observers for all waiting queues of the model, and registers itself as a period-change listener.


unregister

public void unregister()
Unregisters this queue-size checker with the associated model. This method performs the reverse task of register().


init

public void init(WaitingQueue queue)
Description copied from interface: WaitingQueueListener
This method is called after the WaitingQueue.init() method is called for the waiting queue queue.

Specified by:
init in interface WaitingQueueListener
Parameters:
queue - the queue being initialized.

enqueued

public void enqueued(DequeueEvent ev)
Description copied from interface: WaitingQueueListener
This method is called after a contact was added to a queue. The event ev can be used to access the available information about the queued contact. When this is called, it should be possible to use the waiting-queue iterator to find the contact in the queue. However, if the contact is immediately dequeued, it can be absent from the queue.

Specified by:
enqueued in interface WaitingQueueListener
Parameters:
ev - the dequeue event associated with the queued contact.

dequeued

public void dequeued(DequeueEvent ev)
Description copied from interface: WaitingQueueListener
This method is called when a contact is removed from a waiting queue, ev representing the corresponding dequeue event.

Specified by:
dequeued in interface WaitingQueueListener
Parameters:
ev - the obsolete dequeue event.

getMeasure

public double getMeasure(int i,
                         int p)
Description copied from interface: MeasureMatrix
Returns the measure corresponding to the index i and period p.

Specified by:
getMeasure in interface MeasureMatrix
Parameters:
i - the index of the measure.
p - the period of the measure.
Returns:
the corresponding value.

getNumMeasures

public int getNumMeasures()
Description copied from interface: MeasureMatrix
Returns the number of measures calculated by the implementation of this interface.

Specified by:
getNumMeasures in interface MeasureMatrix
Returns:
the number of computed values.

getNumPeriods

public int getNumPeriods()
Description copied from interface: MeasureMatrix
Returns the number of periods stored into this matrix of measures.

Specified by:
getNumPeriods in interface MeasureMatrix
Returns:
the number of stored periods.

regroupPeriods

public void regroupPeriods(int x)
Description copied from interface: MeasureMatrix
Increases the length of stored periods by regrouping them. If this method is supported, for p = 0, ..., MeasureMatrix.getNumPeriods()/x - 1, it sums the values for periods xp, ...,xp+x-1, and stores the results in period p whose length will be x times the length of original periods. If the number of periods is not a multiple of x, an additional period is used to contain the remaining sums of values. The unused periods are zeroed for future use. This method can be useful for memory management when using batch means to estimate steady-state performance measures.

Specified by:
regroupPeriods in interface MeasureMatrix
Parameters:
x - the number of periods per group.

setNumMeasures

public void setNumMeasures(int nm)
Description copied from interface: MeasureMatrix
Sets the number of measures to nm. If this method is supported, it can limit the maximal or minimal accepted number of measures.

Specified by:
setNumMeasures in interface MeasureMatrix
Parameters:
nm - the new number of measures.

setNumPeriods

public void setNumPeriods(int np)
Description copied from interface: MeasureMatrix
Sets the number of periods of this matrix to np. If this method is supported, it can limit the maximal or minimal accepted number of periods.

Specified by:
setNumPeriods in interface MeasureMatrix
Parameters:
np - the new number of periods.

ContactCenters
V. 0.9.9.

To submit a bug or ask questions, send an e-mail to Richard Simard.