ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.contactcenters.contact
Class ContactSumMatrix

java.lang.Object
  extended by umontreal.iro.lecuyer.stat.mperiods.SumMatrix
      extended by umontreal.iro.lecuyer.contactcenters.contact.ContactSumMatrix
All Implemented Interfaces:
Cloneable, MeasureMatrix

public class ContactSumMatrix
extends SumMatrix

This sum matrix can be used to compute contact-related observations. It defines one measure type for each contact type as well as one aggregate measure. When the supported number of contact types is 1, it computes the aggregate sum only. When the supported number of contact types is greater than 1, it computes a sum specific for each type as well as the aggregate sum. If one does not require the sum row, one can use a SumMatrix instead.


Field Summary
 
Fields inherited from class umontreal.iro.lecuyer.stat.mperiods.SumMatrix
count, numPeriods, numStoredPeriods, numTypes
 
Constructor Summary
ContactSumMatrix(int numTypes)
          Constructs a new contact sum matrix for numTypes contact types and one period.
ContactSumMatrix(int numTypes, int numPeriods)
          Constructs a new contact sum matrix for numTypes contact types and numPeriods periods.
ContactSumMatrix(PeriodChangeEvent pce, int numTypes)
          Constructs a new contact sum matrix with period change event pce and for numTypes contact types.
 
Method Summary
 void add(Contact contact, double x)
          Equivalent to add (contact.getTypeId(), period, x) where period is the period at which the contact arrived.
 void add(Contact contact, int period, double x)
          Equivalent to add (contact.getTypeId(), period, x).
 void add(int type, int period, double x)
          Adds a new observation x for contact type type in the period period.
 void setNumMeasures(int nm)
          Sets the number of measures to nm.
 String toString()
           
 
Methods inherited from class umontreal.iro.lecuyer.stat.mperiods.SumMatrix
add, clone, getMeasure, getNumMeasures, getNumPeriods, getNumStoredPeriods, getPeriod, init, regroupPeriods, regroupPeriods, set, setNumPeriods
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ContactSumMatrix

public ContactSumMatrix(int numTypes)
Constructs a new contact sum matrix for numTypes contact types and one period.

Parameters:
numTypes - the number of contact types.
Throws:
IllegalArgumentException - if the number of contact types is negative or 0.

ContactSumMatrix

public ContactSumMatrix(PeriodChangeEvent pce,
                        int numTypes)
Constructs a new contact sum matrix with period change event pce and for numTypes contact types. The number of periods is determined by using PeriodChangeEvent.getNumPeriods().

Parameters:
pce - the period change event.
numTypes - the number of contact types.
Throws:
IllegalArgumentException - if the number of contact types is negative or 0.
NullPointerException - if pce is null.

ContactSumMatrix

public ContactSumMatrix(int numTypes,
                        int numPeriods)
Constructs a new contact sum matrix for numTypes contact types and numPeriods periods.

Parameters:
numTypes - the number of contact types.
numPeriods - the number of periods.
Throws:
IllegalArgumentException - if the number of contact types or periods is negative or 0.
Method Detail

setNumMeasures

public void setNumMeasures(int nm)
Description copied from class: SumMatrix
Sets the number of measures to nm. If nm is greater than SumMatrix.getNumMeasures(), new measures are added and initialized to 0. If nm is smaller than SumMatrix.getNumMeasures(), the last SumMatrix.getNumMeasures() - nm measures are removed. Otherwise, nothing happens.

Specified by:
setNumMeasures in interface MeasureMatrix
Overrides:
setNumMeasures in class SumMatrix
Parameters:
nm - the new number of measures.

add

public void add(Contact contact,
                double x)
Equivalent to add (contact.getTypeId(), period, x) where period is the period at which the contact arrived. If no period change event was associated with this object, the period is always 0.

Parameters:
contact - the contact to which the observation is related.
x - the value being added.
Throws:
NullPointerException - if contact is null.

add

public void add(Contact contact,
                int period,
                double x)
Equivalent to add (contact.getTypeId(), period, x).

Parameters:
contact - the contact to which the observation is related.
period - the period the observation is added to.
x - the value being added.
Throws:
NullPointerException - if contact is null.

add

public void add(int type,
                int period,
                double x)
Adds a new observation x for contact type type in the period period. If the object supports only one contact type, this will add one observation in the measure 0 of the matrix, independently of the contact type identifier. Otherwise, an observation is added in the measure corresponding the contact type as well as in the last measure for the aggregate sum. Even if the contact type identifier cannot be mapped to a valid measure index, the observation is added to the last row.

Overrides:
add in class SumMatrix
Parameters:
type - the contact type of the new observation.
period - the period of the new observation.
x - the value being added.
Throws:
ArrayIndexOutOfBoundsException - if type or period are negative or greater than or equal to the number of supported contact types or periods.

toString

public String toString()
Overrides:
toString in class SumMatrix

ContactCenters
V. 0.9.9.

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