Class Distribution.FrequencyAndObject<O>

java.lang.Object
org.opentrafficsim.core.distributions.Distribution.FrequencyAndObject<O>
Type Parameters:
O - Type of the object returned by the draw method
All Implemented Interfaces:
Serializable
Enclosing class:
Distribution<O>

public static class Distribution.FrequencyAndObject<O> extends Object implements Serializable
Immutable storage for a frequency (or probability) plus a Generator.

Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands.
All rights reserved.
BSD-style license. See OpenTrafficSim License.

Author:
Alexander Verbraeck, Peter Knoppers
See Also:
  • Constructor Details

    • FrequencyAndObject

      public FrequencyAndObject(double frequency, O object)
      Construct a new FrequencyAndObject instance.
      Parameters:
      frequency - double; the (not cumulative) frequency (or probability) of the generatingObject
      object - O; an object
  • Method Details

    • getFrequency

      public final double getFrequency()
      Retrieve the frequency (or probability) of this FrequencyAndObject.
      Returns:
      double; the frequency (or probability) of this FrequencyAndObject
    • getObject

      public final O getObject()
      Call the draw method of the generatingObject and return its result.
      Returns:
      O; the result of a call to the draw method of the generatingObject
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public final boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public final String toString()
      Overrides:
      toString in class Object