SSJ
V. 1.1.9.

umontreal.iro.lecuyer.rng
Class RandomStreamManager

java.lang.Object
  extended by umontreal.iro.lecuyer.rng.RandomStreamManager

public class RandomStreamManager
extends Object

Manages a list of random streams for more convenient synchronization. After a random stream manager is constructed, any created RandomStream objects can be registered to this stream manager. Instead of resetting each random number stream individually, a single call to the random stream manager resets all the streams simultaneously. This prevents forgetting random number streams and improves code maintainability when the streams are changed.


Constructor Summary
RandomStreamManager()
           
 
Method Summary
 RandomStream add(RandomStream stream)
          Adds the new stream stream to the internal list of this random stream manager and returns the added stream.
 void clear()
          Removes all the streams from the internal list of this random stream manager.
 List getStreams()
          Returns an unmodifiable list containing all the random streams in this random stream manager.
 boolean remove(RandomStream stream)
          Removes the given stream from the internal list of this random stream manager.
 void resetNextSubstream()
          Forwards to the streams' resetNextSubstream methods.
 void resetStartStream()
          Forwards to the streams' resetStartStream methods.
 void resetStartSubstream()
          Forwards to the streams' resetStartSubstream methods.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RandomStreamManager

public RandomStreamManager()
Method Detail

add

public RandomStream add(RandomStream stream)
Adds the new stream stream to the internal list of this random stream manager and returns the added stream.

Parameters:
stream - the stream being added.
Returns:
the added stream.
Throws:
NullPointerException - if stream is null.

remove

public boolean remove(RandomStream stream)
Removes the given stream from the internal list of this random stream manager. Returns true if the stream was properly removed, false otherwise.

Parameters:
stream - the stream being removed.
Returns:
the success indicator of the operation.

clear

public void clear()
Removes all the streams from the internal list of this random stream manager.


getStreams

public List getStreams()
Returns an unmodifiable list containing all the random streams in this random stream manager. The returned list, constructed by unmodifiableList, can be assumed to contain non-null RandomStream instances.

Returns:
the list of managed random streams.

resetStartStream

public void resetStartStream()
Forwards to the streams' resetStartStream methods.


resetStartSubstream

public void resetStartSubstream()
Forwards to the streams' resetStartSubstream methods.


resetNextSubstream

public void resetNextSubstream()
Forwards to the streams' resetNextSubstream methods.


toString

public String toString()
Overrides:
toString in class Object

SSJ
V. 1.1.9.

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