View Javadoc

1   /*
2    * Copyright 2006 - 2012 Christina Bohk and Roland Ewald
3    *  
4    * Licensed under the Apache License, Version 2.0 (the "License"); 
5    * you may not use this file except in compliance with the License. 
6    * You may obtain a copy of the License at 
7    *  
8    *  http://www.apache.org/licenses/LICENSE-2.0
9    *  
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
13   * See the License for the specific language governing permissions and 
14   * limitations under the License. 
15   */
16  package p3j.experiment;
17  
18  import java.util.Date;
19  
20  import p3j.pppm.ProjectionModel;
21  import p3j.simulation.ISimulationParameters;
22  import p3j.simulation.assignments.plugintype.IParamAssignmentGenerator;
23  
24  /**
25   * Contains all information that are necessary to repeat an experiment.
26   * 
27   * Created: August 20, 2008
28   * 
29   * @author Christina Bohk
30   * @author Roland Ewald
31   */
32  public class ExperimentDefinition {
33  
34  	/** The ID of this experiment. */
35  	private int id;
36  
37  	/** The random seed to be used. */
38  	private long randSeed;
39  
40  	/** ID of the user who conducted the experiment. */
41  	private String user;
42  
43  	/** Date of the experiment. */
44  	private Date date;
45  
46  	/**
47  	 * Projection parameters that have been used. This encapsulates all input
48  	 * values.
49  	 */
50  	private ProjectionModel projection;
51  
52  	/** The simulator that has been used. */
53  	private Class<? extends IParamAssignmentGenerator> simulator;
54  
55  	/** The simulation parameters that have been used. */
56  	private ISimulationParameters simParams;
57  
58  	/** All results of the experiment. */
59  	private ResultSet resultSet;
60  
61  	/**
62  	 * Default constructor.
63  	 * 
64  	 * @param proj
65  	 *          the input used for the projection
66  	 * @param randS
67  	 *          the seed to be used for the random number generator (only relevant
68  	 *          for Monte-Carlo simulators)
69  	 * @param currentDate
70  	 *          current date
71  	 * @param userName
72  	 *          name of the user that issued this experiment
73  	 * @param sim
74  	 *          the class of the simulation algorithm
75  	 */
76  	public ExperimentDefinition(ProjectionModel proj, long randS,
77  	    Date currentDate, String userName,
78  	    Class<? extends IParamAssignmentGenerator> sim) {
79  		projection = proj;
80  		randSeed = randS;
81  		date = new Date(currentDate.getTime());
82  		user = userName;
83  		simulator = sim;
84  	}
85  
86  	/**
87  	 * Constructor for bean compliance.
88  	 */
89  	public ExperimentDefinition() {
90  	}
91  
92  	/**
93  	 * Gets the rand seed.
94  	 * 
95  	 * @return the rand seed
96  	 */
97  	public long getRandSeed() {
98  		return randSeed;
99  	}
100 
101 	/**
102 	 * Sets the rand seed.
103 	 * 
104 	 * @param randSeed
105 	 *          the new rand seed
106 	 */
107 	public void setRandSeed(long randSeed) {
108 		this.randSeed = randSeed;
109 	}
110 
111 	/**
112 	 * Gets the user.
113 	 * 
114 	 * @return the user
115 	 */
116 	public String getUser() {
117 		return user;
118 	}
119 
120 	/**
121 	 * Sets the user.
122 	 * 
123 	 * @param user
124 	 *          the new user
125 	 */
126 	public void setUser(String user) {
127 		this.user = user;
128 	}
129 
130 	/**
131 	 * Gets the date.
132 	 * 
133 	 * @return the date
134 	 */
135 	public Date getDate() {
136 		return new Date(date.getTime());
137 	}
138 
139 	/**
140 	 * Sets the date.
141 	 * 
142 	 * @param date
143 	 *          the new date
144 	 */
145 	public void setDate(Date date) {
146 		this.date.setTime(date.getTime());
147 	}
148 
149 	/**
150 	 * Gets the projection.
151 	 * 
152 	 * @return the projection
153 	 */
154 	public ProjectionModel getProjection() {
155 		return projection;
156 	}
157 
158 	/**
159 	 * Sets the projection.
160 	 * 
161 	 * @param projection
162 	 *          the new projection
163 	 */
164 	public void setProjection(ProjectionModel projection) {
165 		this.projection = projection;
166 	}
167 
168 	/**
169 	 * Gets the simulator.
170 	 * 
171 	 * @return the simulator
172 	 */
173 	public Class<? extends IParamAssignmentGenerator> getSimulator() {
174 		return simulator;
175 	}
176 
177 	/**
178 	 * Sets the simulator.
179 	 * 
180 	 * @param simulator
181 	 *          the new simulator
182 	 */
183 	public void setSimulator(Class<? extends IParamAssignmentGenerator> simulator) {
184 		this.simulator = simulator;
185 	}
186 
187 	/**
188 	 * Gets the sim params.
189 	 * 
190 	 * @return the sim params
191 	 */
192 	public ISimulationParameters getSimParams() {
193 		return simParams;
194 	}
195 
196 	/**
197 	 * Sets the sim params.
198 	 * 
199 	 * @param simParams
200 	 *          the new sim params
201 	 */
202 	public void setSimParams(ISimulationParameters simParams) {
203 		this.simParams = simParams;
204 	}
205 
206 	/**
207 	 * Gets the result set.
208 	 * 
209 	 * @return the result set
210 	 */
211 	public ResultSet getResultSet() {
212 		return resultSet;
213 	}
214 
215 	/**
216 	 * Sets the result set.
217 	 * 
218 	 * @param resultSet
219 	 *          the new result set
220 	 */
221 	public void setResultSet(ResultSet resultSet) {
222 		this.resultSet = resultSet;
223 	}
224 
225 	/**
226 	 * Gets the id.
227 	 * 
228 	 * @return the id
229 	 */
230 	public int getID() {
231 		return id;
232 	}
233 
234 	/**
235 	 * Sets the id.
236 	 * 
237 	 * @param uniqueID
238 	 *          the new id
239 	 */
240 	public void setID(int uniqueID) {
241 		id = uniqueID;
242 	}
243 
244 }