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
Class RandomValueGenerator

    java.lang.Object
      umontreal.iro.lecuyer.contactcenters.RandomValueGenerator

All Implemented Interfaces:
  Initializable, ValueGenerator

    public class RandomValueGenerator

extends Object
implements ValueGenerator

Implements the `ValueGenerator` interface when the values come from a continuous and possibly non-stationary distribution. For each period and contact type, a different random variate generator can be used to get a value. This class can be instantiated the same way a `ConstantValueGenerator` is constructed, replacing constants with random variate generators.

Constructor Summary
`RandomValueGenerator(int numTypes, RandomVariateGen gen)` Constructs a new random stationary value generator with generator `gen` for each contact type, and supporting `numTypes` contact types.
`RandomValueGenerator(PeriodChangeEvent pce, int numTypes, RandomVariateGen[] gens)` Constructs a new random value generator with period-change event `pce`, generator `gens[p]` for period `p`, and supporting `numTypes` contact types.
`RandomValueGenerator(PeriodChangeEvent pce, RandomVariateGen[][] gens)` Constructs a new random value generator with period-change event `pce` and random variate generators `gens`.
`RandomValueGenerator(RandomVariateGen[] gens)` Constructs a new random stationary value generator with generator `gens[k]` for contact type `k`.

Method Summary
`RandomVariateGen[][]` | `getRandomVariateGens()` Returns the array of random variate generators associated with this object.
`void` | `init()` Initializes the generator at the beginning of the simulation.
`double` | `nextDouble(Contact contact)` Generates and returns a new value for the contact `contact`.
`void` | `setRandomVariateGens(RandomVariateGen[][] gens)` Sets the random variate generators for this object to `gens`.
`String` | `toString()`

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

Constructor Detail

### RandomValueGenerator

    public RandomValueGenerator(int numTypes,
                                RandomVariateGen gen)

  Constructs a new random stationary value generator with generator `gen` for each contact type, and supporting `numTypes` contact types.

  Parameters:
    `numTypes` - the number of supported contact types.
    `gen` - the random variate generator used for all contact types.

### RandomValueGenerator

    public RandomValueGenerator(RandomVariateGen[] gens)

  Constructs a new random stationary value generator with generator `gens[k]` for contact type `k`.

  Parameters:
    `gens` - the random variate generators used by this object.

### RandomValueGenerator

    public RandomValueGenerator(PeriodChangeEvent pce,
                                int numTypes,
                                RandomVariateGen[] gens)

  Constructs a new random value generator with period-change event `pce`, generator `gens[p]` for period `p`, and supporting `numTypes` contact types.

  Parameters:
    `pce` - the associated period-change event.
    `numTypes` - the number of supported contact types.
    `gens` - the array containing a generator for each period.
  Throws:
    `IllegalArgumentException` - if a generator is not specified for each period.

### RandomValueGenerator

    public RandomValueGenerator(PeriodChangeEvent pce,
                                RandomVariateGen[][] gens)

  Constructs a new random value generator with period-change event `pce` and random variate generators `gens`. For the period `p` and contact type `k`, the random variate generator `gens[p][k]` is used.

  Parameters:
    `pce` - the associated period-change event.
    `gens` - the array of generators for each period and contact type.
  Throws:
    `IllegalArgumentException` - if an array of generators is not specified for each period.

Method Detail

### getRandomVariateGens

    public RandomVariateGen[][] getRandomVariateGens()

  Returns the array of random variate generators associated with this object. The format of this array is the same as the array passed to `RandomValueGenerator(PeriodChangeEvent,RandomVariateGen[][])`.

  Returns:
    the random variate generators for this object.

### setRandomVariateGens

    public void setRandomVariateGens(RandomVariateGen[][] gens)

  Sets the random variate generators for this object to `gens`. This method can be used to change the number of supported contact types, but it cannot be used to change the number of periods.

  Parameters:
    `gens` - the new random variate generators for this object.
  Throws:
    `IllegalArgumentException` - if the length of the given array is incorrect.

### nextDouble

    public double nextDouble(Contact contact)

  Description copied from interface: `ValueGenerator`
  Generates and returns a new value for the contact `contact`. If `contact` is `null` and this is not allowed by the implementation, this method should throw a `NullPointerException`.

  Specified by:
    `nextDouble` in interface `ValueGenerator`
  Parameters:
    `contact` - the contact being concerned.
  Returns:
    the generated value.

### init

    public void init()

  Description copied from interface: `ValueGenerator`
  Initializes the generator at the beginning of the simulation.

  Specified by:
    `init` in interface `Initializable`
  Specified by:
    `init` in interface `ValueGenerator`

### 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.