ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.stat.mperiods
Class MeasureSet

java.lang.Object
  extended by umontreal.iro.lecuyer.stat.mperiods.MeasureSet
All Implemented Interfaces:
Cloneable, MeasureMatrix

public class MeasureSet
extends Object
implements MeasureMatrix, Cloneable

Represents a set of related measures computed using different measure matrices. Each measure of such a set corresponds to a measure computed by another matrix. For example, this class can regroup the queue size for different waiting queues. It can compute the sum of the measures for each period, and give statistical collecting mechanisms access to the measures using the MeasureMatrix interface.


Nested Class Summary
static class MeasureSet.MeasureInfo
          Contains information about a measure added to a measure set.
 
Constructor Summary
MeasureSet()
          Constructs a new empty measure set.
 
Method Summary
 void addMeasure(MeasureMatrix mat, int imat)
          Adds the measure imat calculated by mat to this set of measures.
 void clearMeasures()
          Clears all measures contained in this set.
 MeasureSet clone()
           
 double getMeasure(int i, int p)
          Returns the measure i in period p for this matrix.
 MeasureSet.MeasureInfo getMeasureInfo(int i)
          Returns the measure information object for measure i.
 int getNumMeasures()
          Returns the number of supported measures.
 int getNumPeriods()
          Returns the number of supported periods.
 void init()
          This method does nothing in this implementation.
 boolean isComputingSumRow()
          Determines if the measure set contains an additional row containing the sum of each column.
 void regroupPeriods(int x)
          This implementation does not support period regrouping.
 void setComputingSumRow(boolean b)
          Sets the computing sum row indicator to b.
 void setNumMeasures(int nm)
          This implementation does not support changing the number of measures.
 void setNumPeriods(int np)
          This implementation does not support changing the number of periods.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MeasureSet

public MeasureSet()
Constructs a new empty measure set. The addMeasure(umontreal.iro.lecuyer.stat.mperiods.MeasureMatrix, int) method must be used to add some measures.

Method Detail

isComputingSumRow

public boolean isComputingSumRow()
Determines if the measure set contains an additional row containing the sum of each column. If this returns true (the default), the row of sums is computed. Otherwise, it is not computed. The sum row adds one additional measure to the measure set only if the number of measures is greater than 1.

Returns:
the sum row computing indicator.

setComputingSumRow

public void setComputingSumRow(boolean b)
Sets the computing sum row indicator to b. See isComputingSumRow() for more information.

Parameters:
b - the new sum row computing indicator.

addMeasure

public void addMeasure(MeasureMatrix mat,
                       int imat)
Adds the measure imat calculated by mat to this set of measures. It is recommended that every added measure matrix has the same number of periods.

Parameters:
mat - the measure matrix computing the added measure.
imat - the index of the added measure, in mat.
Throws:
NullPointerException - if mat is null.

clearMeasures

public void clearMeasures()
Clears all measures contained in this set.


getMeasureInfo

public MeasureSet.MeasureInfo getMeasureInfo(int i)
Returns the measure information object for measure i.

Returns:
the measure information object.
Throws:
IndexOutOfBoundsException - if i is out of bounds.

getNumMeasures

public int getNumMeasures()
Returns the number of supported measures. If the set contains 0 or 1 measure, this method returns 0 or 1, respectively. If the set contains n > 1 measures, n + 1 is returned if isComputingSumRow() returns true, or n is returned otherwise.

Specified by:
getNumMeasures in interface MeasureMatrix
Returns:
the number of supported measures.

getNumPeriods

public int getNumPeriods()
Returns the number of supported periods. If the set is empty, this returns 0. Otherwise, this returns the maximal number of periods of the contained measure matrices.

Specified by:
getNumPeriods in interface MeasureMatrix
Returns:
the supported number of periods.

setNumMeasures

public void setNumMeasures(int nm)
This implementation does not support changing the number of measures.

Specified by:
setNumMeasures in interface MeasureMatrix
Parameters:
nm - the new number of measures.
Throws:
UnsupportedOperationException - if this method is called.

setNumPeriods

public void setNumPeriods(int np)
This implementation does not support changing the number of periods.

Specified by:
setNumPeriods in interface MeasureMatrix
Parameters:
np - the new number of periods.
Throws:
UnsupportedOperationException - if this method is called.

regroupPeriods

public void regroupPeriods(int x)
This implementation does not support period regrouping.

Specified by:
regroupPeriods in interface MeasureMatrix
Parameters:
x - the number of periods per group.
Throws:
UnsupportedOperationException - if this method is called.

init

public void init()
This method does nothing in this implementation.

Specified by:
init in interface MeasureMatrix

getMeasure

public double getMeasure(int i,
                         int p)
Returns the measure i in period p for this matrix. Let n be the number of measures in this set, i.e., the value of getNumMeasures() if isComputingSumRow() returns false. If i < n, this returns the ith measure added to this set. If i = n, n > 1 and the measure set is computing the sum row, this returns the sum of all the contained measures for period p. Let P be the number of periods as returned by getNumPeriods(). If p is greater than or equal to the number of periods in the queried measure matrix but smaller than P, Double.NaN is returned. In the sum of measures, the NaN value is not counted to avoid a NaN sum.

Specified by:
getMeasure in interface MeasureMatrix
Parameters:
i - the index of the measure.
p - the index of the period.
Returns:
the value of the measure.
Throws:
IndexOutOfBoundsException - if the measure or period indices are out of bounds.

toString

public String toString()
Overrides:
toString in class Object

clone

public MeasureSet clone()
Overrides:
clone in class Object

ContactCenters
V. 0.9.9.

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