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.msk.model
Class CallCenterUtil

    java.lang.Object
      umontreal.iro.lecuyer.contactcenters.msk.model.CallCenterUtil

    public class CallCenterUtil

extends Object

Provides helper static methoeds used for the initialization of call center models.

Method Summary
`static String` | `getAgentGroupInfo(CallCenterParams ccParams, int i)` Similar to `getCallTypeInfo(CallCenterParams,int)`, for agent group `i`.
`static String` | `getCallTypeInfo(CallCenterParams ccParams, int k)` Returns information about a call type `k` defined in call center parameters `ccParams`.
`static GregorianCalendar` | `getDate(XMLGregorianCalendar xgcal)` Converts the given XML gregorian calendar into a Java gregorian calendar, with time reset to midnight relative to the timezone given in the XML gregorian calendar.
`static double[]` | `getDoubleArray(double[] array, int numPeriods)` Similar to `getIntArray(int[],int)`, for an array of double-precision values.
`static int[]` | `getIntArray(int[] array, int numPeriods)` Constructs and returns an array containing `numPeriods` elements from the input array `array`.
`static long` | `getTimeInMillis(XMLGregorianCalendar xgcal)` Returns the time duration, in milliseconds, elapsed between midnight and the time given by `xgcal`, at the date set by `xgcal`.
`static
`<K> Map<K,String>`
` | `toStringValues(Map<? extends K,? extends Object> map)` Constructs and returns a map for which each entry (k, v') is created from entry (k, v) in map `map`, where k is a key, and v' is the string representation of the value v.

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

Method Detail

### getIntArray

    public static int[] getIntArray(int[] array,
                                    int numPeriods)

  Constructs and returns an array containing `numPeriods` elements from the input array `array`. If the length of the given array is 0, this returns an empty array. Otherwise, if the length is 1, this returns an array of length `numPeriods` filled with `array[0]`. Otherwise, an array with the first `numPeriods` elements of `array` is constructed and returned.

  Parameters:
    `array` - the input array.
    `numPeriods` - the number of elements in the output array.
  Returns:
    the output array.
  Throws:
    `IllegalArgumentException` - if the given array is too short.

### getDoubleArray

    public static double[] getDoubleArray(double[] array,
                                          int numPeriods)

  Similar to `getIntArray(int[],int)`, for an array of double-precision values.

  Parameters:
    `array` - the input array.
    `numPeriods` - the number of elements in the output array.
  Returns:
    the output array.
  Throws:
    `IllegalArgumentException` - if the given array is too short.

### getDate

    public static GregorianCalendar getDate(XMLGregorianCalendar xgcal)

  Converts the given XML gregorian calendar into a Java gregorian calendar, with time reset to midnight relative to the timezone given in the XML gregorian calendar. If `xgcal` does not specify a timezone offset, the default offset of the system is used. If `xgcal` is `null`, the current date is used.

  This method first creates a Java `GregorianCalendar` by using `XMLGregorianCalendar.toGregorianCalendar()` (this uses the default timezone offset if no offset was specified explicitly), or the no-argument constructor of `GregorianCalendar` if `xgcal` is `null` (this creates a calendar initialized to the current date and time). It then resets the time fields of the created calendar to midnight before returning it.

  Parameters:
    `xgcal` - the XML gregorian calendar to be converted to a date.
  Returns:
    the gregorian calendar representing the date.

### getTimeInMillis

    public static long getTimeInMillis(XMLGregorianCalendar xgcal)

  Returns the time duration, in milliseconds, elapsed between midnight and the time given by `xgcal`, at the date set by `xgcal`. This method uses `XMLGregorianCalendar.toGregorianCalendar(TimeZone,Locale,XMLGregorianCalendar)` with a default timezone corresponding to GMT, the default locale, and no default XML gregorian calendar. It then clears all fields of the resulting calendar corresponding to date components, and returns `Calendar.getTimeInMillis()`. If `xgcal` is `null`, this returns 0.

  Parameters:
    `xgcal` - the XML gregorian calendar.
  Returns:
    the time in milliseconds.

### getCallTypeInfo

    public static String getCallTypeInfo(CallCenterParams ccParams,
                                         int k)

  Returns information about a call type `k` defined in call center parameters `ccParams`. This method returns a string of the form `call type k (name)` which is included in some error messages.

  Parameters:
    `ccParams` - the call center parameters.
    `k` - the index of the call type.
  Returns:
    the string representation for the call type.

### getAgentGroupInfo

    public static String getAgentGroupInfo(CallCenterParams ccParams,
                                           int i)

  Similar to `getCallTypeInfo(CallCenterParams,int)`, for agent group `i`. This method returns a string of the form `agent group i (name)` included in some error messages.

  Parameters:
    `ccParams` - the call center parameters.
    `i` - the index of the agent group.
  Returns:
    the string representation of the agent group.

### toStringValues

    public static <K> Map<K,String> toStringValues(Map<? extends K,? extends Object> map)

  Constructs and returns a map for which each entry (k, v') is created from entry (k, v) in map `map`, where k is a key, and v' is the string representation of the value v. The string representation of v is the string ```null`'' if v is `null`, or the result of `v.toString()` if v is non-`null`.

  Type Parameters:
    `K` - the type of keys in the maps.
  Parameters:
    `map` - the source map.
  Returns:
    the map with string representations as values.

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.