Class Distribution.FrequencyAndObject<O>

  • Type Parameters:
    O - Type of the object returned by the draw method
    All Implemented Interfaces:
    java.io.Serializable
    Enclosing class:
    Distribution<O>

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

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

    Version:
    $Revision$, $LastChangedDate$, by $Author$, initial version Mar 1, 2016
    Author:
    Alexander Verbraeck, Peter Knoppers
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      FrequencyAndObject​(double frequency, O object)
      Construct a new FrequencyAndObject instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)
      double getFrequency()
      Retrieve the frequency (or probability) of this FrequencyAndObject.
      O getObject()
      Call the draw method of the generatingObject and return its result.
      int hashCode()
      java.lang.String toString()
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • 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 Detail

      • 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 java.lang.Object
      • equals

        public final boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object