Class RNGStreamManager

  • All Implemented Interfaces:
    RandomStreamManagerIfc, RNStreamControlIfc

    public class RNGStreamManager
    extends java.lang.Object
    implements RandomStreamManagerIfc
    A wrapper for holding a list of streams so that all streams can be managed together The methods of the RandomStreamIfc are applied to all contained random number streams
    • Field Detail

      • myStreams

        protected java.util.List<RNStreamIfc> myStreams
        Holds the streams
    • Constructor Detail

      • RNGStreamManager

        public RNGStreamManager()
    • Method Detail

      • makeRngStreams

        public static RNGStreamManager makeRngStreams​(int numStreams)
        Makes a stream manager and fills it with streams from RNStreamFactory.getDefaultFactory()
        Parameters:
        numStreams - , must be > 0
        Returns:
      • makeRngStreams

        public static RNGStreamManager makeRngStreams​(int numStreams,
                                                      RNStreamFactory f)
        Makes RNStreams and fills a RNGStreamManager
        Parameters:
        numStreams - , must be > 0
        f - the factory
        Returns:
        the manager
      • resetStartStream

        public void resetStartStream()
        Description copied from interface: RNStreamControlIfc
        The resetStartStream method will position the RNG at the beginning of its stream. This is the same location in the stream as assigned when the RNG was created and initialized.
        Specified by:
        resetStartStream in interface RNStreamControlIfc
      • advanceToNextSubstream

        public void advanceToNextSubstream​(int n)
        Causes all managed streams to advance their to the next nth substream
        Parameters:
        n -
      • setAntitheticOption

        public void setAntitheticOption​(boolean flag)
        Description copied from interface: RNStreamControlIfc
        Tells the stream to start producing antithetic variates
        Specified by:
        setAntitheticOption in interface RNStreamControlIfc
        Parameters:
        flag - true means that it produces antithetic variates.
      • set

        public RNStreamIfc set​(int index,
                               RNStreamIfc element)
        Sets the stream at the index
        Parameters:
        index - , must be a valid index
        element - , must not be null
        Returns:
        the RandomStreamIfc
      • remove

        public RNStreamIfc remove​(int index)
        Parameters:
        index - must be a valid index
        Returns:
        RandomStreamIfc
      • iterator

        public java.util.Iterator<RNStreamIfc> iterator()
      • clear

        public void clear()
      • add

        public void add​(int index,
                        RNStreamIfc element)
        Adds the stream to the manager
        Parameters:
        index - , must be a valid index
        element - , must not be null
      • add

        public boolean add​(RNStreamIfc e)
        Adds the stream to the manager
        Parameters:
        e - must not be null
        Returns:
        true if added
      • addNewRNStream

        public RNStreamIfc addNewRNStream()
        Adds a stream from RNStreamFactory.getDefaultFactory()
        Returns:
        the added RNStream
      • addNewRNStream

        public RNStreamIfc addNewRNStream​(RNStreamFactory f)
        Creates a new stream from the supplied factory and adds it to the list of managed streams
        Parameters:
        f - , must not be null
        Returns:
        the created stream