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 implements java.io.Serializable 19 { 20 /** */ 21 private static final long serialVersionUID = 20140805L; 22 23 /** stream is the random number generator from which to draw. */ 24 @SuppressWarnings("checkstyle:visibilitymodifier") 25 protected StreamInterface stream; 26 27 /** 28 * Constructs a new Distribution. 29 * @param stream StreamInterface; the stream for this mathematical distribution. 30 * @throws NullPointerException when stream is null 31 */ 32 public Dist(final StreamInterface stream) 33 { 34 Throw.whenNull(stream, "stream for a distribution cannot be null"); 35 this.stream = stream; 36 } 37 38 /** 39 * Return the random number stream. 40 * @return StreamInterface; the random number stream 41 */ 42 public StreamInterface getStream() 43 { 44 return this.stream; 45 } 46 47 /** 48 * Replace the random number stream. 49 * @param stream StreamInterface; the new random number stream 50 * @throws NullPointerException when stream is null 51 */ 52 public void setStream(final StreamInterface stream) 53 { 54 Throw.whenNull(stream, "stream for a distribution cannot be null"); 55 this.stream = stream; 56 } 57 58 }