Overview | Package | Class | Tree | Deprecated | Index | Help
| ContactCenters V. 0.9.9.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## umontreal.iro.lecuyer.contactcenters.contact
Class ServiceTimes

    java.lang.Object
      umontreal.iro.lecuyer.contactcenters.contact.ServiceTimes

All Implemented Interfaces:
  Cloneable

Direct Known Subclasses:
  ServiceTimesAgent

    public class ServiceTimes

extends Object
implements Cloneable

Stores service times for a contact. By default, there are two types of service times: contact times and after-contact times. However, a model can define additional types of service times. For each of these types, one may generate a default service time v which applies for all agents, one service time vi for each agent group i. This class can be used to store and retrieve such service times. For greater efficiency, it is recommended to call method `ensureCapacityForServiceTime` before using `setServiceTime` in order to avoid multiple array reallocations.

Field Summary
`protected double` | `servTime`

Constructor Summary
`ServiceTimes(double serviceTime)` Constructs a new container for service times using the default service time `serviceTime`.

Method Summary
`void` | `add(ServiceTimes st)` Adds the service times stored in `st` to the corresponding service times in this object.
`ServiceTimes` | `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 vi's is at least `capacity` for the number of groups.
`double` | `getServiceTime()` Returns the default service time v for this object.
`double` | `getServiceTime(int i)` Returns the service time vi for contacts served by an agent in group `i`.
`double[]` | `getServiceTimes()` Returns the array of service times for all groups.
`boolean` | `isSetServiceTime(int i)` Determines if a service time was set specifically for agent group `i`, by using `setServiceTime(int,double)`.
`void` | `mult(double mult)` Multiplies each service time v and vi stored in this object by the given constant `mult`.
`void` | `set(ServiceTimes st)` Replaces the service times v and vi's stored in this object with the values obtained from `st`.
`void` | `setServiceTime(double serviceTime)` Sets the default service time v of this object to `serviceTime`.
`void` | `setServiceTime(int i, double t)` Sets the service time vi for contacts served by an agent in group `i` to `t`.
`String` | `toString()`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### servTime

    protected double servTime

Constructor Detail

### ServiceTimes

    public ServiceTimes(double serviceTime)

  Constructs a new container for service times using the default service time `serviceTime`. It is used when no service time is given for a specific agent 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()

  Returns the default service time v for this object.

  Returns:
    the default service time.

### setServiceTime

    public void setServiceTime(double serviceTime)

  Sets the default service time v of this object to `serviceTime`.

  Parameters:
    `serviceTime` - the new default service time.
  Throws:
    `IllegalArgumentException` - if the given service time is negative or NaN.

### getServiceTime

    public double getServiceTime(int i)

  Returns the service time vi for contacts served by an agent in group `i`. If this service time was never set, i.e., if `isSetServiceTime(int)` returns `false`, this returns the result of `getServiceTime()`.

  Parameters:
    `i` - the index of the agent group.
  Returns:
    the service time vi, or v if vi is not set.

### getServiceTimes

    public double[] getServiceTimes()

  Returns the array of service times for all groups.

  Returns:
    the service times of all groups

### isSetServiceTime

    public boolean isSetServiceTime(int i)

  Determines if a service time was set specifically for agent group `i`, by using `setServiceTime(int,double)`.

  Parameters:
    `i` - the tested agent group index.
  Returns:
    the result of the test.

### setServiceTime

    public void setServiceTime(int i,
                               double t)

  Sets the service time vi for contacts served by an agent in group `i` to `t`. Note that setting `t` to `Double.NaN` unsets the service time for the specified agent group.

  Parameters:
    `i` - the index of the agent group to set.
    `t` - the 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 vi's is at least `capacity` for the number of groups. This method should be called before `setServiceTime(int,double)` to avoid multiple array reallocations.

  Parameters:
    `capacity` - the new capacity for the groups

### set

    public void set(ServiceTimes st)

  Replaces the service times v and vi's stored in this object with the values obtained from `st`.

  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 vi for i = 0,…, be the service times in this object, and w and wi, the service times in `st`. This method replaces v with v + w; and vi with vi + wi for any i such that vi or wi exists. When vi or wi does not exists, v or w is used.

  Parameters:
    `st` - the service times to add to this object.

### mult

    public void mult(double mult)

  Multiplies each service time v and vi stored in this object by the given constant `mult`.

  Parameters:
    `mult` - the multiplier for service times.
  Throws:
    `IllegalArgumentException` - if `mult` is negative.

### clone

    public ServiceTimes clone()

  Clones this object, and its internal arrays of service times.

  Overrides:
    `clone` in class `Object`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
| ContactCenters V. 0.9.9.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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