SSJ
V. labo.

umontreal.iro.lecuyer.rng
Class BasicRandomStreamFactory

java.lang.Object
  extended by umontreal.iro.lecuyer.rng.BasicRandomStreamFactory
All Implemented Interfaces:
RandomStreamFactory

public class BasicRandomStreamFactory
extends Object
implements RandomStreamFactory

BasicRandomStreamFactory

Represents a basic random stream factory that can constructs new instances of a given RandomStream implementation via the newInstance() method. The class name of the implementation to be used must be passed to the constructor as a String, which must be the name of a nullary constructor of a RandomStream object (i.e., a constructor that has no parameters). The streams are constructed by the factory by reflection from this String.


Constructor Summary
BasicRandomStreamFactory(Class rsClass)
          .
 
Method Summary
 Class getRandomStreamClass()
          .
 RandomStream newInstance()
          Constructs and returns a new random stream.
 void setRandomStreamClass(Class rsClass)
          .
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicRandomStreamFactory

public BasicRandomStreamFactory(Class rsClass)
. \begin{tabb}Constructs a new basic random stream factory with
 random stream cla...
 ...reams, this constructor
 must be called with \texttt{MRG33k3a.class}.
 \end{tabb}
rsClassthe random stream class being used. NullPointerExceptionif rsClass is null. IllegalArgumentExceptionif rsClass does not represent an implementation of RandomStream, or does not provide a nullary constructor.

Method Detail

getRandomStreamClass

public Class getRandomStreamClass()
. \begin{tabb}Returns the random stream class associated with this
 object.
 \end{tabb}
the associated random stream class.


setRandomStreamClass

public void setRandomStreamClass(Class rsClass)
. \begin{tabb}Sets the associated random stream class to
 \texttt{rsClass}.
 The s...
 ...ion
 of \class{RandomStream} and must provide a nullary
 constructor.
 \end{tabb}
rsClassthe random stream class being used. NullPointerExceptionif rsClass is null. IllegalArgumentExceptionif rsClass does not represent an implementation of RandomStream, or does not provide a nullary constructor.


newInstance

public RandomStream newInstance()
Description copied from interface: RandomStreamFactory
Constructs and returns a new random stream. If the instantiation of the random stream fails, this method throws a RandomStreamInstantiationException.

Specified by:
newInstance in interface RandomStreamFactory
Returns:
the newly-constructed random stream.

toString

public String toString()
Overrides:
toString in class Object

SSJ
V. labo.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.