1 | /* | |
2 | * Copyright 2006 - 2013 | |
3 | * Stefan Balev <stefan.balev@graphstream-project.org> | |
4 | * Julien Baudry <julien.baudry@graphstream-project.org> | |
5 | * Antoine Dutot <antoine.dutot@graphstream-project.org> | |
6 | * Yoann Pign�� <yoann.pigne@graphstream-project.org> | |
7 | * Guilhelm Savin <guilhelm.savin@graphstream-project.org> | |
8 | * | |
9 | * This file is part of GraphStream <http://graphstream-project.org>. | |
10 | * | |
11 | * GraphStream is a library whose purpose is to handle static or dynamic | |
12 | * graph, create them from scratch, file or any source and display them. | |
13 | * | |
14 | * This program is free software distributed under the terms of two licenses, the | |
15 | * CeCILL-C license that fits European law, and the GNU Lesser General Public | |
16 | * License. You can use, modify and/ or redistribute the software under the terms | |
17 | * of the CeCILL-C license as circulated by CEA, CNRS and INRIA at the following | |
18 | * URL <http://www.cecill.info> or under the terms of the GNU LGPL as published by | |
19 | * the Free Software Foundation, either version 3 of the License, or (at your | |
20 | * option) any later version. | |
21 | * | |
22 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY | |
23 | * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | |
24 | * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. | |
25 | * | |
26 | * You should have received a copy of the GNU Lesser General Public License | |
27 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
28 | * | |
29 | * The fact that you are presently reading this means that you have had | |
30 | * knowledge of the CeCILL-C and LGPL licenses and that you accept their terms. | |
31 | */ | |
32 | package org.graphstream.stream.file.gml; | |
33 | ||
34 | import java.io.IOException; | |
35 | import java.util.HashMap; | |
36 | ||
37 | import org.graphstream.graph.implementations.AbstractElement.AttributeChangeEvent; | |
38 | import org.graphstream.stream.SourceBase.ElementType; | |
39 | import org.graphstream.stream.file.FileSourceGML; | |
40 | ||
41 | public class GMLContext { | |
42 | FileSourceGML gml; | |
43 | //GMLParser parser; | |
44 | String sourceId; | |
45 | boolean directed; | |
46 | protected KeyValues nextStep = null; | |
47 | boolean inGraph = false; | |
48 | ||
49 | GMLContext(FileSourceGML gml) { | |
50 | this.gml = gml; | |
51 | this.sourceId = String.format("<GML stream %d>", | |
52 | System.currentTimeMillis()); | |
53 | } | |
54 | ||
55 | void handleKeyValues(KeyValues kv) throws IOException { | |
56 |
1
1. handleKeyValues : negated conditional → NO_COVERAGE |
if (nextStep != null) { |
57 |
1
1. handleKeyValues : removed call to org/graphstream/stream/file/gml/GMLContext::insertKeyValues → NO_COVERAGE |
insertKeyValues(nextStep); |
58 | nextStep = null; | |
59 | } | |
60 | ||
61 | try { | |
62 |
1
1. handleKeyValues : negated conditional → NO_COVERAGE |
if (kv != null) { |
63 |
1
1. handleKeyValues : removed call to org/graphstream/stream/file/gml/GMLContext::insertKeyValues → NO_COVERAGE |
insertKeyValues(kv); |
64 | } | |
65 | } catch (IOException e) { | |
66 | throw new IOException(e); | |
67 | } | |
68 | } | |
69 | ||
70 | void setNextStep(KeyValues kv) { | |
71 | nextStep = kv; | |
72 | } | |
73 | ||
74 | public void setDirected(boolean on) { | |
75 | directed = on; | |
76 | } | |
77 | | |
78 | void setIsInGraph(boolean on) { | |
79 | inGraph = on; | |
80 | } | |
81 | ||
82 | public void addNodeOrEdge(String element, KeyValues kv) { | |
83 | System.err.printf("adding %s %n", element); | |
84 | } | |
85 | ||
86 | protected void insertKeyValues(KeyValues kv) throws IOException { | |
87 |
1
1. insertKeyValues : negated conditional → NO_COVERAGE |
if (kv.key != null) { |
88 |
1
1. insertKeyValues : negated conditional → NO_COVERAGE |
if (inGraph) { |
89 |
2
1. insertKeyValues : negated conditional → NO_COVERAGE 2. insertKeyValues : negated conditional → NO_COVERAGE |
if (kv.key.equals("node") || kv.key.equals("add-node")) { |
90 |
1
1. insertKeyValues : removed call to org/graphstream/stream/file/gml/GMLContext::handleAddNode → NO_COVERAGE |
handleAddNode(kv); |
91 |
2
1. insertKeyValues : negated conditional → NO_COVERAGE 2. insertKeyValues : negated conditional → NO_COVERAGE |
} else if (kv.key.equals("edge") || kv.key.equals("add-edge")) { |
92 |
1
1. insertKeyValues : removed call to org/graphstream/stream/file/gml/GMLContext::handleAddEdge → NO_COVERAGE |
handleAddEdge(kv); |
93 |
2
1. insertKeyValues : negated conditional → NO_COVERAGE 2. insertKeyValues : negated conditional → NO_COVERAGE |
} else if (kv.key.equals("del-node") || kv.key.equals("-node")) { |
94 |
1
1. insertKeyValues : removed call to org/graphstream/stream/file/gml/GMLContext::handleDelNode → NO_COVERAGE |
handleDelNode(kv); |
95 |
2
1. insertKeyValues : negated conditional → NO_COVERAGE 2. insertKeyValues : negated conditional → NO_COVERAGE |
} else if (kv.key.equals("del-edge") || kv.key.equals("-edge")) { |
96 |
1
1. insertKeyValues : removed call to org/graphstream/stream/file/gml/GMLContext::handleDelEdge → NO_COVERAGE |
handleDelEdge(kv); |
97 |
1
1. insertKeyValues : negated conditional → NO_COVERAGE |
} else if (kv.key.equals("change-node") |
98 |
1
1. insertKeyValues : negated conditional → NO_COVERAGE |
|| kv.key.equals("+node")) { |
99 |
1
1. insertKeyValues : removed call to org/graphstream/stream/file/gml/GMLContext::handleChangeNode → NO_COVERAGE |
handleChangeNode(kv); |
100 |
1
1. insertKeyValues : negated conditional → NO_COVERAGE |
} else if (kv.key.equals("change-edge") |
101 |
1
1. insertKeyValues : negated conditional → NO_COVERAGE |
|| kv.key.equals("+edge")) { |
102 |
1
1. insertKeyValues : removed call to org/graphstream/stream/file/gml/GMLContext::handleChangeEdge → NO_COVERAGE |
handleChangeEdge(kv); |
103 |
1
1. insertKeyValues : negated conditional → NO_COVERAGE |
} else if (kv.key.equals("step")) { |
104 |
1
1. insertKeyValues : removed call to org/graphstream/stream/file/gml/GMLContext::handleStep → NO_COVERAGE |
handleStep(kv); |
105 |
1
1. insertKeyValues : negated conditional → NO_COVERAGE |
} else if (kv.key.equals("directed")) { |
106 |
1
1. insertKeyValues : removed call to org/graphstream/stream/file/gml/GMLContext::setDirected → NO_COVERAGE |
setDirected(getBoolean(kv.get("directed"))); |
107 | } else { | |
108 |
1
1. insertKeyValues : negated conditional → NO_COVERAGE |
if (kv.key.startsWith("-")) { |
109 |
1
1. insertKeyValues : removed call to org/graphstream/stream/file/FileSourceGML::sendAttributeChangedEvent → NO_COVERAGE |
gml.sendAttributeChangedEvent(sourceId, sourceId, |
110 | ElementType.GRAPH, kv.key.substring(1), | |
111 | AttributeChangeEvent.REMOVE, null, null); | |
112 | } else { | |
113 |
1
1. insertKeyValues : removed call to org/graphstream/stream/file/FileSourceGML::sendAttributeChangedEvent → NO_COVERAGE |
gml.sendAttributeChangedEvent(sourceId, sourceId, |
114 | ElementType.GRAPH, kv.key, | |
115 | AttributeChangeEvent.ADD, null, | |
116 | compositeAttribute(kv)); | |
117 | } | |
118 | } | |
119 | } else { | |
120 | // XXX Should we consider these events pertain to the graph ? | |
121 | // XXX | |
122 | ||
123 |
1
1. insertKeyValues : negated conditional → NO_COVERAGE |
if (kv.key.startsWith("-")) { |
124 |
1
1. insertKeyValues : removed call to org/graphstream/stream/file/FileSourceGML::sendAttributeChangedEvent → NO_COVERAGE |
gml.sendAttributeChangedEvent(sourceId, sourceId, |
125 | ElementType.GRAPH, kv.key.substring(1), | |
126 | AttributeChangeEvent.REMOVE, null, null); | |
127 | } else { | |
128 |
1
1. insertKeyValues : removed call to org/graphstream/stream/file/FileSourceGML::sendAttributeChangedEvent → NO_COVERAGE |
gml.sendAttributeChangedEvent(sourceId, sourceId, |
129 | ElementType.GRAPH, kv.key, | |
130 | AttributeChangeEvent.ADD, null, | |
131 | compositeAttribute(kv)); | |
132 | } | |
133 | } | |
134 | } | |
135 | } | |
136 | ||
137 | protected Object compositeAttribute(KeyValues kv) { | |
138 |
2
1. compositeAttribute : changed conditional boundary → NO_COVERAGE 2. compositeAttribute : negated conditional → NO_COVERAGE |
if (kv.size() < 2) { |
139 |
1
1. compositeAttribute : mutated return of Object value for org/graphstream/stream/file/gml/GMLContext::compositeAttribute to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return kv.get(kv.key); |
140 | } else { | |
141 |
1
1. compositeAttribute : mutated return of Object value for org/graphstream/stream/file/gml/GMLContext::compositeAttribute to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return kv; |
142 | } | |
143 | } | |
144 | ||
145 | protected void handleAddNode(KeyValues kv) throws IOException { | |
146 | Object thing = kv.get("node"); | |
147 |
1
1. handleAddNode : negated conditional → NO_COVERAGE |
if (thing == null) |
148 | thing = kv.get("add-node"); | |
149 |
1
1. handleAddNode : negated conditional → NO_COVERAGE |
if (thing == null) |
150 |
1
1. handleAddNode : removed call to org/graphstream/stream/file/gml/KeyValues::error → NO_COVERAGE |
kv.error("expecting a node or add-node token here"); |
151 | ||
152 |
1
1. handleAddNode : negated conditional → NO_COVERAGE |
if (thing instanceof String) { |
153 | String id = (String) thing; | |
154 |
1
1. handleAddNode : removed call to org/graphstream/stream/file/FileSourceGML::sendNodeAdded → NO_COVERAGE |
gml.sendNodeAdded(sourceId, id); |
155 |
1
1. handleAddNode : negated conditional → NO_COVERAGE |
} else if (thing instanceof KeyValues) { |
156 | KeyValues node = (KeyValues) thing; | |
157 | String id = node.reqStringOrNumber("id"); | |
158 | ||
159 |
1
1. handleAddNode : removed call to org/graphstream/stream/file/FileSourceGML::sendNodeAdded → NO_COVERAGE |
gml.sendNodeAdded(sourceId, id); |
160 |
1
1. handleAddNode : removed call to org/graphstream/stream/file/gml/GMLContext::handleNodeAttributes → NO_COVERAGE |
handleNodeAttributes(id, node); |
161 | } else { | |
162 |
1
1. handleAddNode : removed call to org/graphstream/stream/file/gml/KeyValues::error → NO_COVERAGE |
kv.error("unknown token type"); |
163 | } | |
164 | } | |
165 | ||
166 | protected long edgeid = 0; | |
167 | ||
168 | protected void handleAddEdge(KeyValues kv) throws IOException { | |
169 | Object thing = kv.get("edge"); | |
170 |
1
1. handleAddEdge : negated conditional → NO_COVERAGE |
if (thing == null) |
171 | thing = kv.get("add-edge"); | |
172 |
1
1. handleAddEdge : negated conditional → NO_COVERAGE |
if (thing == null) |
173 |
1
1. handleAddEdge : removed call to org/graphstream/stream/file/gml/KeyValues::error → NO_COVERAGE |
kv.error("expecting a edge or add-edge token here"); |
174 |
1
1. handleAddEdge : negated conditional → NO_COVERAGE |
if (!(thing instanceof KeyValues)) |
175 |
1
1. handleAddEdge : removed call to org/graphstream/stream/file/gml/KeyValues::error → NO_COVERAGE |
kv.error("expecting a set of values for the new edge"); |
176 | ||
177 | KeyValues edge = (KeyValues) thing; | |
178 | String id = edge.optString("id"); | |
179 | ||
180 | String src = edge.reqStringOrNumber("source"); | |
181 | String trg = edge.reqStringOrNumber("target"); | |
182 | ||
183 |
1
1. handleAddEdge : negated conditional → NO_COVERAGE |
if (id == null) |
184 |
1
1. handleAddEdge : Replaced long addition with subtraction → NO_COVERAGE |
id = String.format("%s_%s_%d", src, trg, edgeid++); |
185 | ||
186 | String dir = edge.optString("directed"); | |
187 | | |
188 | boolean directed = this.directed; | |
189 | ||
190 |
1
1. handleAddEdge : negated conditional → NO_COVERAGE |
if (dir != null) { |
191 | directed = getBoolean(dir); | |
192 | } | |
193 | ||
194 |
1
1. handleAddEdge : removed call to org/graphstream/stream/file/FileSourceGML::sendEdgeAdded → NO_COVERAGE |
gml.sendEdgeAdded(sourceId, id, src, trg, directed); |
195 | ||
196 |
1
1. handleAddEdge : removed call to org/graphstream/stream/file/gml/GMLContext::handleEdgeAttributes → NO_COVERAGE |
handleEdgeAttributes(id, edge); |
197 | } | |
198 | ||
199 | protected void handleDelNode(KeyValues kv) throws IOException { | |
200 | Object thing = kv.get("del-node"); | |
201 |
1
1. handleDelNode : negated conditional → NO_COVERAGE |
if (thing == null) |
202 | thing = kv.get("-node"); | |
203 |
1
1. handleDelNode : negated conditional → NO_COVERAGE |
if (thing == null) |
204 |
1
1. handleDelNode : removed call to org/graphstream/stream/file/gml/KeyValues::error → NO_COVERAGE |
kv.error("expecting a del-node or -node token here"); |
205 | ||
206 |
1
1. handleDelNode : negated conditional → NO_COVERAGE |
if (thing instanceof String) { |
207 | String id = (String) thing; | |
208 |
1
1. handleDelNode : removed call to org/graphstream/stream/file/FileSourceGML::sendNodeRemoved → NO_COVERAGE |
gml.sendNodeRemoved(sourceId, id); |
209 |
1
1. handleDelNode : negated conditional → NO_COVERAGE |
} else if (thing instanceof KeyValues) { |
210 | KeyValues node = (KeyValues) thing; | |
211 | String id = node.reqString("id"); | |
212 |
1
1. handleDelNode : removed call to org/graphstream/stream/file/FileSourceGML::sendNodeRemoved → NO_COVERAGE |
gml.sendNodeRemoved(sourceId, id); |
213 | } else { | |
214 |
1
1. handleDelNode : removed call to org/graphstream/stream/file/gml/KeyValues::error → NO_COVERAGE |
kv.error("unknown token type"); |
215 | } | |
216 | } | |
217 | ||
218 | protected void handleDelEdge(KeyValues kv) throws IOException { | |
219 | Object thing = kv.get("del-edge"); | |
220 |
1
1. handleDelEdge : negated conditional → NO_COVERAGE |
if (thing == null) |
221 | thing = kv.get("-edge"); | |
222 |
1
1. handleDelEdge : negated conditional → NO_COVERAGE |
if (thing == null) |
223 |
1
1. handleDelEdge : removed call to org/graphstream/stream/file/gml/KeyValues::error → NO_COVERAGE |
kv.error("expecting a del-edge or -edge token here"); |
224 | ||
225 |
1
1. handleDelEdge : negated conditional → NO_COVERAGE |
if (thing instanceof String) { |
226 | String id = (String) thing; | |
227 |
1
1. handleDelEdge : removed call to org/graphstream/stream/file/FileSourceGML::sendEdgeRemoved → NO_COVERAGE |
gml.sendEdgeRemoved(sourceId, id); |
228 |
1
1. handleDelEdge : negated conditional → NO_COVERAGE |
} else if (thing instanceof KeyValues) { |
229 | KeyValues edge = (KeyValues) thing; | |
230 | String id = edge.reqString("id"); | |
231 |
1
1. handleDelEdge : removed call to org/graphstream/stream/file/FileSourceGML::sendEdgeRemoved → NO_COVERAGE |
gml.sendEdgeRemoved(sourceId, id); |
232 | } else { | |
233 |
1
1. handleDelEdge : removed call to org/graphstream/stream/file/gml/KeyValues::error → NO_COVERAGE |
kv.error("unknown token type"); |
234 | } | |
235 | } | |
236 | ||
237 | protected void handleChangeNode(KeyValues kv) throws IOException { | |
238 | Object thing = kv.get("change-node"); | |
239 |
1
1. handleChangeNode : negated conditional → NO_COVERAGE |
if (thing == null) |
240 | thing = kv.get("+node"); | |
241 |
1
1. handleChangeNode : negated conditional → NO_COVERAGE |
if (thing == null) |
242 |
1
1. handleChangeNode : removed call to org/graphstream/stream/file/gml/KeyValues::error → NO_COVERAGE |
kv.error("expecting a change-node or +node token here"); |
243 |
1
1. handleChangeNode : negated conditional → NO_COVERAGE |
if (!(thing instanceof KeyValues)) |
244 |
1
1. handleChangeNode : removed call to org/graphstream/stream/file/gml/KeyValues::error → NO_COVERAGE |
kv.error("expecting a set of values"); |
245 | ||
246 | KeyValues node = (KeyValues) thing; | |
247 | String id = node.reqString("id"); | |
248 | ||
249 |
1
1. handleChangeNode : removed call to org/graphstream/stream/file/gml/GMLContext::handleNodeAttributes → NO_COVERAGE |
handleNodeAttributes(id, node); |
250 | } | |
251 | ||
252 | protected void handleChangeEdge(KeyValues kv) throws IOException { | |
253 | Object thing = kv.get("change-edge"); | |
254 |
1
1. handleChangeEdge : negated conditional → NO_COVERAGE |
if (thing == null) |
255 | thing = kv.get("+edge"); | |
256 |
1
1. handleChangeEdge : negated conditional → NO_COVERAGE |
if (thing == null) |
257 |
1
1. handleChangeEdge : removed call to org/graphstream/stream/file/gml/KeyValues::error → NO_COVERAGE |
kv.error("expecting a change-edge or +edge token here"); |
258 |
1
1. handleChangeEdge : negated conditional → NO_COVERAGE |
if (!(thing instanceof KeyValues)) |
259 |
1
1. handleChangeEdge : removed call to org/graphstream/stream/file/gml/KeyValues::error → NO_COVERAGE |
kv.error("expecting a set of values"); |
260 | ||
261 | KeyValues edge = (KeyValues) thing; | |
262 | String id = edge.reqString("id"); | |
263 | ||
264 |
1
1. handleChangeEdge : removed call to org/graphstream/stream/file/gml/GMLContext::handleEdgeAttributes → NO_COVERAGE |
handleEdgeAttributes(id, edge); |
265 | } | |
266 | ||
267 | protected void handleNodeAttributes(String id, KeyValues node) { | |
268 |
1
1. handleNodeAttributes : negated conditional → NO_COVERAGE |
for (String key : node.keySet()) { |
269 |
1
1. handleNodeAttributes : negated conditional → NO_COVERAGE |
if (key.startsWith("-")) { |
270 |
1
1. handleNodeAttributes : negated conditional → NO_COVERAGE |
if (key.equals("-label")) |
271 | key = "-ui.label"; | |
272 | ||
273 |
1
1. handleNodeAttributes : removed call to org/graphstream/stream/file/FileSourceGML::sendAttributeChangedEvent → NO_COVERAGE |
gml.sendAttributeChangedEvent(sourceId, id, ElementType.NODE, |
274 | key.substring(1), AttributeChangeEvent.REMOVE, null, | |
275 | null); | |
276 | } else { | |
277 |
1
1. handleNodeAttributes : negated conditional → NO_COVERAGE |
if (key.equals("graphics") |
278 |
1
1. handleNodeAttributes : negated conditional → NO_COVERAGE |
&& node.get("graphics") instanceof KeyValues) { |
279 | Graphics graphics = optNodeStyle((KeyValues) node | |
280 | .get("graphics")); | |
281 | ||
282 |
1
1. handleNodeAttributes : negated conditional → NO_COVERAGE |
if (graphics != null) { |
283 |
1
1. handleNodeAttributes : negated conditional → NO_COVERAGE |
if (graphics.position != null) { |
284 |
1
1. handleNodeAttributes : removed call to org/graphstream/stream/file/FileSourceGML::sendAttributeChangedEvent → NO_COVERAGE |
gml.sendAttributeChangedEvent(sourceId, id, |
285 | ElementType.NODE, "xyz", | |
286 | AttributeChangeEvent.ADD, null, | |
287 | graphics.getPosition()); | |
288 | } | |
289 |
1
1. handleNodeAttributes : negated conditional → NO_COVERAGE |
if (graphics.style != null) { |
290 |
1
1. handleNodeAttributes : removed call to org/graphstream/stream/file/FileSourceGML::sendAttributeChangedEvent → NO_COVERAGE |
gml.sendAttributeChangedEvent(sourceId, id, |
291 | ElementType.NODE, "ui.style", | |
292 | AttributeChangeEvent.ADD, null, | |
293 | graphics.style); | |
294 | } | |
295 | } | |
296 | } else { | |
297 | String k = key; | |
298 | ||
299 |
1
1. handleNodeAttributes : negated conditional → NO_COVERAGE |
if (key.equals("label")) |
300 | k = "ui.label"; | |
301 | ||
302 |
1
1. handleNodeAttributes : removed call to org/graphstream/stream/file/FileSourceGML::sendAttributeChangedEvent → NO_COVERAGE |
gml.sendAttributeChangedEvent(sourceId, id, |
303 | ElementType.NODE, k, AttributeChangeEvent.ADD, | |
304 | null, node.get(key)); | |
305 | } | |
306 | } | |
307 | } | |
308 | } | |
309 | ||
310 | protected void handleEdgeAttributes(String id, KeyValues edge) { | |
311 |
1
1. handleEdgeAttributes : negated conditional → NO_COVERAGE |
for (String key : edge.keySet()) { |
312 |
1
1. handleEdgeAttributes : negated conditional → NO_COVERAGE |
if (key.startsWith("-")) { |
313 |
1
1. handleEdgeAttributes : negated conditional → NO_COVERAGE |
if (key.equals("-label")) |
314 | key = "-ui.label"; | |
315 | ||
316 |
1
1. handleEdgeAttributes : removed call to org/graphstream/stream/file/FileSourceGML::sendAttributeChangedEvent → NO_COVERAGE |
gml.sendAttributeChangedEvent(sourceId, id, ElementType.EDGE, |
317 | key.substring(1), AttributeChangeEvent.REMOVE, null, | |
318 | null); | |
319 | } else { | |
320 |
1
1. handleEdgeAttributes : negated conditional → NO_COVERAGE |
if (key.equals("graphics") |
321 |
1
1. handleEdgeAttributes : negated conditional → NO_COVERAGE |
&& edge.get("graphics") instanceof KeyValues) { |
322 | Graphics graphics = optEdgeStyle((KeyValues) edge | |
323 | .get("graphics")); | |
324 | ||
325 |
1
1. handleEdgeAttributes : negated conditional → NO_COVERAGE |
if (graphics != null) { |
326 |
1
1. handleEdgeAttributes : negated conditional → NO_COVERAGE |
if (graphics.style != null) { |
327 |
1
1. handleEdgeAttributes : removed call to org/graphstream/stream/file/FileSourceGML::sendAttributeChangedEvent → NO_COVERAGE |
gml.sendAttributeChangedEvent(sourceId, id, |
328 | ElementType.EDGE, "ui.style", | |
329 | AttributeChangeEvent.ADD, null, | |
330 | graphics.style); | |
331 | } | |
332 | } | |
333 | } else { | |
334 | String k = key; | |
335 | ||
336 |
1
1. handleEdgeAttributes : negated conditional → NO_COVERAGE |
if (key.equals("label")) |
337 | k = "ui.label"; | |
338 | ||
339 |
1
1. handleEdgeAttributes : removed call to org/graphstream/stream/file/FileSourceGML::sendAttributeChangedEvent → NO_COVERAGE |
gml.sendAttributeChangedEvent(sourceId, id, |
340 | ElementType.EDGE, k, AttributeChangeEvent.ADD, | |
341 | null, edge.get(key)); | |
342 | } | |
343 | } | |
344 | } | |
345 | } | |
346 | ||
347 | protected void handleStep(KeyValues kv) throws IOException { | |
348 |
1
1. handleStep : removed call to org/graphstream/stream/file/FileSourceGML::sendStepBegins → NO_COVERAGE |
gml.sendStepBegins(sourceId, kv.reqNumber("step")); |
349 | } | |
350 | ||
351 | protected Graphics optNodeStyle(KeyValues kv) { | |
352 | Graphics graphics = null; | |
353 | ||
354 |
1
1. optNodeStyle : negated conditional → NO_COVERAGE |
if (kv != null) { |
355 | StringBuffer style = new StringBuffer(); | |
356 | String w = null, h = null, d = null; | |
357 | graphics = new Graphics(); | |
358 | ||
359 |
1
1. optNodeStyle : negated conditional → NO_COVERAGE |
if (kv.get("x") != null) { |
360 |
1
1. optNodeStyle : removed call to org/graphstream/stream/file/gml/Graphics::setX → NO_COVERAGE |
graphics.setX(asDouble((String) kv.get("x"))); |
361 | } | |
362 |
1
1. optNodeStyle : negated conditional → NO_COVERAGE |
if (kv.get("y") != null) { |
363 |
1
1. optNodeStyle : removed call to org/graphstream/stream/file/gml/Graphics::setY → NO_COVERAGE |
graphics.setY(asDouble((String) kv.get("y"))); |
364 | } | |
365 |
1
1. optNodeStyle : negated conditional → NO_COVERAGE |
if (kv.get("z") != null) { |
366 |
1
1. optNodeStyle : removed call to org/graphstream/stream/file/gml/Graphics::setZ → NO_COVERAGE |
graphics.setZ(asDouble((String) kv.get("z"))); |
367 | } | |
368 |
1
1. optNodeStyle : negated conditional → NO_COVERAGE |
if (kv.get("w") != null) { |
369 | w = (String) kv.get("w"); | |
370 | } | |
371 |
1
1. optNodeStyle : negated conditional → NO_COVERAGE |
if (kv.get("h") != null) { |
372 | h = (String) kv.get("h"); | |
373 | } | |
374 |
1
1. optNodeStyle : negated conditional → NO_COVERAGE |
if (kv.get("d") != null) { |
375 | d = (String) kv.get("d"); | |
376 | } | |
377 |
3
1. optNodeStyle : negated conditional → NO_COVERAGE 2. optNodeStyle : negated conditional → NO_COVERAGE 3. optNodeStyle : negated conditional → NO_COVERAGE |
if (w != null || h != null || d != null) { |
378 |
1
1. optNodeStyle : negated conditional → NO_COVERAGE |
int ww = w != null ? (int) asDouble(w) : 0; |
379 |
1
1. optNodeStyle : negated conditional → NO_COVERAGE |
int hh = h != null ? (int) asDouble(h) : 0; |
380 |
1
1. optNodeStyle : negated conditional → NO_COVERAGE |
int dd = d != null ? (int) asDouble(d) : 0; |
381 | style.append(String.format("size: %dpx, %dpx, %dpx; ", ww, hh, | |
382 | dd)); | |
383 | } | |
384 |
1
1. optNodeStyle : negated conditional → NO_COVERAGE |
if (kv.get("type") != null) { |
385 | style.append(String.format("shape: %s; ", | |
386 | asNodeShape((String) kv.get("type")))); | |
387 | } | |
388 | ||
389 |
1
1. optNodeStyle : removed call to org/graphstream/stream/file/gml/GMLContext::commonGraphicsAttributes → NO_COVERAGE |
commonGraphicsAttributes(kv, style); |
390 | graphics.style = style.toString(); | |
391 | } | |
392 | ||
393 |
1
1. optNodeStyle : mutated return of Object value for org/graphstream/stream/file/gml/GMLContext::optNodeStyle to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return graphics; |
394 | } | |
395 | ||
396 | protected Graphics optEdgeStyle(KeyValues kv) { | |
397 | Graphics graphics = null; | |
398 | ||
399 |
1
1. optEdgeStyle : negated conditional → NO_COVERAGE |
if (kv != null) { |
400 | StringBuffer style = new StringBuffer(); | |
401 | String w = null; | |
402 | graphics = new Graphics(); | |
403 | ||
404 |
1
1. optEdgeStyle : negated conditional → NO_COVERAGE |
if (kv.get("width") != null) { |
405 | w = (String) kv.get("width"); | |
406 |
1
1. optEdgeStyle : negated conditional → NO_COVERAGE |
} else if (kv.get("w") != null) { |
407 | w = (String) kv.get("w"); | |
408 | } | |
409 |
1
1. optEdgeStyle : negated conditional → NO_COVERAGE |
if (w != null) { |
410 |
1
1. optEdgeStyle : negated conditional → NO_COVERAGE |
double ww = w != null ? asDouble(w) : 0.0; |
411 | style.append(String.format("size: %fpx;", ww)); | |
412 | } | |
413 |
1
1. optEdgeStyle : negated conditional → NO_COVERAGE |
if (kv.get("type") != null) { |
414 | style.append(String.format("shape: %s; ", | |
415 | asEdgeShape((String) kv.get("type")))); | |
416 | } | |
417 | ||
418 |
1
1. optEdgeStyle : removed call to org/graphstream/stream/file/gml/GMLContext::commonGraphicsAttributes → NO_COVERAGE |
commonGraphicsAttributes(kv, style); |
419 | graphics.style = style.toString(); | |
420 | } | |
421 | ||
422 |
1
1. optEdgeStyle : mutated return of Object value for org/graphstream/stream/file/gml/GMLContext::optEdgeStyle to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return graphics; |
423 | } | |
424 | ||
425 | protected void commonGraphicsAttributes(KeyValues kv, StringBuffer style) { | |
426 |
1
1. commonGraphicsAttributes : negated conditional → NO_COVERAGE |
if (kv.get("fill") != null) { |
427 | style.append(String.format("fill-color: %s; ", kv.get("fill"))); | |
428 | } | |
429 |
1
1. commonGraphicsAttributes : negated conditional → NO_COVERAGE |
if (kv.get("outline") != null) { |
430 | style.append(String.format("stroke-color: %s; ", kv.get("outline"))); | |
431 | } | |
432 |
1
1. commonGraphicsAttributes : negated conditional → NO_COVERAGE |
if (kv.get("outline_width") != null) { |
433 | style.append(String.format("stroke-width: %spx; ", | |
434 | kv.get("outline_width"))); | |
435 | } | |
436 |
2
1. commonGraphicsAttributes : negated conditional → NO_COVERAGE 2. commonGraphicsAttributes : negated conditional → NO_COVERAGE |
if ((kv.get("outline") != null) || (kv.get("outline_width") != null)) { |
437 | style.append("stroke-mode: plain; "); | |
438 | } | |
439 |
1
1. commonGraphicsAttributes : negated conditional → NO_COVERAGE |
if (kv.get("anchor") != null) { |
440 | style.append(String.format("text-alginment: %s; ", | |
441 | asTextAlignment((String) kv.get("anchor")))); | |
442 | } | |
443 |
1
1. commonGraphicsAttributes : negated conditional → NO_COVERAGE |
if (kv.get("image") != null) { |
444 | style.append(String.format("icon-mode: at-left; icon: %s; ", | |
445 | (String) kv.get("image"))); | |
446 | } | |
447 |
1
1. commonGraphicsAttributes : negated conditional → NO_COVERAGE |
if (kv.get("arrow") != null) { |
448 | style.append(String.format("arrow-shape: %s; ", | |
449 | asArrowShape((String) kv.get("arrow")))); | |
450 | } | |
451 |
1
1. commonGraphicsAttributes : negated conditional → NO_COVERAGE |
if (kv.get("font") != null) { |
452 | style.append(String.format("font: %s; ", (String) kv.get("font"))); | |
453 | } | |
454 | } | |
455 | ||
456 | protected double asDouble(String value) { | |
457 | try { | |
458 |
1
1. asDouble : replaced return of double value with -(x + 1) for org/graphstream/stream/file/gml/GMLContext::asDouble → NO_COVERAGE |
return Double.parseDouble(value); |
459 | } catch (NumberFormatException e) { | |
460 |
1
1. asDouble : replaced return of double value with -(x + 1) for org/graphstream/stream/file/gml/GMLContext::asDouble → NO_COVERAGE |
return 0.0; |
461 | } | |
462 | } | |
463 | ||
464 | protected String asNodeShape(String type) { | |
465 |
2
1. asNodeShape : negated conditional → NO_COVERAGE 2. asNodeShape : negated conditional → NO_COVERAGE |
if (type.equals("ellipse") || type.equals("oval")) { |
466 |
1
1. asNodeShape : mutated return of Object value for org/graphstream/stream/file/gml/GMLContext::asNodeShape to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "circle"; |
467 |
2
1. asNodeShape : negated conditional → NO_COVERAGE 2. asNodeShape : negated conditional → NO_COVERAGE |
} else if (type.equals("rectangle") || type.equals("box")) { |
468 |
1
1. asNodeShape : mutated return of Object value for org/graphstream/stream/file/gml/GMLContext::asNodeShape to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "box"; |
469 |
1
1. asNodeShape : negated conditional → NO_COVERAGE |
} else if (type.equals("rounded-box")) { |
470 |
1
1. asNodeShape : mutated return of Object value for org/graphstream/stream/file/gml/GMLContext::asNodeShape to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "rounded-box"; |
471 |
1
1. asNodeShape : negated conditional → NO_COVERAGE |
} else if (type.equals("cross")) { |
472 |
1
1. asNodeShape : mutated return of Object value for org/graphstream/stream/file/gml/GMLContext::asNodeShape to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "cross"; |
473 |
1
1. asNodeShape : negated conditional → NO_COVERAGE |
} else if (type.equals("freeplane")) { |
474 |
1
1. asNodeShape : mutated return of Object value for org/graphstream/stream/file/gml/GMLContext::asNodeShape to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "freeplane"; |
475 |
2
1. asNodeShape : negated conditional → NO_COVERAGE 2. asNodeShape : negated conditional → NO_COVERAGE |
} else if (type.equals("losange") || type.equals("diamond")) { |
476 |
1
1. asNodeShape : mutated return of Object value for org/graphstream/stream/file/gml/GMLContext::asNodeShape to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "diamond"; |
477 | } else { | |
478 |
1
1. asNodeShape : mutated return of Object value for org/graphstream/stream/file/gml/GMLContext::asNodeShape to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "circle"; |
479 | } | |
480 | } | |
481 | ||
482 | protected String asEdgeShape(String type) { | |
483 |
1
1. asEdgeShape : negated conditional → NO_COVERAGE |
if (type.equals("line")) { |
484 |
1
1. asEdgeShape : mutated return of Object value for org/graphstream/stream/file/gml/GMLContext::asEdgeShape to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "line"; |
485 |
1
1. asEdgeShape : negated conditional → NO_COVERAGE |
} else if (type.equals("cubic-curve")) { |
486 |
1
1. asEdgeShape : mutated return of Object value for org/graphstream/stream/file/gml/GMLContext::asEdgeShape to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "cubic-curve"; |
487 |
1
1. asEdgeShape : negated conditional → NO_COVERAGE |
} else if (type.equals("angle")) { |
488 |
1
1. asEdgeShape : mutated return of Object value for org/graphstream/stream/file/gml/GMLContext::asEdgeShape to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "angle"; |
489 |
1
1. asEdgeShape : negated conditional → NO_COVERAGE |
} else if (type.equals("blob")) { |
490 |
1
1. asEdgeShape : mutated return of Object value for org/graphstream/stream/file/gml/GMLContext::asEdgeShape to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "blob"; |
491 |
1
1. asEdgeShape : negated conditional → NO_COVERAGE |
} else if (type.equals("freeplane")) { |
492 |
1
1. asEdgeShape : mutated return of Object value for org/graphstream/stream/file/gml/GMLContext::asEdgeShape to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "freeplane"; |
493 | } else { | |
494 |
1
1. asEdgeShape : mutated return of Object value for org/graphstream/stream/file/gml/GMLContext::asEdgeShape to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "line"; |
495 | } | |
496 | } | |
497 | ||
498 | protected String asTextAlignment(String anchor) { | |
499 |
1
1. asTextAlignment : negated conditional → NO_COVERAGE |
if (anchor.equals("c")) { |
500 |
1
1. asTextAlignment : mutated return of Object value for org/graphstream/stream/file/gml/GMLContext::asTextAlignment to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "center"; |
501 |
1
1. asTextAlignment : negated conditional → NO_COVERAGE |
} else if (anchor.equals("n")) { |
502 |
1
1. asTextAlignment : mutated return of Object value for org/graphstream/stream/file/gml/GMLContext::asTextAlignment to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "above"; |
503 |
1
1. asTextAlignment : negated conditional → NO_COVERAGE |
} else if (anchor.equals("ne")) { |
504 |
1
1. asTextAlignment : mutated return of Object value for org/graphstream/stream/file/gml/GMLContext::asTextAlignment to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "at-right"; |
505 |
1
1. asTextAlignment : negated conditional → NO_COVERAGE |
} else if (anchor.equals("e")) { |
506 |
1
1. asTextAlignment : mutated return of Object value for org/graphstream/stream/file/gml/GMLContext::asTextAlignment to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "at-right"; |
507 |
1
1. asTextAlignment : negated conditional → NO_COVERAGE |
} else if (anchor.equals("se")) { |
508 |
1
1. asTextAlignment : mutated return of Object value for org/graphstream/stream/file/gml/GMLContext::asTextAlignment to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "at-right"; |
509 |
1
1. asTextAlignment : negated conditional → NO_COVERAGE |
} else if (anchor.equals("s")) { |
510 |
1
1. asTextAlignment : mutated return of Object value for org/graphstream/stream/file/gml/GMLContext::asTextAlignment to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "under"; |
511 |
1
1. asTextAlignment : negated conditional → NO_COVERAGE |
} else if (anchor.equals("sw")) { |
512 |
1
1. asTextAlignment : mutated return of Object value for org/graphstream/stream/file/gml/GMLContext::asTextAlignment to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "at-left"; |
513 |
1
1. asTextAlignment : negated conditional → NO_COVERAGE |
} else if (anchor.equals("w")) { |
514 |
1
1. asTextAlignment : mutated return of Object value for org/graphstream/stream/file/gml/GMLContext::asTextAlignment to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "at-left"; |
515 |
1
1. asTextAlignment : negated conditional → NO_COVERAGE |
} else if (anchor.equals("nw")) { |
516 |
1
1. asTextAlignment : mutated return of Object value for org/graphstream/stream/file/gml/GMLContext::asTextAlignment to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "at-left"; |
517 | } else { | |
518 |
1
1. asTextAlignment : mutated return of Object value for org/graphstream/stream/file/gml/GMLContext::asTextAlignment to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "center"; |
519 | } | |
520 | } | |
521 | ||
522 | protected String asArrowShape(String arrow) { | |
523 |
1
1. asArrowShape : negated conditional → NO_COVERAGE |
if (arrow.equals("none")) { |
524 |
1
1. asArrowShape : mutated return of Object value for org/graphstream/stream/file/gml/GMLContext::asArrowShape to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "none"; |
525 |
1
1. asArrowShape : negated conditional → NO_COVERAGE |
} else if (arrow.equals("last")) { |
526 |
1
1. asArrowShape : mutated return of Object value for org/graphstream/stream/file/gml/GMLContext::asArrowShape to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "arrow"; |
527 | } else { | |
528 |
1
1. asArrowShape : mutated return of Object value for org/graphstream/stream/file/gml/GMLContext::asArrowShape to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "none"; |
529 | } | |
530 | } | |
531 | ||
532 | protected boolean getBoolean(Object bool) { | |
533 |
1
1. getBoolean : negated conditional → NO_COVERAGE |
if(bool instanceof String) { |
534 |
5
1. getBoolean : negated conditional → NO_COVERAGE 2. getBoolean : negated conditional → NO_COVERAGE 3. getBoolean : negated conditional → NO_COVERAGE 4. getBoolean : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE 5. getBoolean : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return (bool.equals("1") || bool.equals("true") || bool.equals("yes") |
535 |
1
1. getBoolean : negated conditional → NO_COVERAGE |
|| bool.equals("y")); |
536 |
1
1. getBoolean : negated conditional → NO_COVERAGE |
} else if(bool instanceof Number) { |
537 |
3
1. getBoolean : negated conditional → NO_COVERAGE 2. getBoolean : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE 3. getBoolean : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return (((Number)bool).doubleValue() != 0); |
538 | } | |
539 |
1
1. getBoolean : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return false; |
540 | } | |
541 | } | |
542 | ||
543 | class Graphics { | |
544 | public double[] position = null; | |
545 | public String style = null; | |
546 | ||
547 | public void setX(double value) { | |
548 |
1
1. setX : negated conditional → NO_COVERAGE |
if (position == null) |
549 | position = new double[3]; | |
550 | ||
551 | position[0] = value; | |
552 | } | |
553 | ||
554 | public void setY(double value) { | |
555 |
1
1. setY : negated conditional → NO_COVERAGE |
if (position == null) |
556 | position = new double[3]; | |
557 | ||
558 | position[1] = value; | |
559 | } | |
560 | ||
561 | public void setZ(double value) { | |
562 |
1
1. setZ : negated conditional → NO_COVERAGE |
if (position == null) |
563 | position = new double[3]; | |
564 | ||
565 | position[2] = value; | |
566 | } | |
567 | ||
568 | public Object[] getPosition() { | |
569 | Object p[] = new Object[3]; | |
570 | p[0] = (Double) position[0]; | |
571 | p[1] = (Double) position[1]; | |
572 | p[2] = (Double) position[2]; | |
573 |
1
1. getPosition : mutated return of Object value for org/graphstream/stream/file/gml/Graphics::getPosition to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return p; |
574 | } | |
575 | } | |
576 | ||
577 | class KeyValues extends HashMap<String, Object> { | |
578 | private static final long serialVersionUID = 5920553787913520204L; | |
579 | ||
580 | public String key; | |
581 | public int line; | |
582 | public int column; | |
583 | ||
584 | public void print() { | |
585 | System.err.printf("%s:%n", key); | |
586 |
1
1. print : negated conditional → NO_COVERAGE |
for (String k : keySet()) { |
587 | System.err.printf(" %s: %s%n", k, get(k)); | |
588 | } | |
589 | } | |
590 | ||
591 | public String optString(String key) throws IOException { | |
592 | Object o = get(key); | |
593 | ||
594 |
1
1. optString : negated conditional → NO_COVERAGE |
if (o == null) |
595 |
1
1. optString : mutated return of Object value for org/graphstream/stream/file/gml/KeyValues::optString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return null; |
596 | ||
597 |
1
1. optString : negated conditional → NO_COVERAGE |
if (o instanceof Number) |
598 | o = o.toString(); | |
599 | | |
600 |
1
1. optString : negated conditional → NO_COVERAGE |
if (!(o instanceof String)) |
601 | throw new IOException( | |
602 | String.format( | |
603 | "%d:%d: expecting a string or number value for tag %s, got a list of values", | |
604 | line, column, key)); | |
605 | ||
606 | remove(key); | |
607 |
1
1. optString : mutated return of Object value for org/graphstream/stream/file/gml/KeyValues::optString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return (String) o; |
608 | } | |
609 | ||
610 | protected String reqString(String key) throws IOException { | |
611 | Object o = get(key); | |
612 | ||
613 |
1
1. reqString : negated conditional → NO_COVERAGE |
if (o == null) |
614 | throw new IOException(String.format( | |
615 | "%d:%d: expecting a tag %s but none found", line, column, | |
616 | key)); | |
617 | ||
618 |
1
1. reqString : negated conditional → NO_COVERAGE |
if (!(o instanceof String)) |
619 | throw new IOException( | |
620 | String.format( | |
621 | "%d:%d: expecting a string or number value for tag %s, got a list of values", | |
622 | line, column, key)); | |
623 | ||
624 | remove(key); | |
625 | ||
626 |
1
1. reqString : mutated return of Object value for org/graphstream/stream/file/gml/KeyValues::reqString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return (String) o; |
627 | } | |
628 | ||
629 | protected String reqStringOrNumber(String key) throws IOException { | |
630 | Object o = get(key); | |
631 | ||
632 |
1
1. reqStringOrNumber : negated conditional → NO_COVERAGE |
if (o == null) |
633 | throw new IOException(String.format( | |
634 | "%d:%d: expecting a tag %s but none found", line, column, | |
635 | key)); | |
636 | ||
637 |
2
1. reqStringOrNumber : negated conditional → NO_COVERAGE 2. reqStringOrNumber : negated conditional → NO_COVERAGE |
if (!(o instanceof String) && !(o instanceof Number)) |
638 | throw new IOException( | |
639 | String.format( | |
640 | "%d:%d: expecting a string or number value for tag %s, got a list of values", | |
641 | line, column, key)); | |
642 | ||
643 | remove(key); | |
644 | ||
645 |
1
1. reqStringOrNumber : negated conditional → NO_COVERAGE |
if(o instanceof Number) { |
646 | o = o.toString(); | |
647 | } | |
648 | | |
649 |
1
1. reqStringOrNumber : mutated return of Object value for org/graphstream/stream/file/gml/KeyValues::reqStringOrNumber to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return (String) o; |
650 | } | |
651 | ||
652 | protected double reqNumber(String key) throws IOException { | |
653 | Object o = get(key); | |
654 | double v = 0.0; | |
655 | ||
656 |
1
1. reqNumber : negated conditional → NO_COVERAGE |
if (o == null) |
657 | throw new IOException(String.format( | |
658 | "%d:%d: expecting a tag %s but none found", line, column, | |
659 | key)); | |
660 | ||
661 |
1
1. reqNumber : negated conditional → NO_COVERAGE |
if (!(o instanceof String)) |
662 | throw new IOException( | |
663 | String.format( | |
664 | "%d:%d expecting a string or number value for tag %s, got a list of values", | |
665 | line, column, key)); | |
666 | ||
667 | try { | |
668 | remove(key); | |
669 | v = Double.parseDouble((String) o); | |
670 | } catch (NumberFormatException e) { | |
671 | throw new IOException(String.format( | |
672 | "%d:%d: expecting a number value for tag %s, got a string", | |
673 | line, column, key)); | |
674 | } | |
675 | ||
676 |
1
1. reqNumber : replaced return of double value with -(x + 1) for org/graphstream/stream/file/gml/KeyValues::reqNumber → NO_COVERAGE |
return v; |
677 | } | |
678 | ||
679 | protected KeyValues optKeyValues(String key) throws IOException { | |
680 | Object o = get(key); | |
681 | ||
682 |
1
1. optKeyValues : negated conditional → NO_COVERAGE |
if (o == null) |
683 |
1
1. optKeyValues : mutated return of Object value for org/graphstream/stream/file/gml/KeyValues::optKeyValues to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return null; |
684 | ||
685 |
1
1. optKeyValues : negated conditional → NO_COVERAGE |
if (!(o instanceof KeyValues)) |
686 | throw new IOException( | |
687 | String.format( | |
688 | "%d:%d: expecting a list of values for tag %s, got a string or number", | |
689 | line, column, key)); | |
690 | ||
691 | remove(key); | |
692 | ||
693 |
1
1. optKeyValues : mutated return of Object value for org/graphstream/stream/file/gml/KeyValues::optKeyValues to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return (KeyValues) o; |
694 | } | |
695 | ||
696 | protected KeyValues reqKeyValues(String key) throws IOException { | |
697 | Object o = get(key); | |
698 | ||
699 |
1
1. reqKeyValues : negated conditional → NO_COVERAGE |
if (o == null) |
700 | throw new IOException(String.format( | |
701 | "%d:%d: expecting a tag %s but none found", line, column, | |
702 | key)); | |
703 | ||
704 |
1
1. reqKeyValues : negated conditional → NO_COVERAGE |
if (!(o instanceof KeyValues)) |
705 | throw new IOException( | |
706 | String.format( | |
707 | "%d:%d: expecting a list of values for tag %s, got a string or number", | |
708 | line, column, key)); | |
709 | ||
710 | remove(key); | |
711 | ||
712 |
1
1. reqKeyValues : mutated return of Object value for org/graphstream/stream/file/gml/KeyValues::reqKeyValues to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return (KeyValues) o; |
713 | } | |
714 | ||
715 | protected void error(String message) throws IOException { | |
716 | throw new IOException(String.format("%d:%d: %s", line, column, message)); | |
717 | } | |
718 | } | |
Mutations | ||
56 |
1.1 |
|
57 |
1.1 |
|
62 |
1.1 |
|
63 |
1.1 |
|
87 |
1.1 |
|
88 |
1.1 |
|
89 |
1.1 2.2 |
|
90 |
1.1 |
|
91 |
1.1 2.2 |
|
92 |
1.1 |
|
93 |
1.1 2.2 |
|
94 |
1.1 |
|
95 |
1.1 2.2 |
|
96 |
1.1 |
|
97 |
1.1 |
|
98 |
1.1 |
|
99 |
1.1 |
|
100 |
1.1 |
|
101 |
1.1 |
|
102 |
1.1 |
|
103 |
1.1 |
|
104 |
1.1 |
|
105 |
1.1 |
|
106 |
1.1 |
|
108 |
1.1 |
|
109 |
1.1 |
|
113 |
1.1 |
|
123 |
1.1 |
|
124 |
1.1 |
|
128 |
1.1 |
|
138 |
1.1 2.2 |
|
139 |
1.1 |
|
141 |
1.1 |
|
147 |
1.1 |
|
149 |
1.1 |
|
150 |
1.1 |
|
152 |
1.1 |
|
154 |
1.1 |
|
155 |
1.1 |
|
159 |
1.1 |
|
160 |
1.1 |
|
162 |
1.1 |
|
170 |
1.1 |
|
172 |
1.1 |
|
173 |
1.1 |
|
174 |
1.1 |
|
175 |
1.1 |
|
183 |
1.1 |
|
184 |
1.1 |
|
190 |
1.1 |
|
194 |
1.1 |
|
196 |
1.1 |
|
201 |
1.1 |
|
203 |
1.1 |
|
204 |
1.1 |
|
206 |
1.1 |
|
208 |
1.1 |
|
209 |
1.1 |
|
212 |
1.1 |
|
214 |
1.1 |
|
220 |
1.1 |
|
222 |
1.1 |
|
223 |
1.1 |
|
225 |
1.1 |
|
227 |
1.1 |
|
228 |
1.1 |
|
231 |
1.1 |
|
233 |
1.1 |
|
239 |
1.1 |
|
241 |
1.1 |
|
242 |
1.1 |
|
243 |
1.1 |
|
244 |
1.1 |
|
249 |
1.1 |
|
254 |
1.1 |
|
256 |
1.1 |
|
257 |
1.1 |
|
258 |
1.1 |
|
259 |
1.1 |
|
264 |
1.1 |
|
268 |
1.1 |
|
269 |
1.1 |
|
270 |
1.1 |
|
273 |
1.1 |
|
277 |
1.1 |
|
278 |
1.1 |
|
282 |
1.1 |
|
283 |
1.1 |
|
284 |
1.1 |
|
289 |
1.1 |
|
290 |
1.1 |
|
299 |
1.1 |
|
302 |
1.1 |
|
311 |
1.1 |
|
312 |
1.1 |
|
313 |
1.1 |
|
316 |
1.1 |
|
320 |
1.1 |
|
321 |
1.1 |
|
325 |
1.1 |
|
326 |
1.1 |
|
327 |
1.1 |
|
336 |
1.1 |
|
339 |
1.1 |
|
348 |
1.1 |
|
354 |
1.1 |
|
359 |
1.1 |
|
360 |
1.1 |
|
362 |
1.1 |
|
363 |
1.1 |
|
365 |
1.1 |
|
366 |
1.1 |
|
368 |
1.1 |
|
371 |
1.1 |
|
374 |
1.1 |
|
377 |
1.1 2.2 3.3 |
|
378 |
1.1 |
|
379 |
1.1 |
|
380 |
1.1 |
|
384 |
1.1 |
|
389 |
1.1 |
|
393 |
1.1 |
|
399 |
1.1 |
|
404 |
1.1 |
|
406 |
1.1 |
|
409 |
1.1 |
|
410 |
1.1 |
|
413 |
1.1 |
|
418 |
1.1 |
|
422 |
1.1 |
|
426 |
1.1 |
|
429 |
1.1 |
|
432 |
1.1 |
|
436 |
1.1 2.2 |
|
439 |
1.1 |
|
443 |
1.1 |
|
447 |
1.1 |
|
451 |
1.1 |
|
458 |
1.1 |
|
460 |
1.1 |
|
465 |
1.1 2.2 |
|
466 |
1.1 |
|
467 |
1.1 2.2 |
|
468 |
1.1 |
|
469 |
1.1 |
|
470 |
1.1 |
|
471 |
1.1 |
|
472 |
1.1 |
|
473 |
1.1 |
|
474 |
1.1 |
|
475 |
1.1 2.2 |
|
476 |
1.1 |
|
478 |
1.1 |
|
483 |
1.1 |
|
484 |
1.1 |
|
485 |
1.1 |
|
486 |
1.1 |
|
487 |
1.1 |
|
488 |
1.1 |
|
489 |
1.1 |
|
490 |
1.1 |
|
491 |
1.1 |
|
492 |
1.1 |
|
494 |
1.1 |
|
499 |
1.1 |
|
500 |
1.1 |
|
501 |
1.1 |
|
502 |
1.1 |
|
503 |
1.1 |
|
504 |
1.1 |
|
505 |
1.1 |
|
506 |
1.1 |
|
507 |
1.1 |
|
508 |
1.1 |
|
509 |
1.1 |
|
510 |
1.1 |
|
511 |
1.1 |
|
512 |
1.1 |
|
513 |
1.1 |
|
514 |
1.1 |
|
515 |
1.1 |
|
516 |
1.1 |
|
518 |
1.1 |
|
523 |
1.1 |
|
524 |
1.1 |
|
525 |
1.1 |
|
526 |
1.1 |
|
528 |
1.1 |
|
533 |
1.1 |
|
534 |
1.1 2.2 3.3 4.4 5.5 |
|
535 |
1.1 |
|
536 |
1.1 |
|
537 |
1.1 2.2 3.3 |
|
539 |
1.1 |
|
548 |
1.1 |
|
555 |
1.1 |
|
562 |
1.1 |
|
573 |
1.1 |
|
586 |
1.1 |
|
594 |
1.1 |
|
595 |
1.1 |
|
597 |
1.1 |
|
600 |
1.1 |
|
607 |
1.1 |
|
613 |
1.1 |
|
618 |
1.1 |
|
626 |
1.1 |
|
632 |
1.1 |
|
637 |
1.1 2.2 |
|
645 |
1.1 |
|
649 |
1.1 |
|
656 |
1.1 |
|
661 |
1.1 |
|
676 |
1.1 |
|
682 |
1.1 |
|
683 |
1.1 |
|
685 |
1.1 |
|
693 |
1.1 |
|
699 |
1.1 |
|
704 |
1.1 |
|
712 |
1.1 |