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 MinValueGenerator

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

All Implemented Interfaces:
  Initializable, ValueGenerator

    public class MinValueGenerator

extends Object
implements ValueGenerator

Value generator for the minimum of values. This value generator defines an internal array of value generators used by the `nextDouble(umontreal.iro.lecuyer.contactcenters.contact.Contact)` method. When `nextDouble(umontreal.iro.lecuyer.contactcenters.contact.Contact)` is called, a value is generated using all registered value generators and the minimum value, generated by v[j*], is returned. It is also possible to get the index j* of the value generator having returned the minimum as well as all the generated values. This class is used by waiting queues and agent groups to generate the maximal queue times and service times.

Constructor Summary
`MinValueGenerator()` Constructs a minimum value generator with no registered internal value generator.
`MinValueGenerator(int initialLength)` Constructs a minimum value generator with an internal array of value generators containing `initialLength` elements.

Method Summary
`void` | `compact()` Recreates the internal array of value generators for its length to correspond to `getMaxVType()`.
`double` | `getLastValue()` Returns the last value returned by `nextDouble(umontreal.iro.lecuyer.contactcenters.contact.Contact)`.
`double` | `getLastValue(int vType)` Returns the value generated by `getValueGenerator` `(vType)` upon the last call to `nextDouble(umontreal.iro.lecuyer.contactcenters.contact.Contact)` if `isKeepingValues()` returns `true`, or throws an `IllegalStateException`.
`double[]` | `getLastValues()` Returns all the generated values upon the last call to `nextDouble(umontreal.iro.lecuyer.contactcenters.contact.Contact)` if `isKeepingValues()` returns `true`, or throws an `IllegalStateException`.
`int` | `getLastVType()` Returns the value type for the last value.
`int` | `getMaxVType()` Returns the maximum index (non-inclusive) for which `getValueGenerator(int)` returns a non-`null` value.
`ValueGenerator` | `getValueGenerator(int vType)` Returns the value generator corresponding to value type `vType`.
`void` | `init()` Initializes all the associated value generators.
`boolean` | `isKeepingValues()` Determines if the value generator is keeping all the generated values used to compute the last minimum.
`double` | `nextDouble(Contact contact)` Generates and returns a new value for the contact `contact`.
`void` | `setKeepingValues(boolean k)` Sets the keeping-values indicator to `k`.
`void` | `setValueGenerator(int vType, ValueGenerator vgen)` Sets the value generator corresponding to value type `vType` to `vgen`.

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

Constructor Detail

### MinValueGenerator

    public MinValueGenerator()

  Constructs a minimum value generator with no registered internal value generator.

### MinValueGenerator

    public MinValueGenerator(int initialLength)

  Constructs a minimum value generator with an internal array of value generators containing `initialLength` elements.

  Parameters:
    `initialLength` - the number of elements in the internal array.

Method Detail

### compact

    public void compact()

  Recreates the internal array of value generators for its length to correspond to `getMaxVType()`.

### getMaxVType

    public int getMaxVType()

  Returns the maximum index (non-inclusive) for which `getValueGenerator(int)` returns a non-`null` value.

  Returns:
    the highest index of registered value generators.

### getValueGenerator

    public ValueGenerator getValueGenerator(int vType)

  Returns the value generator corresponding to value type `vType`.

  Parameters:
    `vType` - the queried value type.
  Returns:
    the associated value generator.

### setValueGenerator

    public void setValueGenerator(int vType,
                                  ValueGenerator vgen)

  Sets the value generator corresponding to value type `vType` to `vgen`.

  Since the value generators are stored in an internal array, it is recommended to use small value types. This will avoid the creation of large arrays of `null`'s.

  Parameters:
    `vType` - the affected value type.
    `vgen` - the new value generator.

### isKeepingValues

    public boolean isKeepingValues()

  Determines if the value generator is keeping all the generated values used to compute the last minimum.

  Returns:
    the generated values keeping indicator.

### setKeepingValues

    public void setKeepingValues(boolean k)

  Sets the keeping-values indicator to `k`.

  Parameters:
    `k` - the new keeping-values indicator.

### init

    public void init()

  Initializes all the associated value generators.

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

### nextDouble

    public double nextDouble(Contact contact)

  Generates and returns a new value for the contact `contact`. For each associated value generator, this method calls `nextDouble` and returns the minimal value. If there is no associated value generator, `Double.NaN` is returned.

  Specified by:
    `nextDouble` in interface `ValueGenerator`
  Parameters:
    `contact` - the contact for which a value is generated.
  Returns:
    the generated value.

### getLastValue

    public double getLastValue()

  Returns the last value returned by `nextDouble(umontreal.iro.lecuyer.contactcenters.contact.Contact)`.

  Returns:
    the last generated value.

### getLastVType

    public int getLastVType()

  Returns the value type for the last value. This corresponds to the index of the value generator, as returned by `getValueGenerator(int)`, having generated the chosen minimal value.

  Returns:
    the index of the minimal value.

### getLastValues

    public double[] getLastValues()

  Returns all the generated values upon the last call to `nextDouble(umontreal.iro.lecuyer.contactcenters.contact.Contact)` if `isKeepingValues()` returns `true`, or throws an `IllegalStateException`. The length of the returned array corresponds to `getMaxVType()`.

  Returns:
    the generated values.
  Throws:
    `IllegalStateException` - if the object does not keep generated values.

### getLastValue

    public double getLastValue(int vType)

  Returns the value generated by `getValueGenerator` `(vType)` upon the last call to `nextDouble(umontreal.iro.lecuyer.contactcenters.contact.Contact)` if `isKeepingValues()` returns `true`, or throws an `IllegalStateException`. If the associated value generator is `null`, `Double.NaN` is returned.

  Parameters:
    `vType` - the queried value type.
  Returns:
    the generated value.
  Throws:
    `IllegalStateException` - if the object does not keep generated values.
    `ArrayIndexOutOfBoundsException` - if `vType` is negative or greater than or equal to `getMaxVType()`.

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.