ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.contactcenters.queue
Class QueueSizeStat

java.lang.Object
  extended by umontreal.iro.lecuyer.contactcenters.queue.QueueSizeStat
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
QueueSizeStatMeasureMatrix

public class QueueSizeStat
extends Object
implements Cloneable

Computes statistics for a specific waiting queue. Using accumulates, this class can compute the integral of the queue size from the last call to init() to the current simulation time. Optionally, it can also compute the integral of the number of contacts of each type k in queue.


Constructor Summary
QueueSizeStat(Simulator sim, WaitingQueue queue)
          Equivalent to QueueSizeStat(WaitingQueue), using the given simulator sim to construct accumulates.
QueueSizeStat(Simulator sim, WaitingQueue queue, int numTypes)
          Equivalent ot QueueSizeStat(WaitingQueue,int), using the simulator sim to construct accumulates.
QueueSizeStat(WaitingQueue queue)
          Constructs a new queue size statistical probe for the waiting queue queue and only computing aggregate queue size.
QueueSizeStat(WaitingQueue queue, int numTypes)
          Constructs a new queue size statistical probe for the waiting queue queue supporting numTypes contact types.
 
Method Summary
 QueueSizeStat clone()
          Constructs and returns a clone of this queue-size collector.
 int getNumContactTypes()
          Returns the number of contact types supported by this object.
 Accumulate getStatQueueSize()
          Returns the statistical collector for the queue size over the simulation time.
 Accumulate getStatQueueSize(int type)
          Returns the statistical collector for the number of contacts of type type in the queue.
 WaitingQueue getWaitingQueue()
          Returns the waiting queue currently associated with this object.
 void init()
           
 void setSimulator(Simulator sim)
          Sets the simulator attached to internal accumulates to sim.
 void setWaitingQueue(WaitingQueue queue)
          Sets the associated waiting queue to queue.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QueueSizeStat

public QueueSizeStat(WaitingQueue queue)
Constructs a new queue size statistical probe for the waiting queue queue and only computing aggregate queue size. This is equivalent to QueueSizeStat (queue, 0).

Parameters:
queue - the observed waiting queue.

QueueSizeStat

public QueueSizeStat(Simulator sim,
                     WaitingQueue queue)
Equivalent to QueueSizeStat(WaitingQueue), using the given simulator sim to construct accumulates.


QueueSizeStat

public QueueSizeStat(WaitingQueue queue,
                     int numTypes)
Constructs a new queue size statistical probe for the waiting queue queue supporting numTypes contact types.

Parameters:
queue - the observed waiting queue.
numTypes - the supported number of contact types.
Throws:
IllegalArgumentException - if the number of contact types is smaller than 0.

QueueSizeStat

public QueueSizeStat(Simulator sim,
                     WaitingQueue queue,
                     int numTypes)
Equivalent ot QueueSizeStat(WaitingQueue,int), using the simulator sim to construct accumulates.

Method Detail

setSimulator

public void setSimulator(Simulator sim)
Sets the simulator attached to internal accumulates to sim.

Parameters:
sim - the new simulator.
Throws:
NullPointerException - if sim is null.

getWaitingQueue

public final WaitingQueue getWaitingQueue()
Returns the waiting queue currently associated with this object.

Returns:
the currently associated waiting queue.

setWaitingQueue

public final void setWaitingQueue(WaitingQueue queue)
Sets the associated waiting queue to queue. If the given queue is null, the statistical collector is disabled until a non-null waiting queue is given. This can be used during a replication if the integrals must be computed during some periods only.

Parameters:
queue - the new associated waiting queue.

getStatQueueSize

public Accumulate getStatQueueSize()
Returns the statistical collector for the queue size over the simulation time.

Returns:
the queue size statistical collector.

getNumContactTypes

public int getNumContactTypes()
Returns the number of contact types supported by this object.

Returns:
the number of supported contact types.

getStatQueueSize

public Accumulate getStatQueueSize(int type)
Returns the statistical collector for the number of contacts of type type in the queue.

Parameters:
type - the target contact type.
Returns:
the size collector for the target type.
Throws:
ArrayIndexOutOfBoundsException - if type is negative or greater than or equal to the number of supported contact types.

init

public void init()

toString

public String toString()
Overrides:
toString in class Object

clone

public QueueSizeStat clone()
Constructs and returns a clone of this queue-size collector. This method clones the internal statistical collectors, but the clone has no associated waiting queue. This can be used to save the state of the statistical collector for future restoration.

Overrides:
clone in class Object
Returns:
a clone of this object.

ContactCenters
V. 0.9.9.

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