ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.contactcenters.queue
Class WaitingQueueSet

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<WaitingQueue>
          extended by umontreal.iro.lecuyer.contactcenters.queue.WaitingQueueSet
All Implemented Interfaces:
Cloneable, Iterable<WaitingQueue>, Collection<WaitingQueue>, Set<WaitingQueue>, Initializable, Named

public class WaitingQueueSet
extends AbstractSet<WaitingQueue>
implements Initializable, Named, Cloneable

Represents a group of waiting queues for which it is possible to get the total size. This can be used when the total number of contacts in a subset of the contact center's waiting queues is needed for statistical collecting or for capacity limitation.


Constructor Summary
WaitingQueueSet()
           
 
Method Summary
 boolean add(WaitingQueue queue)
          Adds the waiting queue queue to this set of waiting queues.
 void clear()
          Removes all the waiting queues contained in this set of waiting queues.
 WaitingQueueSet clone()
          Constructs and returns a copy of this set of waiting queues.
 boolean contains(Object o)
           
 String getName()
          Returns the name associated with this object.
 Accumulate getStatQueueSize()
          Returns the statistical collector for the size of the queues in the set.
 void init()
          Initializes all the waiting queues contained in this set.
 void initStat()
          Initializes the statistical collector for the size of the queues in this set.
 boolean isEmpty()
           
 boolean isStatCollecting()
          Determines if this set of waiting queues is collecting statistics about the total size of the queues.
 Iterator<WaitingQueue> iterator()
           
 int queueSize()
          Returns the total size of the queues currently in this group of waiting queues.
 boolean remove(Object queue)
          Removes the waiting queue queue from this set of waiting queues.
 void setName(String n)
          Sets the name of this object to name.
 void setStatCollecting(boolean b)
          Sets the state of statistical collecting to b.
 void setStatCollecting(Simulator sim)
          Enables statistical collecting, but associates the given simulator to the internal accumulate.
 int size()
           
 String toString()
           
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll, containsAll, retainAll, toArray, toArray
 

Constructor Detail

WaitingQueueSet

public WaitingQueueSet()
Method Detail

getName

public String getName()
Description copied from interface: Named
Returns the name associated with this object. If no name was set, this must return an empty string, not null.

Specified by:
getName in interface Named
Returns:
the name of this object.

setName

public void setName(String n)
Description copied from interface: Named
Sets the name of this object to name. The given name cannot be null and the implementation can throw an UnsupportedOperationException if the name is read-only.

Specified by:
setName in interface Named
Parameters:
n - the new name of the object.

queueSize

public int queueSize()
Returns the total size of the queues currently in this group of waiting queues.

Returns:
the size of all contained queues.

add

public boolean add(WaitingQueue queue)
Adds the waiting queue queue to this set of waiting queues.

Specified by:
add in interface Collection<WaitingQueue>
Specified by:
add in interface Set<WaitingQueue>
Overrides:
add in class AbstractCollection<WaitingQueue>
Parameters:
queue - the waiting queue being added.
Throws:
NullPointerException - if queue is null.

size

public int size()
Specified by:
size in interface Collection<WaitingQueue>
Specified by:
size in interface Set<WaitingQueue>
Specified by:
size in class AbstractCollection<WaitingQueue>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection<WaitingQueue>
Specified by:
isEmpty in interface Set<WaitingQueue>
Overrides:
isEmpty in class AbstractCollection<WaitingQueue>

contains

public boolean contains(Object o)
Specified by:
contains in interface Collection<WaitingQueue>
Specified by:
contains in interface Set<WaitingQueue>
Overrides:
contains in class AbstractCollection<WaitingQueue>

iterator

public Iterator<WaitingQueue> iterator()
Specified by:
iterator in interface Iterable<WaitingQueue>
Specified by:
iterator in interface Collection<WaitingQueue>
Specified by:
iterator in interface Set<WaitingQueue>
Specified by:
iterator in class AbstractCollection<WaitingQueue>

remove

public boolean remove(Object queue)
Removes the waiting queue queue from this set of waiting queues.

Specified by:
remove in interface Collection<WaitingQueue>
Specified by:
remove in interface Set<WaitingQueue>
Overrides:
remove in class AbstractCollection<WaitingQueue>
Parameters:
queue - the waiting queue being removed.
Throws:
NullPointerException - if queue is null.

clear

public void clear()
Removes all the waiting queues contained in this set of waiting queues.

Specified by:
clear in interface Collection<WaitingQueue>
Specified by:
clear in interface Set<WaitingQueue>
Overrides:
clear in class AbstractCollection<WaitingQueue>

init

public void init()
Initializes all the waiting queues contained in this set.

Specified by:
init in interface Initializable

initStat

public void initStat()
Initializes the statistical collector for the size of the queues in this set. If statistical collecting is turned OFF, this throws an IllegalStateException.

Throws:
IllegalStateException - if statistical collecting is turned OFF.

isStatCollecting

public boolean isStatCollecting()
Determines if this set of waiting queues is collecting statistics about the total size of the queues. If this returns true, statistical collecting is turned ON. Otherwise (the default), it is turned OFF.

Returns:
the state of statistical collecting.

setStatCollecting

public void setStatCollecting(boolean b)
Sets the state of statistical collecting to b. If b is true, statistical collecting is turned ON. The statistical collectors are created or reinitialized. If b is false, statistical collecting is turned OFF.

Parameters:
b - the new state of statistical collecting.

setStatCollecting

public void setStatCollecting(Simulator sim)
Enables statistical collecting, but associates the given simulator to the internal accumulate.

Parameters:
sim - the simulator associated to the internal accumulate.

getStatQueueSize

public Accumulate getStatQueueSize()
Returns the statistical collector for the size of the queues in the set. This returns a non-null value only if statistical collecting was turned ON since this object was constructed.

Returns:
the queue size statistical collector.

toString

public String toString()
Overrides:
toString in class AbstractCollection<WaitingQueue>

clone

public WaitingQueueSet clone()
Constructs and returns a copy of this set of waiting queues. This method clones the internal set of waiting queues as well as the statistical collectors if they exist. This does not clone the waiting queues themselves.

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.