View Javadoc
1   package org.opentrafficsim.road.network.factory.xml.utils;
2   
3   import java.util.Map;
4   
5   import nl.tudelft.simulation.jstats.streams.MersenneTwister;
6   import nl.tudelft.simulation.jstats.streams.StreamInterface;
7   
8   /**
9    * StreamInformation contains information about the stream and its seeds. <br>
10   * <br>
11   * Copyright (c) 2003-2018 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See
12   * for project information <a href="https://www.simulation.tudelft.nl/" target="_blank">www.simulation.tudelft.nl</a>. The
13   * source code and binary code of this software is proprietary information of Delft University of Technology.
14   * @author <a href="https://www.tudelft.nl/averbraeck" target="_blank">Alexander Verbraeck</a>
15   */
16  public class StreamInformation
17  {
18      /** the stream id. */
19      private final String id;
20  
21      /** the seed map, mapping replication number to seed. */
22      private final Map<Integer, Long> seedMap;
23  
24      /** the stream itself; the seed value of 1L will be updated per replication. */
25      private final StreamInterface stream = new MersenneTwister(1L);
26  
27      /**
28       * @param id the stream id
29       * @param seedMap the seed map, mapping replication number to seed
30       */
31      public StreamInformation(final String id, final Map<Integer, Long> seedMap)
32      {
33          this.id = id;
34          this.seedMap = seedMap;
35          this.stream.setSeed(seedMap.get(1));
36      }
37  
38      // TODO: make sure the seed map is used by the OTSExperiment / OTSReplication
39      
40      /**
41       * @return id
42       */
43      public final String getId()
44      {
45          return this.id;
46      }
47  
48      /**
49       * @return stream
50       */
51      public final StreamInterface getStream()
52      {
53          return this.stream;
54      }
55  
56  }