ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.contactcenters.contact
Class TrunkGroup

java.lang.Object
  extended by umontreal.iro.lecuyer.contactcenters.contact.TrunkGroup
All Implemented Interfaces:
Initializable, Named

public class TrunkGroup
extends Object
implements Initializable, Named

Represents a group of trunks, i.e., phone lines or more generally communication channels, in a contact center. After a contact is constructed, it can be assigned a trunk group using Contact.setTrunkGroup(umontreal.iro.lecuyer.contactcenters.contact.TrunkGroup). When the contact enters the router, a line is allocated. The contact is blocked if a line is not available.


Constructor Summary
TrunkGroup(int capacity)
          Constructs a new trunk group with capacity capacity.
 
Method Summary
 int getCapacity()
          Returns the current capacity of this trunk group.
 String getName()
          Returns the name associated with this object.
 Accumulate getStatCapacity()
          Returns the statistical collector for the capacity of this trunk group through simulation time.
 Accumulate getStatLines()
          Returns the statistical collector for the number of allocated lines through simulation time.
 void init()
          Resets this trunk group, releasing all allocated lines.
 void initStat()
          Initializes the two statistical collectors for the number of lines and the capacity.
 boolean isStatCollecting()
          Determines if this trunk group is collecting statistics about the number of allocated lines and its capacity.
 int lines()
          Returns the current number of allocated lines.
 void release(Contact contact)
          Releases the trunk line allocated by the contact contact.
 void setCapacity(int capacity)
          Changes the capacity to capacity.
 void setName(String name)
          Sets the name of this object to name.
 void setStatCollecting(boolean b)
          Sets the statistical collecting to b.
 void setStatCollecting(Simulator sim)
          Enables statistical collecting, but associates the given simulator to the internal accumulates.
 void setStatCollectiong(Simulator sim)
          Enables statistical collecting, and attach the simulator sim to the internal accumulates.
 boolean take(Contact contact)
          Indicates that the contact contact enters the system and takes one line from this trunk group.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TrunkGroup

public TrunkGroup(int capacity)
Constructs a new trunk group with capacity capacity. The capacity corresponds to the maximum number of allocated lines at any simulation time.

Parameters:
capacity - the total number of lines in the trunk group.
Throws:
IllegalArgumentException - if the capacity is negative.
Method Detail

getCapacity

public int getCapacity()
Returns the current capacity of this trunk group.

Returns:
the current capacity.

setCapacity

public void setCapacity(int capacity)
Changes the capacity to capacity. If the given capacity is negative or smaller than the current number of allocated lines, an IllegalArgumentException is thrown.

Parameters:
capacity - the new capacity.
Throws:
IllegalArgumentException - if capacity is too small or negative.

lines

public int lines()
Returns the current number of allocated lines.

Returns:
the current number of lines.

init

public void init()
Resets this trunk group, releasing all allocated lines. If statistical collecting is enabled, this also calls initStat().

Specified by:
init in interface Initializable

initStat

public void initStat()
Initializes the two statistical collectors for the number of lines and the capacity. If statistical collecting is disabled, this throws an IllegalStateException.

Throws:
IllegalStateException - if statistical collecting is disabled.

take

public boolean take(Contact contact)
Indicates that the contact contact enters the system and takes one line from this trunk group. If all lines are busy, this returns false. Otherwise, this returns true.

Parameters:
contact - the contact allocating the line.
Returns:
the success indicator.

release

public void release(Contact contact)
Releases the trunk line allocated by the contact contact.

Parameters:
contact - the contact releasing the line.

isStatCollecting

public boolean isStatCollecting()
Determines if this trunk group is collecting statistics about the number of allocated lines and its capacity. By default, statistical collecting is turned OFF.

Returns:
the statistical collecting indicator.

setStatCollecting

public void setStatCollecting(boolean b)
Sets the statistical collecting to b. If b is true, the collecting is turned ON. Otherwise, it is turned OFF.

Parameters:
b - the statistical collecting indicator.

setStatCollecting

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

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

setStatCollectiong

public void setStatCollectiong(Simulator sim)
Enables statistical collecting, and attach the simulator sim to the internal accumulates. The given simulator is used to determine the simulation time when the values of the probes are updated.

Parameters:
sim - the given simulator.

getStatCapacity

public Accumulate getStatCapacity()
Returns the statistical collector for the capacity of this trunk group through simulation time. The returned value is non-null only if setStatCollecting(boolean) was called with true.

Returns:
the statistical collector for the capacity of this trunk group.

getStatLines

public Accumulate getStatLines()
Returns the statistical collector for the number of allocated lines through simulation time. The returned value is non-null only if setStatCollecting(boolean) was called with true.

Returns:
the statistical collector for the number of allocated lines.

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 name)
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:
name - the new name of the object.

toString

public String toString()
Overrides:
toString in class Object

ContactCenters
V. 0.9.9.

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