
jasima.core.random.continuous.DblStream Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jasima-main Show documentation
Show all versions of jasima-main Show documentation
JAva SImulatior for MAnufacturing and logistics - A framework for discrete event simulation and computer experiments with a main focus on modelling and analyzing logistic/manufacturing systems.
/*******************************************************************************
* Copyright (c) 2010-2013 Torsten Hildebrandt and jasima contributors
*
* This file is part of jasima, v1.0.
*
* jasima is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* jasima is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with jasima. If not, see .
*
* $Id: DblStream.java 73 2013-01-08 17:16:19Z [email protected] $
*******************************************************************************/
package jasima.core.random.continuous;
import jasima.core.random.RandomFactory;
import java.io.Serializable;
import java.util.Random;
/**
* A stream of double numbers, usually the sequence is produced by a pseudo
* random number generator.
*
* @author Torsten Hildebrandt
* @version $Id: DblStream.java 73 2013-01-08 17:16:19Z [email protected] $
*/
public abstract class DblStream implements Serializable, Cloneable {
private static final long serialVersionUID = 7236623667061348954L;
protected Random rndGen;
private String name;
public DblStream() {
super();
}
public void init() {
}
public abstract double nextDbl();
@Override
public DblStream clone() throws CloneNotSupportedException {
if (rndGen != null)
throw new CloneNotSupportedException(
"Only a DblStream without a rndGen set can be cloned.");
return (DblStream) super.clone();
}
public Random getRndGen() {
return rndGen;
}
public void setRndGen(Random rndGen) {
this.rndGen = rndGen;
}
public String getName() {
return name;
}
/**
* Sets an optional name for this stream. The name can be used to, e.g.,
* initialize the random number generator as in
* {@link RandomFactory#initNumberStream(DblStream, String)}.
*
* @param name
* The stream's name.
*/
public void setName(String name) {
this.name = name;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy