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.stat.mperiods
Class IntegralMeasureMatrixSW<M extends MeasureMatrix>

    java.lang.Object
      umontreal.iro.lecuyer.stat.mperiods.IntegralMeasureMatrix<M>
          umontreal.iro.lecuyer.stat.mperiods.IntegralMeasureMatrixSW<M>

All Implemented Interfaces:
  Cloneable, MeasureMatrix

    public class IntegralMeasureMatrixSW<M extends MeasureMatrix>

extends IntegralMeasureMatrix<M>

This extends `IntegralMeasureMatrix` to add a sliding window for the records. With the base class, the total number of records is limited to the number of periods in the measure matrix. With this class, the number of added records can be greater than the number of periods. If a record is added while all allocated periods are used, the first record is lost and the new one is added. Therefore, the integral can be obtained for the last periods only.

Constructor Summary
`IntegralMeasureMatrixSW(M mat, int numPeriods)` Calls `super` `(mat, numPeriods)`.

Method Summary
`protected SumMatrixSW` | `createSumMatrix(int nm, int np)` This methods creates and returns the internal sum matrix, and is overridden in `IntegralMeasureMatrixSW` to create an instance of `SumMatrixSW` instead.
`int` | `getFirstRealRecord()` Returns the first value p for which a recorded value (tp) is available.
`double` | `getMeasure(int i, int p)` Returns the measure `i` for period `p`.
`int` | `getNumRealRecords()` Returns the total number of times the `newRecord()` method was called since the last call to `IntegralMeasureMatrix.init()` plus one.
`protected int` | `getPeriod()` Returns `mpc.``getNumRealPeriods()`.
`double` | `getSum(int i, int r)` Returns fi(tj), the measure `i` of the associated measure matrix at the simulation time tj, j being `r +` `getFirstRealRecord()`.
`SumMatrixSW` | `getSumMatrix()` Returns the internal sum matrix for which each period p contains the value of (tp).
`void` | `newRecord()` This is the same as in the superclass, but if the number of stored records exceeds the number of real records, the first stored record is discarded.
`void` | `setFirstRealRecord(int firstRealRecord)` Sets the index of the first real record to `firstRealRecord`.
`String` | `toString()`

Methods inherited from class umontreal.iro.lecuyer.stat.mperiods.IntegralMeasureMatrix
`clone, getMeasureMatrix, getNumMeasures, getNumPeriods, getNumStoredRecords, init, regroupPeriods, setMeasureMatrix, setNumMeasures, setNumPeriods`

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

Constructor Detail

### IntegralMeasureMatrixSW

    public IntegralMeasureMatrixSW(M mat,
                                   int numPeriods)

  Calls `super` `(mat, numPeriods)`.

Method Detail

### createSumMatrix

    protected SumMatrixSW createSumMatrix(int nm,
                                          int np)

  Description copied from class: `IntegralMeasureMatrix`
  This methods creates and returns the internal sum matrix, and is overridden in `IntegralMeasureMatrixSW` to create an instance of `SumMatrixSW` instead.

  Overrides:
    `createSumMatrix` in class `IntegralMeasureMatrix<M extends MeasureMatrix>`
  Parameters:
    `nm` - the number of measures.
    `np` - the number of periods.

### getSumMatrix

    public SumMatrixSW getSumMatrix()

  Description copied from class: `IntegralMeasureMatrix`
  Returns the internal sum matrix for which each period p contains the value of (tp). The number of measures of this matrix is `IntegralMeasureMatrix.getNumMeasures()` while the number of periods is one more than `IntegralMeasureMatrix.getNumPeriods()`.

  Overrides:
    `getSumMatrix` in class `IntegralMeasureMatrix<M extends MeasureMatrix>`
  Returns:
    the internal matrix of sums.

### getFirstRealRecord

    public int getFirstRealRecord()

  Returns the first value p for which a recorded value (tp) is available. If no recorded value is lost, this returns 0.

  Returns:
    the first value of p for which (tp) is available.

### setFirstRealRecord

    public void setFirstRealRecord(int firstRealRecord)

  Sets the index of the first real record to `firstRealRecord`.

  Parameters:
    `firstRealRecord` - the index of the first real record.
  Throws:
    `IllegalArgumentException` - if `firstRealRecord` is negative.

### getNumRealRecords

    public int getNumRealRecords()

  Returns the total number of times the `newRecord()` method was called since the last call to `IntegralMeasureMatrix.init()` plus one. If the returned value exceeds the number of stored records (`IntegralMeasureMatrix.getNumStoredRecords()`), only the values of (t) for the last `IntegralMeasureMatrix.getNumStoredRecords()` are accessible; the first values are then lost.

  Returns:
    the total number of records.

### newRecord

    public void newRecord()

  This is the same as in the superclass, but if the number of stored records exceeds the number of real records, the first stored record is discarded.

  Overrides:
    `newRecord` in class `IntegralMeasureMatrix<M extends MeasureMatrix>`

### getPeriod

    protected int getPeriod()

  Returns `mpc.``getNumRealPeriods()`.

  Overrides:
    `getPeriod` in class `IntegralMeasureMatrix<M extends MeasureMatrix>`
  Returns:
    the period used by `IntegralMeasureMatrix.newRecord()`.

### getSum

    public double getSum(int i,
                         int r)

  Returns fi(tj), the measure `i` of the associated measure matrix at the simulation time tj, j being `r +` `getFirstRealRecord()`.

  Overrides:
    `getSum` in class `IntegralMeasureMatrix<M extends MeasureMatrix>`
  Parameters:
    `i` - the measure index.
    `r` - the record index.
  Returns:
    the value of the measure.
  Throws:
    `IndexOutOfBoundsException` - if `i` or `r` are out of bounds.

### getMeasure

    public double getMeasure(int i,
                             int p)

  Returns the measure `i` for period `p`. This corresponds to fi(ts+p+1) - fi(ts+p) where ts+p is the simulation time of the stored record p, and s is the result of `getFirstRealRecord()`.

  Specified by:
    `getMeasure` in interface `MeasureMatrix`
  Overrides:
    `getMeasure` in class `IntegralMeasureMatrix<M extends MeasureMatrix>`
  Parameters:
    `i` - the index of the measure.
    `p` - the period of the measure.
  Returns:
    the corresponding value.
  Throws:
    `IndexOutOfBoundsException` - if `i` or `p` are negative or greater than or equal to the number of measures or the number of periods, respectively.

### toString

    public String toString()

  Overrides:
    `toString` in class `IntegralMeasureMatrix<M extends MeasureMatrix>`

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.