umontreal.iro.lecuyer.rng
Class RandomStreamManager
- java.lang.Object
-
- umontreal.iro.lecuyer.rng.RandomStreamManager
-
public class RandomStreamManager extends java.lang.ObjectManages a list of random streams for more convenient synchronization. All streams in the list can be reset simultaneously by a single call to the appropriate method of this stream manager, instead of calling explicitly the reset method for each individual stream.After a random stream manager is constructed, any existing
RandomStreamobject can be registered to this stream manager (i.e., added to the list) and eventually unregistered (removed from the list).
-
-
Constructor Summary
Constructors Constructor and Description RandomStreamManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description RandomStreamadd(RandomStream stream)Adds the given stream to the internal list of this random stream manager and returns the added stream.voidclear()Removes all the streams from the internal list of this random stream manager.java.util.ListgetStreams()Returns an unmodifiable list containing all the random streams in this random stream manager.booleanremove(RandomStream stream)Removes the given stream from the internal list of this random stream manager.voidresetNextSubstream()Forwards to theresetNextSubstreammethods of all streams in the list.voidresetStartStream()Forwards to theresetStartStreammethods of all streams in the list.voidresetStartSubstream()Forwards to theresetStartSubstreammethods of all streams in the list.java.lang.StringtoString()
-
-
-
Method Detail
-
add
public RandomStream add(RandomStream stream)
Adds the given 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:
java.lang.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 java.util.List getStreams()
Returns an unmodifiable list containing all the random streams in this random stream manager. The returned list, constructed byunmodifiableList, can be assumed to contain non-nullRandomStreaminstances.- Returns:
- the list of managed random streams.
-
resetStartStream
public void resetStartStream()
Forwards to theresetStartStreammethods of all streams in the list.
-
resetStartSubstream
public void resetStartSubstream()
Forwards to theresetStartSubstreammethods of all streams in the list.
-
resetNextSubstream
public void resetNextSubstream()
Forwards to theresetNextSubstreammethods of all streams in the list.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-
DMelt 3.0 © DataMelt by jWork.ORG