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-2024 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/" target="_blank"> https://simulation.tudelft.nl</a>. The DSOL 12 * project is distributed under a three-clause BSD-style license, which can be found at 13 * <a href="https://https://simulation.tudelft.nl/dsol/docs/latest/license.html" target="_blank"> 14 * https://https://simulation.tudelft.nl/dsol/docs/latest/license.html</a>. 15 * </p> 16 * @author <a href="https://www.linkedin.com/in/peterhmjacobs">Peter Jacobs </a> 17 * @author <a href="https://www.tudelft.nl/averbraeck">Alexander Verbraeck</a> 18 */ 19 public abstract class Dist implements java.io.Serializable 20 { 21 /** */ 22 private static final long serialVersionUID = 20140805L; 23 24 /** stream is the random number generator from which to draw. */ 25 @SuppressWarnings("checkstyle:visibilitymodifier") 26 protected StreamInterface stream; 27 28 /** 29 * Constructs a new Distribution. 30 * @param stream StreamInterface; the stream for this mathematical distribution. 31 * @throws NullPointerException when stream is null 32 */ 33 public Dist(final StreamInterface stream) 34 { 35 Throw.whenNull(stream, "stream for a distribution cannot be null"); 36 this.stream = stream; 37 } 38 39 /** 40 * Return the random number stream. 41 * @return StreamInterface; the random number stream 42 */ 43 public StreamInterface getStream() 44 { 45 return this.stream; 46 } 47 48 /** 49 * Replace the random number stream. 50 * @param stream StreamInterface; the new random number stream 51 * @throws NullPointerException when stream is null 52 */ 53 public void setStream(final StreamInterface stream) 54 { 55 Throw.whenNull(stream, "stream for a distribution cannot be null"); 56 this.stream = stream; 57 } 58 59 }