forked from binfalse/BiVeS-SBML
/
SBMLDiffReport.java
257 lines (218 loc) · 5.68 KB
/
SBMLDiffReport.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
/**
*
*/
package de.unirostock.sems.bives.sbml.parser;
import java.util.ArrayList;
import java.util.List;
/**
* The Class SBMLDiffReport creates a report about the differences between two versions of an SBML document.
*
* @author Martin Scharm
*/
public class SBMLDiffReport
{
/** The header. */
private String header;
/** The modified species. */
private List<String> modifiedSpecies;
/** The modified species types. */
private List<String> modifiedSpeciesTypes;
/** The modified parameter. */
private List<String> modifiedParameter;
/** The modified reactions. */
private List<String> modifiedReactions;
/** The modified compartments. */
private List<String> modifiedCompartments;
/** The modified compartment types. */
private List<String> modifiedCompartmentTypes;
/** The modified rules. */
private List<String> modifiedRules;
/** The modified functions. */
private List<String> modifiedFunctions;
/** The modified constraints. */
private List<String> modifiedConstraints;
/** The modified events. */
private List<String> modifiedEvents;
/** The modified initial assignments. */
private List<String> modifiedInitialAssignments;
/** The modified units. */
private List<String> modifiedUnits;
/**
* Instantiates a new sBML diff report.
*/
public SBMLDiffReport ()
{
header = "";
modifiedSpecies = new ArrayList<String> ();
modifiedSpeciesTypes = new ArrayList<String> ();
modifiedParameter = new ArrayList<String> ();
modifiedReactions = new ArrayList<String> ();
modifiedCompartments = new ArrayList<String> ();
modifiedCompartmentTypes = new ArrayList<String> ();
modifiedRules = new ArrayList<String> ();
modifiedFunctions = new ArrayList<String> ();
modifiedConstraints = new ArrayList<String> ();
modifiedEvents = new ArrayList<String> ();
modifiedInitialAssignments = new ArrayList<String> ();
modifiedUnits = new ArrayList<String> ();
}
/**
* Generate html report.
*
* @return the string
*/
public String generateHTMLReport ()
{
String report = "<h2>Diff Report</h2><p>Please keep in mind that these modifications are choosen by what we think is important!</p><p>"+header+"</p>";
report += generateTable (modifiedSpecies, "Following Species were modified", "species");
report += generateTable (modifiedSpeciesTypes, "Following SpeciesTypes were modified", "speciestypes");
report += generateTable (modifiedParameter, "Following Parameter were modified", "parameter");
report += generateTable (modifiedReactions, "Following Reactions were modified", "reaction");
report += generateTable (modifiedCompartments, "Following Compartments were modified", "compartment");
report += generateTable (modifiedCompartmentTypes, "Following CompartmentTypes were modified", "compartmenttype");
report += generateTable (modifiedUnits, "Following Units were modified", "unit");
report += generateTable (modifiedRules, "Following Rules were modified", "rule");
report += generateTable (modifiedFunctions, "Following Functions were modified", "function");
report += generateTable (modifiedConstraints, "Following Constraints were modified", "constraint");
report += generateTable (modifiedEvents, "Following Events were modified", "event");
report += generateTable (modifiedInitialAssignments, "Following InitialAssignments were modified", "initialssignment");
return report;
}
/**
* Generate table.
*
* @param mods the mods
* @param headline the headline
* @param cssclass the cssclass
* @return the string
*/
private String generateTable (List<String> mods, String headline, String cssclass)
{
if (mods.size () < 1)
return "";
String rep = "";
for (String mod: mods)
rep += mod;
if (rep.length () < 1)
return "";
return "<h3 class='"+cssclass+"'>"+headline+"</h3><table class='"+cssclass+"'>" +
"<thead><th>ID (name)</th><th>Modification</th></thead>" + rep + "</table>";
}
/**
* Adds the header.
*
* @param header the header
*/
public void addHeader (String header)
{
this.header += header;
}
/**
* Modify species.
*
* @param rep the rep
*/
public void modifySpecies (String rep)
{
modifiedSpecies.add (rep);
}
/**
* Modify species types.
*
* @param rep the rep
*/
public void modifySpeciesTypes (String rep)
{
modifiedSpeciesTypes.add (rep);
}
/**
* Modify parameter.
*
* @param rep the rep
*/
public void modifyParameter (String rep)
{
modifiedParameter.add (rep);
}
/**
* Modify reaction.
*
* @param rep the rep
*/
public void modifyReaction (String rep)
{
modifiedReactions.add (rep);
}
/**
* Modify compartments.
*
* @param rep the rep
*/
public void modifyCompartments (String rep)
{
modifiedCompartments.add (rep);
}
/**
* Modify compartment types.
*
* @param rep the rep
*/
public void modifyCompartmentTypes (String rep)
{
modifiedCompartmentTypes.add (rep);
}
/**
* Modify rules.
*
* @param rep the rep
*/
public void modifyRules (String rep)
{
modifiedRules.add (rep);
}
/**
* Modify functions.
*
* @param rep the rep
*/
public void modifyFunctions (String rep)
{
modifiedFunctions.add (rep);
}
/**
* Modify contraints.
*
* @param rep the rep
*/
public void modifyContraints (String rep)
{
modifiedConstraints.add (rep);
}
/**
* Modify events.
*
* @param rep the rep
*/
public void modifyEvents (String rep)
{
modifiedEvents.add (rep);
}
/**
* Modify initial assignments.
*
* @param rep the rep
*/
public void modifyInitialAssignments (String rep)
{
modifiedInitialAssignments.add (rep);
}
/**
* Modify units.
*
* @param rep the rep
*/
public void modifyUnits (String rep)
{
modifiedUnits.add (rep);
}
}