1
2
3
4
5
6
7
8
9
10 package nl.tudelft.simulation.dsol.experiment;
11
12 import java.util.Calendar;
13 import java.util.Properties;
14
15 import nl.tudelft.simulation.event.EventProducer;
16
17 /***
18 * The treatment is comprises the specification of input data, the runControl
19 * and the specification of output data. (Sol:1982, Oeren&Zeigler:1979) <br>
20 * (c) copyright 2003 <a href="http://www.simulation.tudelft.nl">Delft
21 * University of Technology </a>, the Netherlands. <br>
22 * See for project information <a href="http://www.simulation.tudelft.nl">
23 * www.simulation.tudelft.nl </a> <br>
24 * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
25 * License (GPL) </a>, no warranty <br>
26 *
27 * @version 2.0 21.09.2003 <br>
28 * @author <a href="http://www.tbm.tudelft.nl/webstaf/peterja/index.htm">Peter
29 * Jacobs </a>, <a
30 * href="http://www.tbm.tudelft.nl/webstaf/alexandv/index.htm">Alexander
31 * Verbraeck </a>
32 */
33 public class Treatment extends EventProducer
34 {
35
36 /***
37 * experiment reflects the experiment
38 *
39 * @uml.property name="experiment"
40 */
41 private Experiment experiment;
42
43 /***
44 * runControl reflects the runControl
45 *
46 * @uml.property name="runControl"
47 */
48 private RunControl runControl;
49
50 /***
51 * startTime of the treatment
52 *
53 * @uml.property name="startTime"
54 */
55 private long startTime = 0L;
56
57 /***
58 * timeUnit reflects the timeUnit
59 *
60 * @uml.property name="timeUnit"
61 */
62 private TimeUnitInterface timeUnit = TimeUnitInterface.UNIT;
63
64 /***
65 * the number of the treatment
66 *
67 * @uml.property name="number"
68 */
69 private int number = 0;
70
71 /***
72 * the properties of this treatment
73 *
74 * @uml.property name="properties"
75 */
76 private Properties properties = new Properties();
77
78
79 /***
80 * contructs a Treatment
81 *
82 * @param experiment reflects the experiment
83 * @param number the number of this treatment
84 */
85 public Treatment(final Experiment experiment, final int number)
86 {
87 super();
88 this.experiment = experiment;
89 this.number = number;
90 }
91
92 /***
93 * returns the number of this replication
94 *
95 * @return int the number
96 *
97 * @uml.property name="number"
98 */
99 public int getNumber()
100 {
101 return this.number;
102 }
103
104 /***
105 * returns the experiment
106 *
107 * @return Experiment the experiment
108 *
109 * @uml.property name="experiment"
110 */
111 public Experiment getExperiment()
112 {
113 return this.experiment;
114 }
115
116 /***
117 * returns the properties for this treatment
118 *
119 * @return Properties
120 *
121 * @uml.property name="properties"
122 */
123 public Properties getProperties()
124 {
125 return this.properties;
126 }
127
128 /***
129 * returns the RunControl
130 *
131 * @return RunControl the runControl
132 *
133 * @uml.property name="runControl"
134 */
135 public RunControl getRunControl()
136 {
137 return this.runControl;
138 }
139
140 /***
141 * returns the startTime
142 *
143 * @return long the startTime
144 *
145 * @uml.property name="startTime"
146 */
147 public long getStartTime()
148 {
149 return this.startTime;
150 }
151
152 /***
153 * returns the timeUnit
154 *
155 * @return timeUnit
156 *
157 * @uml.property name="timeUnit"
158 */
159 public TimeUnitInterface getTimeUnit()
160 {
161 return this.timeUnit;
162 }
163
164 /***
165 * sets the properties
166 *
167 * @param properties the properties
168 *
169 * @uml.property name="properties"
170 */
171 public void setProperties(final Properties properties)
172 {
173 this.properties = properties;
174 }
175
176 /***
177 * sets the RunControl
178 *
179 * @param runControl the control.
180 *
181 * @uml.property name="runControl"
182 */
183 public void setRunControl(final RunControl runControl)
184 {
185 this.runControl = runControl;
186 }
187
188 /***
189 * sets the startTime of the treatment
190 *
191 * @param startTime reflects the startTime
192 *
193 * @uml.property name="startTime"
194 */
195 public void setStartTime(final long startTime)
196 {
197 this.startTime = startTime;
198 }
199
200 /***
201 * sets the timeUnit of the treatment
202 *
203 * @param timeUnit is the timeunit
204 *
205 * @uml.property name="timeUnit"
206 */
207 public void setTimeUnit(final TimeUnitInterface timeUnit)
208 {
209 this.timeUnit = timeUnit;
210 }
211
212 /***
213 * @see java.lang.Object#toString()
214 */
215 public String toString()
216 {
217 Calendar calendar = Calendar.getInstance();
218 calendar.setTimeInMillis(this.getStartTime());
219
220 String result = "[" + super.toString() + " ; "
221 + calendar.getTime().toString() + " ; " + this.getTimeUnit()
222 + " ; runcontrol=" + this.getRunControl().toString() + "";
223 return result;
224 }
225 }