ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.contactcenters.contact
Class ServiceTimesAgent

java.lang.Object
  extended by umontreal.iro.lecuyer.contactcenters.contact.ServiceTimes
      extended by umontreal.iro.lecuyer.contactcenters.contact.ServiceTimesAgent
All Implemented Interfaces:
Cloneable

public class ServiceTimesAgent
extends ServiceTimes

Stores service times for a contact. For each of these types, one may generate a default service time v which applies for all agents, or one service time vaj for each agent j. This class is used to store and retrieve service times, when they are different for each agent. Otherwise, one should use the mother class ServiceTimes, where service times are defined only for groups of agents. For greater efficiency, it is recommended to call methods ensureCapacityForServiceTime before using setServiceTime in order to avoid multiple array reallocations.


Field Summary
 
Fields inherited from class umontreal.iro.lecuyer.contactcenters.contact.ServiceTimes
servTime
 
Constructor Summary
ServiceTimesAgent(double serviceTime)
          Constructs a new container for service times using the default service time serviceTime if no service time was given for a specific agent or group.
 
Method Summary
 void add(ServiceTimes st)
          Adds the service times stored in st to the corresponding service times in this object.
 ServiceTimesAgent clone()
          Clones this object, and its internal arrays of service times.
 void ensureCapacityForServiceTime(int capacity)
          Makes sure that the length of the array containing the vaj's is at least capacity for the number of agents.
 double getServiceTime(int j)
          Returns the service time vaj for contacts served by agent j.
 double[] getServiceTimes()
          Returns the array of service times for all agents.
 boolean isSetServiceTime(int j)
          Determines if a service time was set specifically for agent j by using setServiceTime(int,double).
 void mult(double mult)
          Multiplies each service time v and vaj stored in this object by the given constant mult.
 void set(ServiceTimes st)
          Replaces the service times v, vi's and vaj's stored in this object with the values obtained from st.
 void setServiceTime(int j, double t)
          Sets the service time vaj for contacts served by an agent j to t.
 String toString()
           
 
Methods inherited from class umontreal.iro.lecuyer.contactcenters.contact.ServiceTimes
getServiceTime, setServiceTime
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServiceTimesAgent

public ServiceTimesAgent(double serviceTime)
Constructs a new container for service times using the default service time serviceTime if no service time was given for a specific agent or group.

Parameters:
serviceTime - the default service time v.
Throws:
IllegalArgumentException - if the given service time is negative or NaN.
Method Detail

getServiceTime

public double getServiceTime(int j)
Returns the service time vaj for contacts served by agent j. If this service time was never set, i.e., if isSetServiceTime(int) returns false, this returns the result of ServiceTimes.getServiceTime().

Overrides:
getServiceTime in class ServiceTimes
Parameters:
j - the index of the agent.
Returns:
the service time vaj, or vi if vaj is not set, or v if vi is not set.

getServiceTimes

public double[] getServiceTimes()
Returns the array of service times for all agents.

Overrides:
getServiceTimes in class ServiceTimes
Returns:
the service times of all agents

isSetServiceTime

public boolean isSetServiceTime(int j)
Determines if a service time was set specifically for agent j by using setServiceTime(int,double).

Overrides:
isSetServiceTime in class ServiceTimes
Parameters:
j - the tested agent index.
Returns:
the result of the test.

setServiceTime

public void setServiceTime(int j,
                           double t)
Sets the service time vaj for contacts served by an agent j to t. Note that setting t to Double.NaN unsets the service time for the specified agent.

Overrides:
setServiceTime in class ServiceTimes
Parameters:
j - index of the agent to set.
t - new service time.
Throws:
IllegalArgumentException - if t is negative.

ensureCapacityForServiceTime

public void ensureCapacityForServiceTime(int capacity)
Makes sure that the length of the array containing the vaj's is at least capacity for the number of agents. This method should be called before setServiceTime(int,double) to avoid multiple array reallocations.

Overrides:
ensureCapacityForServiceTime in class ServiceTimes
Parameters:
capacity - the new capacity for the agents.

set

public void set(ServiceTimes st)
Replaces the service times v, vi's and vaj's stored in this object with the values obtained from st.

Overrides:
set in class ServiceTimes
Parameters:
st - the input service times.

add

public void add(ServiceTimes st)
Adds the service times stored in st to the corresponding service times in this object. Let v and vaj, for j = 0,…, be the service times in this object, and w and waj, the service times in st. This method replaces v with v + w; and vaj with vaj + waj for any j such that vaj or waj exists. When vaj or waj does not exists, v or w is used.

Overrides:
add in class ServiceTimes
Parameters:
st - the service times to add to this object.

mult

public void mult(double mult)
Multiplies each service time v and vaj stored in this object by the given constant mult.

Overrides:
mult in class ServiceTimes
Parameters:
mult - the multiplier for service times.
Throws:
IllegalArgumentException - if mult is negative.

clone

public ServiceTimesAgent clone()
Clones this object, and its internal arrays of service times.

Overrides:
clone in class ServiceTimes

toString

public String toString()
Overrides:
toString in class ServiceTimes

ContactCenters
V. 0.9.9.

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