1 package nl.tudelft.simulation.jstats.distributions;
2
3 import org.djutils.exceptions.Throw;
4
5 import nl.tudelft.simulation.jstats.streams.StreamInterface;
6
7 /**
8 * The Distribution class forms the basis for all statistical distributions.
9 * <p>
10 * Copyright (c) 2002-2025 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See
11 * for project information <a href="https://simulation.tudelft.nl/dsol/manual/" target="_blank">DSOL Manual</a>. The DSOL
12 * project is distributed under a three-clause BSD-style license, which can be found at
13 * <a href="https://simulation.tudelft.nl/dsol/docs/latest/license.html" target="_blank">DSOL License</a>.
14 * </p>
15 * @author <a href="https://www.linkedin.com/in/peterhmjacobs">Peter Jacobs </a>
16 * @author <a href="https://github.com/averbraeck">Alexander Verbraeck</a>
17 */
18 public abstract class Dist
19 {
20 /** stream is the random number generator from which to draw. */
21 @SuppressWarnings("checkstyle:visibilitymodifier")
22 protected StreamInterface stream;
23
24 /**
25 * Constructs a new Distribution.
26 * @param stream the stream for this mathematical distribution.
27 * @throws NullPointerException when stream is null
28 */
29 public Dist(final StreamInterface stream)
30 {
31 Throw.whenNull(stream, "stream for a distribution cannot be null");
32 this.stream = stream;
33 }
34
35 /**
36 * Return the random number stream.
37 * @return the random number stream
38 */
39 public StreamInterface getStream()
40 {
41 return this.stream;
42 }
43
44 /**
45 * Replace the random number stream.
46 * @param stream the new random number stream
47 * @throws NullPointerException when stream is null
48 */
49 public void setStream(final StreamInterface stream)
50 {
51 Throw.whenNull(stream, "stream for a distribution cannot be null");
52 this.stream = stream;
53 }
54
55 }