Class ProbabilisticRouteGenerator
- java.lang.Object
-
- org.opentrafficsim.core.network.route.ProbabilisticRouteGenerator
-
public class ProbabilisticRouteGenerator extends java.lang.Object implements Generator<Route>, java.io.Serializable
Generate one of a set of routes, based on a discrete probability density function.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.$LastChangedDate: 2020-01-23 11:14:19 +0100 (Thu, 23 Jan 2020) $, @version $Revision: 6010 $, by $Author: averbraeck $, initial version 20 Mar 2015
- Author:
- Alexander Verbraeck, Peter Knoppers
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ProbabilisticRouteGenerator(java.util.List<Distribution.FrequencyAndObject<Route>> generators, StreamInterface stream)Create a new Probabilistic Route Generator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Routedraw()Generate the next object.java.lang.StringtoString()
-
-
-
Constructor Detail
-
ProbabilisticRouteGenerator
public ProbabilisticRouteGenerator(java.util.List<Distribution.FrequencyAndObject<Route>> generators, StreamInterface stream) throws ProbabilityException
Create a new Probabilistic Route Generator.- Parameters:
generators- List<Distribution.FrequencyAndObject<Route>>; list of routes and frequenciesstream- StreamInterface; the entropy source- Throws:
ProbabilityException- when the probabilities are invalid
-
-
Method Detail
-
draw
public final Route draw() throws ProbabilityException
Generate the next object.- Specified by:
drawin interfaceGenerator<Route>- Returns:
- O; an object randomly selected from the stored collection
- Throws:
ProbabilityException- if the stored collection is empty
-
toString
public final java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-