1 | package desmoj.core.report; |
2 | |
3 | /** |
4 | * The basic reporter for all distributions in DESMO-J. All reporters producing |
5 | * output about a special distribution have to extend this reporter to add the |
6 | * special values to its report. |
7 | * |
8 | * @version DESMO-J, Ver. 2.3.3 copyright (c) 2011 |
9 | * @author Tim Lechler |
10 | * |
11 | * Licensed under the Apache License, Version 2.0 (the "License"); |
12 | * you may not use this file except in compliance with the License. You |
13 | * may obtain a copy of the License at |
14 | * http://www.apache.org/licenses/LICENSE-2.0 |
15 | * |
16 | * Unless required by applicable law or agreed to in writing, software |
17 | * distributed under the License is distributed on an "AS IS" |
18 | * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
19 | * or implied. See the License for the specific language governing |
20 | * permissions and limitations under the License. |
21 | * |
22 | */ |
23 | public class DistributionReporter extends Reporter { |
24 | /** |
25 | * DistributionReporter - Konstruktorkommentar. |
26 | * |
27 | * @param informationSource |
28 | * desmoj.core.simulator.Reportable |
29 | */ |
30 | public DistributionReporter( |
31 | desmoj.core.simulator.Reportable informationSource) { |
32 | |
33 | super(informationSource); |
34 | |
35 | numColumns = 8; |
36 | columns = new String[numColumns]; |
37 | entries = new String[numColumns]; |
38 | groupID = 100; // low groupID, so always last in order |
39 | |
40 | columns[0] = "Title"; |
41 | columns[1] = "(Re)set"; |
42 | columns[2] = "Obs"; |
43 | columns[3] = "Type"; |
44 | columns[4] = "Parameter 1"; |
45 | columns[5] = "Parameter 2"; |
46 | columns[6] = "Parameter 3"; |
47 | columns[7] = "Seed"; |
48 | groupHeading = "Distributions"; |
49 | |
50 | } |
51 | |
52 | /** |
53 | * Returns the array of strings containing all information about the |
54 | * distribution. |
55 | * |
56 | * @return java.lang.String[] : The array of Strings containing all |
57 | * information about the distribution |
58 | */ |
59 | public java.lang.String[] getEntries() { |
60 | |
61 | if (source instanceof desmoj.core.dist.Distribution) { |
62 | // Title |
63 | entries[0] = source.getName(); |
64 | // (Re)set |
65 | entries[1] = source.resetAt().toString(); |
66 | // Obs |
67 | entries[2] = Long.toString(source.getObservations()); |
68 | // Type |
69 | entries[3] = "unnamed distribution"; |
70 | // param1 |
71 | entries[4] = " "; |
72 | // param2 |
73 | entries[5] = " "; |
74 | // param3 |
75 | entries[6] = " "; |
76 | // seed |
77 | entries[7] = Long.toString(((desmoj.core.dist.Distribution) source) |
78 | .getInitialSeed()); |
79 | |
80 | } else { |
81 | for (int i = 0; i < numColumns; i++) { |
82 | entries[i] = "Invalid source!"; |
83 | } |
84 | } |
85 | |
86 | return entries; |
87 | |
88 | } |
89 | } |