1 package org.opentrafficsim.core.dsol;
2
3 import org.djunits.value.vdouble.scalar.Duration;
4 import org.djutils.exceptions.Throw;
5
6 import nl.tudelft.simulation.dsol.experiment.StreamInformation;
7 import nl.tudelft.simulation.dsol.model.AbstractDsolModel;
8 import nl.tudelft.simulation.jstats.streams.MersenneTwister;
9
10
11
12
13
14
15
16
17
18 public abstract class AbstractOtsModel extends AbstractDsolModel<Duration, OtsSimulatorInterface> implements OtsModelInterface
19 {
20
21 private String shortName;
22
23
24 private String description;
25
26
27
28
29
30 public AbstractOtsModel(final OtsSimulatorInterface simulator)
31 {
32 this(simulator, "", "", defaultInitialStreams());
33 this.shortName = getClass().getSimpleName();
34 this.description = getClass().getSimpleName();
35 }
36
37
38
39
40
41
42
43
44 public AbstractOtsModel(final OtsSimulatorInterface simulator, final String shortName, final String description,
45 final StreamInformation streamInformation)
46 {
47 super(simulator, streamInformation);
48 Throw.whenNull(shortName, "shortname cannot be null");
49 Throw.whenNull(description, "description cannot be null");
50 this.shortName = shortName;
51 this.description = description;
52 }
53
54
55
56
57
58 public static StreamInformation defaultInitialStreams()
59 {
60 StreamInformation streamInformation = new StreamInformation();
61 streamInformation.addStream("default", new MersenneTwister(10L));
62 streamInformation.addStream("generation", new MersenneTwister(11L));
63 return streamInformation;
64 }
65
66 @Override
67 public final String getShortName()
68 {
69 return this.shortName;
70 }
71
72
73
74
75
76 public final void setShortName(final String shortName)
77 {
78 this.shortName = shortName;
79 }
80
81 @Override
82 public final String getDescription()
83 {
84 return this.description;
85 }
86
87
88
89
90
91 public final void setDescription(final String description)
92 {
93 this.description = description;
94 }
95
96 }