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-2022 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(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()
String
toString()
-
-
-
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 generatingObjectobject
- 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
-
-