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; | |
33 | ||
34 | import java.io.FileReader; | |
35 | import java.io.IOException; | |
36 | import java.io.InputStream; | |
37 | import java.io.InputStreamReader; | |
38 | import java.io.Reader; | |
39 | import java.net.URL; | |
40 | import java.util.HashMap; | |
41 | import java.util.HashSet; | |
42 | import java.util.Iterator; | |
43 | import java.util.LinkedList; | |
44 | import java.util.Stack; | |
45 | ||
46 | import javax.xml.stream.FactoryConfigurationError; | |
47 | import javax.xml.stream.Location; | |
48 | import javax.xml.stream.XMLEventReader; | |
49 | import javax.xml.stream.XMLInputFactory; | |
50 | import javax.xml.stream.XMLStreamConstants; | |
51 | import javax.xml.stream.XMLStreamException; | |
52 | import javax.xml.stream.events.Attribute; | |
53 | import javax.xml.stream.events.XMLEvent; | |
54 | ||
55 | import org.graphstream.stream.SourceBase; | |
56 | ||
57 | /** | |
58 | * GraphML is a comprehensive and easy-to-use file format for graphs. It | |
59 | * consists of a language core to describe the structural properties of a graph | |
60 | * and a flexible extension mechanism to add application-specific data. Its main | |
61 | * features include support of | |
62 | * <ul> | |
63 | * <li>directed, undirected, and mixed graphs,</li> | |
64 | * <li>hypergraphs,</li> | |
65 | * <li>hierarchical graphs,</li> | |
66 | * <li>graphical representations,</li> | |
67 | * <li>references to external data,</li> | |
68 | * <li>application-specific attribute data, and</li> | |
69 | * <li>light-weight parsers.</li> | |
70 | * </ul> | |
71 | * | |
72 | * Unlike many other file formats for graphs, GraphML does not use a custom | |
73 | * syntax. Instead, it is based on XML and hence ideally suited as a common | |
74 | * denominator for all kinds of services generating, archiving, or processing | |
75 | * graphs. | |
76 | * | |
77 | * <a href="http://graphml.graphdrawing.org/index.html">Source</a> | |
78 | */ | |
79 | public class FileSourceGraphML extends SourceBase implements FileSource, | |
80 | XMLStreamConstants { | |
81 | ||
82 | protected static enum Balise { | |
83 | GRAPHML, GRAPH, NODE, EDGE, HYPEREDGE, DESC, DATA, LOCATOR, PORT, KEY, DEFAULT | |
84 | } | |
85 | ||
86 | protected static enum GraphAttribute { | |
87 | ID, EDGEDEFAULT | |
88 | } | |
89 | ||
90 | protected static enum LocatorAttribute { | |
91 | XMLNS_XLINK, XLINK_HREF, XLINK_TYPE | |
92 | } | |
93 | ||
94 | protected static enum NodeAttribute { | |
95 | ID | |
96 | } | |
97 | ||
98 | protected static enum EdgeAttribute { | |
99 | ID, SOURCE, SOURCEPORT, TARGET, TARGETPORT, DIRECTED | |
100 | } | |
101 | ||
102 | protected static enum DataAttribute { | |
103 | KEY, ID | |
104 | } | |
105 | ||
106 | protected static enum PortAttribute { | |
107 | NAME | |
108 | } | |
109 | ||
110 | protected static enum EndPointAttribute { | |
111 | ID, NODE, PORT, TYPE | |
112 | } | |
113 | ||
114 | protected static enum EndPointType { | |
115 | IN, OUT, UNDIR | |
116 | } | |
117 | ||
118 | protected static enum HyperEdgeAttribute { | |
119 | ID | |
120 | } | |
121 | ||
122 | protected static enum KeyAttribute { | |
123 | ID, FOR, ATTR_NAME, ATTR_TYPE | |
124 | } | |
125 | ||
126 | protected static enum KeyDomain { | |
127 | GRAPHML, GRAPH, NODE, EDGE, HYPEREDGE, PORT, ENDPOINT, ALL | |
128 | } | |
129 | ||
130 | protected static enum KeyAttrType { | |
131 | BOOLEAN, INT, LONG, FLOAT, DOUBLE, STRING | |
132 | } | |
133 | ||
134 | protected static class Key { | |
135 | KeyDomain domain; | |
136 | String name; | |
137 | KeyAttrType type; | |
138 | String def = null; | |
139 | ||
140 | Key() { | |
141 | domain = KeyDomain.ALL; | |
142 | name = null; | |
143 | type = KeyAttrType.STRING; | |
144 | } | |
145 | ||
146 | Object getKeyValue(String value) { | |
147 |
1
1. getKeyValue : negated conditional → NO_COVERAGE |
if (value == null) |
148 |
1
1. getKeyValue : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML$Key::getKeyValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return null; |
149 | ||
150 | switch (type) { | |
151 | case STRING: | |
152 |
1
1. getKeyValue : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML$Key::getKeyValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return value; |
153 | case INT: | |
154 |
1
1. getKeyValue : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML$Key::getKeyValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Integer.valueOf(value); |
155 | case LONG: | |
156 |
1
1. getKeyValue : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML$Key::getKeyValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Long.valueOf(value); |
157 | case FLOAT: | |
158 |
1
1. getKeyValue : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML$Key::getKeyValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Float.valueOf(value); |
159 | case DOUBLE: | |
160 |
1
1. getKeyValue : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML$Key::getKeyValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Double.valueOf(value); |
161 | case BOOLEAN: | |
162 |
1
1. getKeyValue : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML$Key::getKeyValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Boolean.valueOf(value); |
163 | } | |
164 | ||
165 |
1
1. getKeyValue : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML$Key::getKeyValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return value; |
166 | } | |
167 | ||
168 | Object getDefaultValue() { | |
169 |
1
1. getDefaultValue : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML$Key::getDefaultValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return getKeyValue(def); |
170 | } | |
171 | } | |
172 | ||
173 | protected static class Data { | |
174 | Key key; | |
175 | String id; | |
176 | String value; | |
177 | } | |
178 | ||
179 | protected static class Locator { | |
180 | String href; | |
181 | String xlink; | |
182 | String type; | |
183 | ||
184 | Locator() { | |
185 | xlink = "http://www.w3.org/TR/2000/PR-xlink-20001220/"; | |
186 | type = "simple"; | |
187 | href = null; | |
188 | } | |
189 | } | |
190 | ||
191 | protected static class Port { | |
192 | String name; | |
193 | String desc; | |
194 | ||
195 | LinkedList<Data> datas; | |
196 | LinkedList<Port> ports; | |
197 | ||
198 | Port() { | |
199 | name = null; | |
200 | desc = null; | |
201 | ||
202 | datas = new LinkedList<Data>(); | |
203 | ports = new LinkedList<Port>(); | |
204 | } | |
205 | } | |
206 | ||
207 | protected static class EndPoint { | |
208 | String id; | |
209 | String node; | |
210 | String port; | |
211 | String desc; | |
212 | EndPointType type; | |
213 | ||
214 | EndPoint() { | |
215 | id = null; | |
216 | node = null; | |
217 | port = null; | |
218 | desc = null; | |
219 | type = EndPointType.UNDIR; | |
220 | } | |
221 | } | |
222 | ||
223 | protected XMLEventReader reader; | |
224 | protected HashMap<String, Key> keys; | |
225 | protected LinkedList<Data> datas; | |
226 | protected Stack<XMLEvent> events; | |
227 | protected Stack<String> graphId; | |
228 | protected int graphCounter; | |
229 | ||
230 | /** | |
231 | * Build a new source to parse an xml stream in GraphML format. | |
232 | */ | |
233 | public FileSourceGraphML() { | |
234 | events = new Stack<XMLEvent>(); | |
235 | keys = new HashMap<String, Key>(); | |
236 | datas = new LinkedList<Data>(); | |
237 | graphId = new Stack<String>(); | |
238 | graphCounter = 0; | |
239 | sourceId = String.format("<GraphML stream %x>", System.nanoTime()); | |
240 | } | |
241 | ||
242 | /* | |
243 | * (non-Javadoc) | |
244 | * | |
245 | * @see org.graphstream.stream.file.FileSource#readAll(java.lang.String) | |
246 | */ | |
247 | public void readAll(String fileName) throws IOException { | |
248 |
1
1. readAll : removed call to org/graphstream/stream/file/FileSourceGraphML::readAll → NO_COVERAGE |
readAll(new FileReader(fileName)); |
249 | } | |
250 | ||
251 | /* | |
252 | * (non-Javadoc) | |
253 | * | |
254 | * @see org.graphstream.stream.file.FileSource#readAll(java.net.URL) | |
255 | */ | |
256 | public void readAll(URL url) throws IOException { | |
257 |
1
1. readAll : removed call to org/graphstream/stream/file/FileSourceGraphML::readAll → NO_COVERAGE |
readAll(url.openStream()); |
258 | } | |
259 | ||
260 | /* | |
261 | * (non-Javadoc) | |
262 | * | |
263 | * @see org.graphstream.stream.file.FileSource#readAll(java.io.InputStream) | |
264 | */ | |
265 | public void readAll(InputStream stream) throws IOException { | |
266 |
1
1. readAll : removed call to org/graphstream/stream/file/FileSourceGraphML::readAll → NO_COVERAGE |
readAll(new InputStreamReader(stream)); |
267 | } | |
268 | ||
269 | /* | |
270 | * (non-Javadoc) | |
271 | * | |
272 | * @see org.graphstream.stream.file.FileSource#readAll(java.io.Reader) | |
273 | */ | |
274 | public void readAll(Reader reader) throws IOException { | |
275 |
1
1. readAll : removed call to org/graphstream/stream/file/FileSourceGraphML::begin → NO_COVERAGE |
begin(reader); |
276 |
1
1. readAll : negated conditional → NO_COVERAGE |
while (nextEvents()) |
277 | ; | |
278 |
1
1. readAll : removed call to org/graphstream/stream/file/FileSourceGraphML::end → NO_COVERAGE |
end(); |
279 | } | |
280 | ||
281 | /* | |
282 | * (non-Javadoc) | |
283 | * | |
284 | * @see org.graphstream.stream.file.FileSource#begin(java.lang.String) | |
285 | */ | |
286 | public void begin(String fileName) throws IOException { | |
287 |
1
1. begin : removed call to org/graphstream/stream/file/FileSourceGraphML::begin → NO_COVERAGE |
begin(new FileReader(fileName)); |
288 | } | |
289 | ||
290 | /* | |
291 | * (non-Javadoc) | |
292 | * | |
293 | * @see org.graphstream.stream.file.FileSource#begin(java.net.URL) | |
294 | */ | |
295 | public void begin(URL url) throws IOException { | |
296 |
1
1. begin : removed call to org/graphstream/stream/file/FileSourceGraphML::begin → NO_COVERAGE |
begin(url.openStream()); |
297 | } | |
298 | ||
299 | /* | |
300 | * (non-Javadoc) | |
301 | * | |
302 | * @see org.graphstream.stream.file.FileSource#begin(java.io.InputStream) | |
303 | */ | |
304 | public void begin(InputStream stream) throws IOException { | |
305 |
1
1. begin : removed call to org/graphstream/stream/file/FileSourceGraphML::begin → NO_COVERAGE |
begin(new InputStreamReader(stream)); |
306 | } | |
307 | ||
308 | /* | |
309 | * (non-Javadoc) | |
310 | * | |
311 | * @see org.graphstream.stream.file.FileSource#begin(java.io.Reader) | |
312 | */ | |
313 | public void begin(Reader reader) throws IOException { | |
314 |
1
1. begin : removed call to org/graphstream/stream/file/FileSourceGraphML::openStream → NO_COVERAGE |
openStream(reader); |
315 | } | |
316 | ||
317 | /* | |
318 | * (non-Javadoc) | |
319 | * | |
320 | * @see org.graphstream.stream.file.FileSource#nextEvents() | |
321 | */ | |
322 | public boolean nextEvents() throws IOException { | |
323 | try { | |
324 |
1
1. nextEvents : removed call to org/graphstream/stream/file/FileSourceGraphML::__graphml → NO_COVERAGE |
__graphml(); |
325 | } catch (XMLStreamException ex) { | |
326 | throw new IOException(ex); | |
327 | } | |
328 | ||
329 |
1
1. nextEvents : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return false; |
330 | } | |
331 | ||
332 | /* | |
333 | * (non-Javadoc) | |
334 | * | |
335 | * @see org.graphstream.stream.file.FileSource#nextStep() | |
336 | */ | |
337 | public boolean nextStep() throws IOException { | |
338 |
1
1. nextStep : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return nextEvents(); |
339 | } | |
340 | ||
341 | /* | |
342 | * (non-Javadoc) | |
343 | * | |
344 | * @see org.graphstream.stream.file.FileSource#end() | |
345 | */ | |
346 | public void end() throws IOException { | |
347 |
1
1. end : removed call to org/graphstream/stream/file/FileSourceGraphML::closeStream → NO_COVERAGE |
closeStream(); |
348 | } | |
349 | ||
350 | protected XMLEvent getNextEvent() throws IOException, XMLStreamException { | |
351 |
1
1. getNextEvent : removed call to org/graphstream/stream/file/FileSourceGraphML::skipWhiteSpaces → NO_COVERAGE |
skipWhiteSpaces(); |
352 | ||
353 |
2
1. getNextEvent : changed conditional boundary → NO_COVERAGE 2. getNextEvent : negated conditional → NO_COVERAGE |
if (events.size() > 0) |
354 |
1
1. getNextEvent : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::getNextEvent to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return events.pop(); |
355 | ||
356 |
1
1. getNextEvent : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::getNextEvent to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return reader.nextEvent(); |
357 | } | |
358 | ||
359 | protected void pushback(XMLEvent e) { | |
360 | events.push(e); | |
361 | } | |
362 | ||
363 | private XMLStreamException newParseError(XMLEvent e, String msg, | |
364 | Object... args) { | |
365 |
1
1. newParseError : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::newParseError to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return new XMLStreamException(String.format(msg, args), e.getLocation()); |
366 | } | |
367 | ||
368 | private boolean isEvent(XMLEvent e, int type, String name) { | |
369 |
1
1. isEvent : negated conditional → NO_COVERAGE |
boolean valid = e.getEventType() == type; |
370 | ||
371 |
1
1. isEvent : negated conditional → NO_COVERAGE |
if (valid) { |
372 | switch (type) { | |
373 | case START_ELEMENT: | |
374 | valid = e.asStartElement().getName().getLocalPart() | |
375 | .equals(name); | |
376 | break; | |
377 | case END_ELEMENT: | |
378 | valid = e.asEndElement().getName().getLocalPart().equals(name); | |
379 | break; | |
380 | case ATTRIBUTE: | |
381 | valid = ((Attribute) e).getName().getLocalPart().equals(name); | |
382 | break; | |
383 | case CHARACTERS: | |
384 | case NAMESPACE: | |
385 | case PROCESSING_INSTRUCTION: | |
386 | case COMMENT: | |
387 | case START_DOCUMENT: | |
388 | case END_DOCUMENT: | |
389 | case DTD: | |
390 | } | |
391 | } | |
392 | ||
393 |
1
1. isEvent : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return valid; |
394 | } | |
395 | ||
396 | private void checkValid(XMLEvent e, int type, String name) | |
397 | throws XMLStreamException { | |
398 | boolean valid = isEvent(e, type, name); | |
399 | ||
400 |
1
1. checkValid : negated conditional → NO_COVERAGE |
if (!valid) |
401 | throw newParseError(e, "expecting %s, got %s", gotWhat(type, name), | |
402 | gotWhat(e)); | |
403 | } | |
404 | ||
405 | private String gotWhat(XMLEvent e) { | |
406 | String v = null; | |
407 | ||
408 | switch (e.getEventType()) { | |
409 | case START_ELEMENT: | |
410 | v = e.asStartElement().getName().getLocalPart(); | |
411 | break; | |
412 | case END_ELEMENT: | |
413 | v = e.asEndElement().getName().getLocalPart(); | |
414 | break; | |
415 | case ATTRIBUTE: | |
416 | v = ((Attribute) e).getName().getLocalPart(); | |
417 | break; | |
418 | } | |
419 | ||
420 |
1
1. gotWhat : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::gotWhat to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return gotWhat(e.getEventType(), v); |
421 | } | |
422 | ||
423 | private String gotWhat(int type, String v) { | |
424 | switch (type) { | |
425 | case START_ELEMENT: | |
426 |
1
1. gotWhat : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::gotWhat to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return String.format("'<%s>'", v); |
427 | case END_ELEMENT: | |
428 |
1
1. gotWhat : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::gotWhat to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return String.format("'</%s>'", v); |
429 | case ATTRIBUTE: | |
430 |
1
1. gotWhat : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::gotWhat to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return String.format("attribute '%s'", v); |
431 | case NAMESPACE: | |
432 |
1
1. gotWhat : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::gotWhat to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "namespace"; |
433 | case PROCESSING_INSTRUCTION: | |
434 |
1
1. gotWhat : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::gotWhat to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "processing instruction"; |
435 | case COMMENT: | |
436 |
1
1. gotWhat : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::gotWhat to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "comment"; |
437 | case START_DOCUMENT: | |
438 |
1
1. gotWhat : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::gotWhat to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "document start"; |
439 | case END_DOCUMENT: | |
440 |
1
1. gotWhat : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::gotWhat to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "document end"; |
441 | case DTD: | |
442 |
1
1. gotWhat : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::gotWhat to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "dtd"; |
443 | case CHARACTERS: | |
444 |
1
1. gotWhat : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::gotWhat to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "characters"; |
445 | default: | |
446 |
1
1. gotWhat : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::gotWhat to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "UNKNOWN"; |
447 | } | |
448 | } | |
449 | ||
450 | private Object getValue(Data data) { | |
451 | switch (data.key.type) { | |
452 | case BOOLEAN: | |
453 |
1
1. getValue : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::getValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Boolean.parseBoolean(data.value); |
454 | case INT: | |
455 |
1
1. getValue : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::getValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Integer.parseInt(data.value); |
456 | case LONG: | |
457 |
1
1. getValue : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::getValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Long.parseLong(data.value); |
458 | case FLOAT: | |
459 |
1
1. getValue : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::getValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Float.parseFloat(data.value); |
460 | case DOUBLE: | |
461 |
1
1. getValue : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::getValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Double.parseDouble(data.value); |
462 | case STRING: | |
463 |
1
1. getValue : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::getValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return data.value; |
464 | } | |
465 | ||
466 |
1
1. getValue : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::getValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return data.value; |
467 | } | |
468 | ||
469 | private Object getDefaultValue(Key key) { | |
470 | switch (key.type) { | |
471 | case BOOLEAN: | |
472 |
1
1. getDefaultValue : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::getDefaultValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Boolean.TRUE; |
473 | case INT: | |
474 |
1
1. getDefaultValue : negated conditional → NO_COVERAGE |
if (key.def != null) |
475 |
1
1. getDefaultValue : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::getDefaultValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Integer.valueOf(key.def); |
476 | ||
477 |
1
1. getDefaultValue : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::getDefaultValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Integer.valueOf(0); |
478 | case LONG: | |
479 |
1
1. getDefaultValue : negated conditional → NO_COVERAGE |
if (key.def != null) |
480 |
1
1. getDefaultValue : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::getDefaultValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Long.valueOf(key.def); |
481 | ||
482 |
1
1. getDefaultValue : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::getDefaultValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Long.valueOf(0); |
483 | case FLOAT: | |
484 |
1
1. getDefaultValue : negated conditional → NO_COVERAGE |
if (key.def != null) |
485 |
1
1. getDefaultValue : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::getDefaultValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Float.valueOf(key.def); |
486 | ||
487 |
1
1. getDefaultValue : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::getDefaultValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Float.valueOf(0.0f); |
488 | case DOUBLE: | |
489 |
1
1. getDefaultValue : negated conditional → NO_COVERAGE |
if (key.def != null) |
490 |
1
1. getDefaultValue : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::getDefaultValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Double.valueOf(key.def); |
491 | ||
492 |
1
1. getDefaultValue : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::getDefaultValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Double.valueOf(0.0); |
493 | case STRING: | |
494 |
1
1. getDefaultValue : negated conditional → NO_COVERAGE |
if (key.def != null) |
495 |
1
1. getDefaultValue : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::getDefaultValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return key.def; |
496 | ||
497 |
1
1. getDefaultValue : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::getDefaultValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return ""; |
498 | } | |
499 | ||
500 |
2
1. getDefaultValue : negated conditional → NO_COVERAGE 2. getDefaultValue : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::getDefaultValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return key.def != null ? key.def : Boolean.TRUE; |
501 | } | |
502 | ||
503 | private void skipWhiteSpaces() throws IOException, XMLStreamException { | |
504 | XMLEvent e; | |
505 | ||
506 | do { | |
507 |
2
1. skipWhiteSpaces : changed conditional boundary → NO_COVERAGE 2. skipWhiteSpaces : negated conditional → NO_COVERAGE |
if (events.size() > 0) |
508 | e = events.pop(); | |
509 | else | |
510 | e = reader.nextEvent(); | |
511 |
1
1. skipWhiteSpaces : negated conditional → NO_COVERAGE |
} while (isEvent(e, XMLEvent.CHARACTERS, null) |
512 |
1
1. skipWhiteSpaces : negated conditional → NO_COVERAGE |
&& e.asCharacters().getData().matches("^\\s*$")); |
513 | ||
514 |
1
1. skipWhiteSpaces : removed call to org/graphstream/stream/file/FileSourceGraphML::pushback → NO_COVERAGE |
pushback(e); |
515 | } | |
516 | ||
517 | protected void openStream(Reader stream) throws IOException { | |
518 |
1
1. openStream : negated conditional → NO_COVERAGE |
if (reader != null) |
519 |
1
1. openStream : removed call to org/graphstream/stream/file/FileSourceGraphML::closeStream → NO_COVERAGE |
closeStream(); |
520 | ||
521 | try { | |
522 | XMLEvent e; | |
523 | ||
524 | reader = XMLInputFactory.newInstance().createXMLEventReader(stream); | |
525 | ||
526 | e = getNextEvent(); | |
527 |
1
1. openStream : removed call to org/graphstream/stream/file/FileSourceGraphML::checkValid → NO_COVERAGE |
checkValid(e, XMLEvent.START_DOCUMENT, null); |
528 | ||
529 | } catch (XMLStreamException e) { | |
530 | throw new IOException(e); | |
531 | } catch (FactoryConfigurationError e) { | |
532 | throw new IOException(e); | |
533 | } | |
534 | } | |
535 | ||
536 | protected void closeStream() throws IOException { | |
537 | try { | |
538 |
1
1. closeStream : removed call to javax/xml/stream/XMLEventReader::close → NO_COVERAGE |
reader.close(); |
539 | } catch (XMLStreamException e) { | |
540 | throw new IOException(e); | |
541 | } finally { | |
542 | reader = null; | |
543 | } | |
544 | } | |
545 | ||
546 | protected String toConstantName(Attribute a) { | |
547 |
1
1. toConstantName : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::toConstantName to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return toConstantName(a.getName().getLocalPart()); |
548 | } | |
549 | ||
550 | protected String toConstantName(String value) { | |
551 |
1
1. toConstantName : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::toConstantName to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return value.toUpperCase().replaceAll("\\W", "_"); |
552 | } | |
553 | ||
554 | /** | |
555 | * <pre> | |
556 | * <!ELEMENT graphml ((desc)?,(key)*,((data)|(graph))*)> | |
557 | * </pre> | |
558 | * | |
559 | * @throws IOException | |
560 | * @throws XMLStreamException | |
561 | */ | |
562 | private void __graphml() throws IOException, XMLStreamException { | |
563 | XMLEvent e; | |
564 | ||
565 | e = getNextEvent(); | |
566 |
1
1. __graphml : removed call to org/graphstream/stream/file/FileSourceGraphML::checkValid → NO_COVERAGE |
checkValid(e, XMLEvent.START_ELEMENT, "graphml"); |
567 | ||
568 | e = getNextEvent(); | |
569 | ||
570 |
1
1. __graphml : negated conditional → NO_COVERAGE |
if (isEvent(e, XMLEvent.START_ELEMENT, "desc")) { |
571 |
1
1. __graphml : removed call to org/graphstream/stream/file/FileSourceGraphML::pushback → NO_COVERAGE |
pushback(e); |
572 | __desc(); | |
573 | ||
574 | e = getNextEvent(); | |
575 | } | |
576 | ||
577 |
1
1. __graphml : negated conditional → NO_COVERAGE |
while (isEvent(e, XMLEvent.START_ELEMENT, "key")) { |
578 |
1
1. __graphml : removed call to org/graphstream/stream/file/FileSourceGraphML::pushback → NO_COVERAGE |
pushback(e); |
579 |
1
1. __graphml : removed call to org/graphstream/stream/file/FileSourceGraphML::__key → NO_COVERAGE |
__key(); |
580 | ||
581 | e = getNextEvent(); | |
582 | } | |
583 | ||
584 |
1
1. __graphml : negated conditional → NO_COVERAGE |
while (isEvent(e, XMLEvent.START_ELEMENT, "data") |
585 |
1
1. __graphml : negated conditional → NO_COVERAGE |
|| isEvent(e, XMLEvent.START_ELEMENT, "graph")) { |
586 |
1
1. __graphml : removed call to org/graphstream/stream/file/FileSourceGraphML::pushback → NO_COVERAGE |
pushback(e); |
587 | ||
588 |
1
1. __graphml : negated conditional → NO_COVERAGE |
if (isEvent(e, XMLEvent.START_ELEMENT, "data")) { |
589 | __data(); | |
590 | } else { | |
591 |
1
1. __graphml : removed call to org/graphstream/stream/file/FileSourceGraphML::__graph → NO_COVERAGE |
__graph(); |
592 | } | |
593 | ||
594 | e = getNextEvent(); | |
595 | } | |
596 | ||
597 |
1
1. __graphml : removed call to org/graphstream/stream/file/FileSourceGraphML::checkValid → NO_COVERAGE |
checkValid(e, XMLEvent.END_ELEMENT, "graphml"); |
598 | } | |
599 | ||
600 | private String __characters() throws IOException, XMLStreamException { | |
601 | XMLEvent e; | |
602 | StringBuilder buffer = new StringBuilder(); | |
603 | ||
604 | e = getNextEvent(); | |
605 | ||
606 |
1
1. __characters : negated conditional → NO_COVERAGE |
while (e.getEventType() == XMLEvent.CHARACTERS) { |
607 | buffer.append(e.asCharacters()); | |
608 | e = getNextEvent(); | |
609 | } | |
610 | ||
611 |
1
1. __characters : removed call to org/graphstream/stream/file/FileSourceGraphML::pushback → NO_COVERAGE |
pushback(e); |
612 | ||
613 |
1
1. __characters : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::__characters to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return buffer.toString(); |
614 | } | |
615 | ||
616 | /** | |
617 | * <pre> | |
618 | * <!ELEMENT desc (#PCDATA)> | |
619 | * </pre> | |
620 | * | |
621 | * @return | |
622 | * @throws IOException | |
623 | * @throws XMLStreamException | |
624 | */ | |
625 | private String __desc() throws IOException, XMLStreamException { | |
626 | XMLEvent e; | |
627 | String desc; | |
628 | ||
629 | e = getNextEvent(); | |
630 |
1
1. __desc : removed call to org/graphstream/stream/file/FileSourceGraphML::checkValid → NO_COVERAGE |
checkValid(e, XMLEvent.START_ELEMENT, "desc"); |
631 | ||
632 | desc = __characters(); | |
633 | ||
634 | e = getNextEvent(); | |
635 |
1
1. __desc : removed call to org/graphstream/stream/file/FileSourceGraphML::checkValid → NO_COVERAGE |
checkValid(e, XMLEvent.END_ELEMENT, "desc"); |
636 | ||
637 |
1
1. __desc : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::__desc to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return desc; |
638 | } | |
639 | ||
640 | /** | |
641 | * <pre> | |
642 | * <!ELEMENT locator EMPTY> | |
643 | * <!ATTLIST locator | |
644 | * xmlns:xlink CDATA #FIXED "http://www.w3.org/TR/2000/PR-xlink-20001220/" | |
645 | * xlink:href CDATA #REQUIRED | |
646 | * xlink:type (simple) #FIXED "simple" | |
647 | * > | |
648 | * </pre> | |
649 | * | |
650 | * @return | |
651 | * @throws IOException | |
652 | * @throws XMLStreamException | |
653 | */ | |
654 | private Locator __locator() throws IOException, XMLStreamException { | |
655 | XMLEvent e; | |
656 | ||
657 | e = getNextEvent(); | |
658 |
1
1. __locator : removed call to org/graphstream/stream/file/FileSourceGraphML::checkValid → NO_COVERAGE |
checkValid(e, XMLEvent.START_ELEMENT, "locator"); |
659 | ||
660 | @SuppressWarnings("unchecked") | |
661 | Iterator<? extends Attribute> attributes = e.asStartElement() | |
662 | .getAttributes(); | |
663 | ||
664 | Locator loc = new Locator(); | |
665 | ||
666 |
1
1. __locator : negated conditional → NO_COVERAGE |
while (attributes.hasNext()) { |
667 | Attribute a = attributes.next(); | |
668 | ||
669 | try { | |
670 | LocatorAttribute attribute = LocatorAttribute | |
671 | .valueOf(toConstantName(a)); | |
672 | ||
673 | switch (attribute) { | |
674 | case XMLNS_XLINK: | |
675 | loc.xlink = a.getValue(); | |
676 | break; | |
677 | case XLINK_HREF: | |
678 | loc.href = a.getValue(); | |
679 | break; | |
680 | case XLINK_TYPE: | |
681 | loc.type = a.getValue(); | |
682 | break; | |
683 | } | |
684 | } catch (IllegalArgumentException ex) { | |
685 | throw newParseError(e, "invalid locator attribute '%s'", a | |
686 | .getName().getLocalPart()); | |
687 | } | |
688 | } | |
689 | ||
690 | e = getNextEvent(); | |
691 |
1
1. __locator : removed call to org/graphstream/stream/file/FileSourceGraphML::checkValid → NO_COVERAGE |
checkValid(e, XMLEvent.END_ELEMENT, "locator"); |
692 | ||
693 |
1
1. __locator : negated conditional → NO_COVERAGE |
if (loc.href == null) |
694 | throw newParseError(e, "locator requires an href"); | |
695 | ||
696 |
1
1. __locator : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::__locator to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return loc; |
697 | } | |
698 | ||
699 | /** | |
700 | * <pre> | |
701 | * <!ELEMENT key (#PCDATA)> | |
702 | * <!ATTLIST key | |
703 | * id ID #REQUIRED | |
704 | * for (graphml|graph|node|edge|hyperedge|port|endpoint|all) "all" | |
705 | * > | |
706 | * </pre> | |
707 | * | |
708 | * @throws IOException | |
709 | * @throws XMLStreamException | |
710 | */ | |
711 | private void __key() throws IOException, XMLStreamException { | |
712 | XMLEvent e; | |
713 | ||
714 | e = getNextEvent(); | |
715 |
1
1. __key : removed call to org/graphstream/stream/file/FileSourceGraphML::checkValid → NO_COVERAGE |
checkValid(e, XMLEvent.START_ELEMENT, "key"); |
716 | ||
717 | @SuppressWarnings("unchecked") | |
718 | Iterator<? extends Attribute> attributes = e.asStartElement() | |
719 | .getAttributes(); | |
720 | ||
721 | String id = null; | |
722 | KeyDomain domain = KeyDomain.ALL; | |
723 | KeyAttrType type = KeyAttrType.STRING; | |
724 | String name = null; | |
725 | String def = null; | |
726 | ||
727 |
1
1. __key : negated conditional → NO_COVERAGE |
while (attributes.hasNext()) { |
728 | Attribute a = attributes.next(); | |
729 | ||
730 | try { | |
731 | KeyAttribute attribute = KeyAttribute | |
732 | .valueOf(toConstantName(a)); | |
733 | ||
734 | switch (attribute) { | |
735 | case ID: | |
736 | id = a.getValue(); | |
737 | ||
738 | break; | |
739 | case FOR: | |
740 | try { | |
741 | domain = KeyDomain | |
742 | .valueOf(toConstantName(a.getValue())); | |
743 | } catch (IllegalArgumentException ex) { | |
744 | throw newParseError(e, "invalid key domain '%s'", | |
745 | a.getValue()); | |
746 | } | |
747 | ||
748 | break; | |
749 | case ATTR_TYPE: | |
750 | try { | |
751 | type = KeyAttrType | |
752 | .valueOf(toConstantName(a.getValue())); | |
753 | } catch (IllegalArgumentException ex) { | |
754 | throw newParseError(e, "invalid key type '%s'", | |
755 | a.getValue()); | |
756 | } | |
757 | ||
758 | break; | |
759 | case ATTR_NAME: | |
760 | name = a.getValue(); | |
761 | ||
762 | break; | |
763 | } | |
764 | } catch (IllegalArgumentException ex) { | |
765 | throw newParseError(e, "invalid key attribute '%s'", a | |
766 | .getName().getLocalPart()); | |
767 | } | |
768 | } | |
769 | ||
770 | e = getNextEvent(); | |
771 | ||
772 |
1
1. __key : negated conditional → NO_COVERAGE |
if (isEvent(e, XMLEvent.START_ELEMENT, "default")) { |
773 | def = __characters(); | |
774 | ||
775 | e = getNextEvent(); | |
776 |
1
1. __key : removed call to org/graphstream/stream/file/FileSourceGraphML::checkValid → NO_COVERAGE |
checkValid(e, XMLEvent.END_ELEMENT, "default"); |
777 | ||
778 | e = getNextEvent(); | |
779 | } | |
780 | ||
781 |
1
1. __key : removed call to org/graphstream/stream/file/FileSourceGraphML::checkValid → NO_COVERAGE |
checkValid(e, XMLEvent.END_ELEMENT, "key"); |
782 | ||
783 |
1
1. __key : negated conditional → NO_COVERAGE |
if (id == null) |
784 | throw newParseError(e, "key requires an id"); | |
785 | ||
786 |
1
1. __key : negated conditional → NO_COVERAGE |
if (name == null) |
787 | name = id; | |
788 | ||
789 | System.out.printf("add key \"%s\"\n", id); | |
790 | ||
791 | Key k = new Key(); | |
792 | k.name = name; | |
793 | k.domain = domain; | |
794 | k.type = type; | |
795 | k.def = def; | |
796 | ||
797 | keys.put(id, k); | |
798 | } | |
799 | ||
800 | /** | |
801 | * <pre> | |
802 | * <!ELEMENT port ((desc)?,((data)|(port))*)> | |
803 | * <!ATTLIST port | |
804 | * name NMTOKEN #REQUIRED | |
805 | * > | |
806 | * </pre> | |
807 | * | |
808 | * @return | |
809 | * @throws IOException | |
810 | * @throws XMLStreamException | |
811 | */ | |
812 | private Port __port() throws IOException, XMLStreamException { | |
813 | XMLEvent e; | |
814 | ||
815 | e = getNextEvent(); | |
816 |
1
1. __port : removed call to org/graphstream/stream/file/FileSourceGraphML::checkValid → NO_COVERAGE |
checkValid(e, XMLEvent.START_ELEMENT, "port"); |
817 | ||
818 | Port port = new Port(); | |
819 | @SuppressWarnings("unchecked") | |
820 | Iterator<? extends Attribute> attributes = e.asStartElement() | |
821 | .getAttributes(); | |
822 |
1
1. __port : negated conditional → NO_COVERAGE |
while (attributes.hasNext()) { |
823 | Attribute a = attributes.next(); | |
824 | ||
825 | try { | |
826 | PortAttribute attribute = PortAttribute | |
827 | .valueOf(toConstantName(a)); | |
828 | ||
829 | switch (attribute) { | |
830 | case NAME: | |
831 | port.name = a.getValue(); | |
832 | break; | |
833 | } | |
834 | } catch (IllegalArgumentException ex) { | |
835 | throw newParseError(e, "invalid attribute '%s' for '<port>'", a | |
836 | .getName().getLocalPart()); | |
837 | } | |
838 | } | |
839 | ||
840 |
1
1. __port : negated conditional → NO_COVERAGE |
if (port.name == null) |
841 | throw newParseError(e, | |
842 | "'<port>' element requires a 'name' attribute"); | |
843 | ||
844 | e = getNextEvent(); | |
845 |
1
1. __port : negated conditional → NO_COVERAGE |
if (isEvent(e, XMLEvent.START_ELEMENT, "desc")) { |
846 |
1
1. __port : removed call to org/graphstream/stream/file/FileSourceGraphML::pushback → NO_COVERAGE |
pushback(e); |
847 | port.desc = __desc(); | |
848 | } else { | |
849 |
1
1. __port : negated conditional → NO_COVERAGE |
while (isEvent(e, XMLEvent.START_ELEMENT, "data") |
850 |
1
1. __port : negated conditional → NO_COVERAGE |
|| isEvent(e, XMLEvent.START_ELEMENT, "port")) { |
851 |
1
1. __port : negated conditional → NO_COVERAGE |
if (isEvent(e, XMLEvent.START_ELEMENT, "data")) { |
852 | Data data; | |
853 | ||
854 |
1
1. __port : removed call to org/graphstream/stream/file/FileSourceGraphML::pushback → NO_COVERAGE |
pushback(e); |
855 | data = __data(); | |
856 | ||
857 | port.datas.add(data); | |
858 | } else { | |
859 | Port portChild; | |
860 | ||
861 |
1
1. __port : removed call to org/graphstream/stream/file/FileSourceGraphML::pushback → NO_COVERAGE |
pushback(e); |
862 | portChild = __port(); | |
863 | ||
864 | port.ports.add(portChild); | |
865 | } | |
866 | ||
867 | e = getNextEvent(); | |
868 | } | |
869 | } | |
870 | ||
871 | e = getNextEvent(); | |
872 |
1
1. __port : removed call to org/graphstream/stream/file/FileSourceGraphML::checkValid → NO_COVERAGE |
checkValid(e, XMLEvent.END_ELEMENT, "port"); |
873 | ||
874 |
1
1. __port : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::__port to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return port; |
875 | } | |
876 | ||
877 | /** | |
878 | * <pre> | |
879 | * <!ELEMENT endpoint ((desc)?)> | |
880 | * <!ATTLIST endpoint | |
881 | * id ID #IMPLIED | |
882 | * node IDREF #REQUIRED | |
883 | * port NMTOKEN #IMPLIED | |
884 | * type (in|out|undir) "undir" | |
885 | * > | |
886 | * </pre> | |
887 | * | |
888 | * @return | |
889 | * @throws IOException | |
890 | * @throws XMLStreamException | |
891 | */ | |
892 | private EndPoint __endpoint() throws IOException, XMLStreamException { | |
893 | XMLEvent e; | |
894 | ||
895 | e = getNextEvent(); | |
896 |
1
1. __endpoint : removed call to org/graphstream/stream/file/FileSourceGraphML::checkValid → NO_COVERAGE |
checkValid(e, XMLEvent.START_ELEMENT, "endpoint"); |
897 | ||
898 | @SuppressWarnings("unchecked") | |
899 | Iterator<? extends Attribute> attributes = e.asStartElement() | |
900 | .getAttributes(); | |
901 | EndPoint ep = new EndPoint(); | |
902 | ||
903 |
1
1. __endpoint : negated conditional → NO_COVERAGE |
while (attributes.hasNext()) { |
904 | Attribute a = attributes.next(); | |
905 | ||
906 | try { | |
907 | EndPointAttribute attribute = EndPointAttribute | |
908 | .valueOf(toConstantName(a)); | |
909 | ||
910 | switch (attribute) { | |
911 | case NODE: | |
912 | ep.node = a.getValue(); | |
913 | break; | |
914 | case ID: | |
915 | ep.id = a.getValue(); | |
916 | break; | |
917 | case PORT: | |
918 | ep.port = a.getValue(); | |
919 | break; | |
920 | case TYPE: | |
921 | try { | |
922 | ep.type = EndPointType.valueOf(toConstantName(a | |
923 | .getValue())); | |
924 | } catch (IllegalArgumentException ex) { | |
925 | throw newParseError(e, "invalid end point type '%s'", | |
926 | a.getValue()); | |
927 | } | |
928 | ||
929 | break; | |
930 | } | |
931 | } catch (IllegalArgumentException ex) { | |
932 | throw newParseError(e, | |
933 | "invalid attribute '%s' for '<endpoint>'", a.getName() | |
934 | .getLocalPart()); | |
935 | } | |
936 | } | |
937 | ||
938 |
1
1. __endpoint : negated conditional → NO_COVERAGE |
if (ep.node == null) |
939 | throw newParseError(e, | |
940 | "'<endpoint>' element requires a 'node' attribute"); | |
941 | ||
942 | e = getNextEvent(); | |
943 | ||
944 |
1
1. __endpoint : negated conditional → NO_COVERAGE |
if (isEvent(e, XMLEvent.START_ELEMENT, "desc")) { |
945 |
1
1. __endpoint : removed call to org/graphstream/stream/file/FileSourceGraphML::pushback → NO_COVERAGE |
pushback(e); |
946 | ep.desc = __desc(); | |
947 | } | |
948 | ||
949 | e = getNextEvent(); | |
950 |
1
1. __endpoint : removed call to org/graphstream/stream/file/FileSourceGraphML::checkValid → NO_COVERAGE |
checkValid(e, XMLEvent.END_ELEMENT, "endpoint"); |
951 | ||
952 |
1
1. __endpoint : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::__endpoint to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return ep; |
953 | } | |
954 | ||
955 | /** | |
956 | * <pre> | |
957 | * <!ELEMENT data (#PCDATA)> | |
958 | * <!ATTLIST data | |
959 | * key IDREF #REQUIRED | |
960 | * id ID #IMPLIED | |
961 | * > | |
962 | * </pre> | |
963 | * | |
964 | * @return | |
965 | * @throws IOException | |
966 | * @throws XMLStreamException | |
967 | */ | |
968 | private Data __data() throws IOException, XMLStreamException { | |
969 | XMLEvent e; | |
970 | StringBuilder buffer = new StringBuilder(); | |
971 | ||
972 | e = getNextEvent(); | |
973 |
1
1. __data : removed call to org/graphstream/stream/file/FileSourceGraphML::checkValid → NO_COVERAGE |
checkValid(e, XMLEvent.START_ELEMENT, "data"); |
974 | ||
975 | @SuppressWarnings("unchecked") | |
976 | Iterator<? extends Attribute> attributes = e.asStartElement() | |
977 | .getAttributes(); | |
978 | String key = null, id = null; | |
979 | ||
980 |
1
1. __data : negated conditional → NO_COVERAGE |
while (attributes.hasNext()) { |
981 | Attribute a = attributes.next(); | |
982 | ||
983 | try { | |
984 | DataAttribute attribute = DataAttribute | |
985 | .valueOf(toConstantName(a)); | |
986 | ||
987 | switch (attribute) { | |
988 | case KEY: | |
989 | key = a.getValue(); | |
990 | break; | |
991 | case ID: | |
992 | id = a.getValue(); | |
993 | break; | |
994 | } | |
995 | } catch (IllegalArgumentException ex) { | |
996 | throw newParseError(e, "invalid attribute '%s' for '<data>'", a | |
997 | .getName().getLocalPart()); | |
998 | } | |
999 | } | |
1000 | ||
1001 |
1
1. __data : negated conditional → NO_COVERAGE |
if (key == null) |
1002 | throw newParseError(e, | |
1003 | "'<data>' element must have a 'key' attribute"); | |
1004 | ||
1005 | e = getNextEvent(); | |
1006 | ||
1007 |
1
1. __data : negated conditional → NO_COVERAGE |
while (e.getEventType() == XMLEvent.CHARACTERS) { |
1008 | buffer.append(e.asCharacters()); | |
1009 | e = getNextEvent(); | |
1010 | } | |
1011 | ||
1012 |
1
1. __data : removed call to org/graphstream/stream/file/FileSourceGraphML::checkValid → NO_COVERAGE |
checkValid(e, XMLEvent.END_ELEMENT, "data"); |
1013 | ||
1014 |
1
1. __data : negated conditional → NO_COVERAGE |
if (keys.containsKey(key)) |
1015 | newParseError(e, "unknown key '%s'", key); | |
1016 | ||
1017 | Data d = new Data(); | |
1018 | ||
1019 | d.key = keys.get(key); | |
1020 | d.id = id; | |
1021 | d.value = buffer.toString(); | |
1022 | ||
1023 |
1
1. __data : mutated return of Object value for org/graphstream/stream/file/FileSourceGraphML::__data to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return d; |
1024 | } | |
1025 | ||
1026 | /** | |
1027 | * <pre> | |
1028 | * <!ELEMENT graph ((desc)?,((((data)|(node)|(edge)|(hyperedge))*)|(locator)))> | |
1029 | * <!ATTLIST graph | |
1030 | * id ID #IMPLIED | |
1031 | * edgedefault (directed|undirected) #REQUIRED | |
1032 | * > | |
1033 | * </pre> | |
1034 | * | |
1035 | * @throws IOException | |
1036 | * @throws XMLStreamException | |
1037 | */ | |
1038 | private void __graph() throws IOException, XMLStreamException { | |
1039 | XMLEvent e; | |
1040 | ||
1041 | e = getNextEvent(); | |
1042 |
1
1. __graph : removed call to org/graphstream/stream/file/FileSourceGraphML::checkValid → NO_COVERAGE |
checkValid(e, XMLEvent.START_ELEMENT, "graph"); |
1043 | ||
1044 | @SuppressWarnings("unchecked") | |
1045 | Iterator<? extends Attribute> attributes = e.asStartElement() | |
1046 | .getAttributes(); | |
1047 | ||
1048 | String id = null; | |
1049 | String desc = null; | |
1050 | boolean directed = false; | |
1051 | boolean directedSet = false; | |
1052 | ||
1053 |
1
1. __graph : negated conditional → NO_COVERAGE |
while (attributes.hasNext()) { |
1054 | Attribute a = attributes.next(); | |
1055 | ||
1056 | try { | |
1057 | GraphAttribute attribute = GraphAttribute | |
1058 | .valueOf(toConstantName(a)); | |
1059 | ||
1060 | switch (attribute) { | |
1061 | case ID: | |
1062 | id = a.getValue(); | |
1063 | break; | |
1064 | case EDGEDEFAULT: | |
1065 |
1
1. __graph : negated conditional → NO_COVERAGE |
if (a.getValue().equals("directed")) |
1066 | directed = true; | |
1067 |
1
1. __graph : negated conditional → NO_COVERAGE |
else if (a.getValue().equals("undirected")) |
1068 | directed = false; | |
1069 | else | |
1070 | throw newParseError(e, | |
1071 | "invalid 'edgefault' value '%s'", a.getValue()); | |
1072 | ||
1073 | directedSet = true; | |
1074 | ||
1075 | break; | |
1076 | } | |
1077 | } catch (IllegalArgumentException ex) { | |
1078 | throw newParseError(e, "invalid node attribute '%s'", a | |
1079 | .getName().getLocalPart()); | |
1080 | } | |
1081 | } | |
1082 | ||
1083 |
1
1. __graph : negated conditional → NO_COVERAGE |
if (!directedSet) |
1084 | throw newParseError(e, "graph requires attribute 'edgedefault'"); | |
1085 | ||
1086 | String gid = ""; | |
1087 | ||
1088 |
2
1. __graph : changed conditional boundary → NO_COVERAGE 2. __graph : negated conditional → NO_COVERAGE |
if (graphId.size() > 0) |
1089 | gid = graphId.peek() + ":"; | |
1090 | ||
1091 |
1
1. __graph : negated conditional → NO_COVERAGE |
if (id != null) |
1092 | gid += id; | |
1093 | else | |
1094 |
1
1. __graph : Replaced integer addition with subtraction → NO_COVERAGE |
gid += Integer.toString(graphCounter++); |
1095 | ||
1096 | graphId.push(gid); | |
1097 | ||
1098 | e = getNextEvent(); | |
1099 | ||
1100 |
1
1. __graph : negated conditional → NO_COVERAGE |
if (isEvent(e, XMLEvent.START_ELEMENT, "desc")) { |
1101 |
1
1. __graph : removed call to org/graphstream/stream/file/FileSourceGraphML::pushback → NO_COVERAGE |
pushback(e); |
1102 | desc = __desc(); | |
1103 | ||
1104 |
1
1. __graph : removed call to org/graphstream/stream/file/FileSourceGraphML::sendGraphAttributeAdded → NO_COVERAGE |
sendGraphAttributeAdded(sourceId, "desc", desc); |
1105 | ||
1106 | e = getNextEvent(); | |
1107 | } | |
1108 | ||
1109 |
1
1. __graph : negated conditional → NO_COVERAGE |
if (isEvent(e, XMLEvent.START_ELEMENT, "locator")) { |
1110 |
1
1. __graph : removed call to org/graphstream/stream/file/FileSourceGraphML::pushback → NO_COVERAGE |
pushback(e); |
1111 | __locator(); | |
1112 | // TODO | |
1113 | e = getNextEvent(); | |
1114 | } else { | |
1115 |
1
1. __graph : negated conditional → NO_COVERAGE |
while (isEvent(e, XMLEvent.START_ELEMENT, "data") |
1116 |
1
1. __graph : negated conditional → NO_COVERAGE |
|| isEvent(e, XMLEvent.START_ELEMENT, "node") |
1117 |
1
1. __graph : negated conditional → NO_COVERAGE |
|| isEvent(e, XMLEvent.START_ELEMENT, "edge") |
1118 |
1
1. __graph : negated conditional → NO_COVERAGE |
|| isEvent(e, XMLEvent.START_ELEMENT, "hyperedge")) { |
1119 |
1
1. __graph : removed call to org/graphstream/stream/file/FileSourceGraphML::pushback → NO_COVERAGE |
pushback(e); |
1120 | ||
1121 |
1
1. __graph : negated conditional → NO_COVERAGE |
if (isEvent(e, XMLEvent.START_ELEMENT, "data")) { |
1122 | datas.add(__data()); | |
1123 |
1
1. __graph : negated conditional → NO_COVERAGE |
} else if (isEvent(e, XMLEvent.START_ELEMENT, "node")) { |
1124 |
1
1. __graph : removed call to org/graphstream/stream/file/FileSourceGraphML::__node → NO_COVERAGE |
__node(); |
1125 |
1
1. __graph : negated conditional → NO_COVERAGE |
} else if (isEvent(e, XMLEvent.START_ELEMENT, "edge")) { |
1126 |
1
1. __graph : removed call to org/graphstream/stream/file/FileSourceGraphML::__edge → NO_COVERAGE |
__edge(directed); |
1127 | } else { | |
1128 |
1
1. __graph : removed call to org/graphstream/stream/file/FileSourceGraphML::__hyperedge → NO_COVERAGE |
__hyperedge(); |
1129 | } | |
1130 | ||
1131 | e = getNextEvent(); | |
1132 | } | |
1133 | } | |
1134 | ||
1135 | graphId.pop(); | |
1136 |
1
1. __graph : removed call to org/graphstream/stream/file/FileSourceGraphML::checkValid → NO_COVERAGE |
checkValid(e, XMLEvent.END_ELEMENT, "graph"); |
1137 | } | |
1138 | ||
1139 | /** | |
1140 | * <pre> | |
1141 | * <!ELEMENT node (desc?,(((data|port)*,graph?)|locator))> | |
1142 | * <!ATTLIST node | |
1143 | * id ID #REQUIRED | |
1144 | * > | |
1145 | * </pre> | |
1146 | * | |
1147 | * @throws IOException | |
1148 | * @throws XMLStreamException | |
1149 | */ | |
1150 | private void __node() throws IOException, XMLStreamException { | |
1151 | XMLEvent e; | |
1152 | ||
1153 | e = getNextEvent(); | |
1154 |
1
1. __node : removed call to org/graphstream/stream/file/FileSourceGraphML::checkValid → NO_COVERAGE |
checkValid(e, XMLEvent.START_ELEMENT, "node"); |
1155 | ||
1156 | @SuppressWarnings("unchecked") | |
1157 | Iterator<? extends Attribute> attributes = e.asStartElement() | |
1158 | .getAttributes(); | |
1159 | ||
1160 | String id = null; | |
1161 | HashSet<Key> sentAttributes = new HashSet<Key>(); | |
1162 | ||
1163 |
1
1. __node : negated conditional → NO_COVERAGE |
while (attributes.hasNext()) { |
1164 | Attribute a = attributes.next(); | |
1165 | ||
1166 | try { | |
1167 | NodeAttribute attribute = NodeAttribute | |
1168 | .valueOf(toConstantName(a)); | |
1169 | ||
1170 | switch (attribute) { | |
1171 | case ID: | |
1172 | id = a.getValue(); | |
1173 | break; | |
1174 | } | |
1175 | } catch (IllegalArgumentException ex) { | |
1176 | throw newParseError(e, "invalid node attribute '%s'", a | |
1177 | .getName().getLocalPart()); | |
1178 | } | |
1179 | } | |
1180 | ||
1181 |
1
1. __node : negated conditional → NO_COVERAGE |
if (id == null) |
1182 | throw newParseError(e, "node requires an id"); | |
1183 | ||
1184 |
1
1. __node : removed call to org/graphstream/stream/file/FileSourceGraphML::sendNodeAdded → NO_COVERAGE |
sendNodeAdded(sourceId, id); |
1185 | ||
1186 | e = getNextEvent(); | |
1187 | ||
1188 |
1
1. __node : negated conditional → NO_COVERAGE |
if (isEvent(e, XMLEvent.START_ELEMENT, "desc")) { |
1189 | String desc; | |
1190 | ||
1191 |
1
1. __node : removed call to org/graphstream/stream/file/FileSourceGraphML::pushback → NO_COVERAGE |
pushback(e); |
1192 | desc = __desc(); | |
1193 | ||
1194 |
1
1. __node : removed call to org/graphstream/stream/file/FileSourceGraphML::sendNodeAttributeAdded → NO_COVERAGE |
sendNodeAttributeAdded(sourceId, id, "desc", desc); |
1195 |
1
1. __node : negated conditional → NO_COVERAGE |
} else if (isEvent(e, XMLEvent.START_ELEMENT, "locator")) { |
1196 | // TODO | |
1197 |
1
1. __node : removed call to org/graphstream/stream/file/FileSourceGraphML::pushback → NO_COVERAGE |
pushback(e); |
1198 | __locator(); | |
1199 | } else { | |
1200 |
1
1. __node : negated conditional → NO_COVERAGE |
while (isEvent(e, XMLEvent.START_ELEMENT, "data") |
1201 |
1
1. __node : negated conditional → NO_COVERAGE |
|| isEvent(e, XMLEvent.START_ELEMENT, "port")) { |
1202 |
1
1. __node : negated conditional → NO_COVERAGE |
if (isEvent(e, XMLEvent.START_ELEMENT, "data")) { |
1203 | Data data; | |
1204 | ||
1205 |
1
1. __node : removed call to org/graphstream/stream/file/FileSourceGraphML::pushback → NO_COVERAGE |
pushback(e); |
1206 | data = __data(); | |
1207 | ||
1208 |
1
1. __node : removed call to org/graphstream/stream/file/FileSourceGraphML::sendNodeAttributeAdded → NO_COVERAGE |
sendNodeAttributeAdded(sourceId, id, data.key.name, |
1209 | getValue(data)); | |
1210 | ||
1211 | sentAttributes.add(data.key); | |
1212 | } else { | |
1213 |
1
1. __node : removed call to org/graphstream/stream/file/FileSourceGraphML::pushback → NO_COVERAGE |
pushback(e); |
1214 | __port(); | |
1215 | } | |
1216 | ||
1217 | e = getNextEvent(); | |
1218 | } | |
1219 | } | |
1220 | ||
1221 |
1
1. __node : negated conditional → NO_COVERAGE |
for (Key k : keys.values()) { |
1222 |
2
1. __node : negated conditional → NO_COVERAGE 2. __node : negated conditional → NO_COVERAGE |
if ((k.domain == KeyDomain.NODE || k.domain == KeyDomain.ALL) |
1223 |
1
1. __node : negated conditional → NO_COVERAGE |
&& !sentAttributes.contains(k)) |
1224 |
1
1. __node : removed call to org/graphstream/stream/file/FileSourceGraphML::sendNodeAttributeAdded → NO_COVERAGE |
sendNodeAttributeAdded(sourceId, id, k.name, getDefaultValue(k)); |
1225 | } | |
1226 | ||
1227 |
1
1. __node : negated conditional → NO_COVERAGE |
if (isEvent(e, XMLEvent.START_ELEMENT, "graph")) { |
1228 | Location loc = e.getLocation(); | |
1229 | ||
1230 | System.err.printf( | |
1231 | "[WARNING] %d:%d graph inside node is not implemented", | |
1232 | loc.getLineNumber(), loc.getColumnNumber()); | |
1233 | ||
1234 |
1
1. __node : removed call to org/graphstream/stream/file/FileSourceGraphML::pushback → NO_COVERAGE |
pushback(e); |
1235 |
1
1. __node : removed call to org/graphstream/stream/file/FileSourceGraphML::__graph → NO_COVERAGE |
__graph(); |
1236 | ||
1237 | e = getNextEvent(); | |
1238 | } | |
1239 | ||
1240 |
1
1. __node : removed call to org/graphstream/stream/file/FileSourceGraphML::checkValid → NO_COVERAGE |
checkValid(e, XMLEvent.END_ELEMENT, "node"); |
1241 | } | |
1242 | ||
1243 | /** | |
1244 | * <pre> | |
1245 | * <!ELEMENT edge ((desc)?,(data)*,(graph)?)> | |
1246 | * <!ATTLIST edge | |
1247 | * id ID #IMPLIED | |
1248 | * source IDREF #REQUIRED | |
1249 | * sourceport NMTOKEN #IMPLIED | |
1250 | * target IDREF #REQUIRED | |
1251 | * targetport NMTOKEN #IMPLIED | |
1252 | * directed (true|false) #IMPLIED | |
1253 | * > | |
1254 | * </pre> | |
1255 | * | |
1256 | * @param edgedefault | |
1257 | * @throws IOException | |
1258 | * @throws XMLStreamException | |
1259 | */ | |
1260 | private void __edge(boolean edgedefault) throws IOException, | |
1261 | XMLStreamException { | |
1262 | XMLEvent e; | |
1263 | ||
1264 | e = getNextEvent(); | |
1265 |
1
1. __edge : removed call to org/graphstream/stream/file/FileSourceGraphML::checkValid → NO_COVERAGE |
checkValid(e, XMLEvent.START_ELEMENT, "edge"); |
1266 | ||
1267 | @SuppressWarnings("unchecked") | |
1268 | Iterator<? extends Attribute> attributes = e.asStartElement() | |
1269 | .getAttributes(); | |
1270 | ||
1271 | HashSet<Key> sentAttributes = new HashSet<Key>(); | |
1272 | String id = null; | |
1273 | boolean directed = edgedefault; | |
1274 | String source = null; | |
1275 | String target = null; | |
1276 | ||
1277 |
1
1. __edge : negated conditional → NO_COVERAGE |
while (attributes.hasNext()) { |
1278 | Attribute a = attributes.next(); | |
1279 | ||
1280 | try { | |
1281 | EdgeAttribute attribute = EdgeAttribute | |
1282 | .valueOf(toConstantName(a)); | |
1283 | ||
1284 | switch (attribute) { | |
1285 | case ID: | |
1286 | id = a.getValue(); | |
1287 | break; | |
1288 | case DIRECTED: | |
1289 | directed = Boolean.parseBoolean(a.getValue()); | |
1290 | break; | |
1291 | case SOURCE: | |
1292 | source = a.getValue(); | |
1293 | break; | |
1294 | case TARGET: | |
1295 | target = a.getValue(); | |
1296 | break; | |
1297 | case SOURCEPORT: | |
1298 | case TARGETPORT: | |
1299 | throw newParseError(e, | |
1300 | "sourceport and targetport not implemented"); | |
1301 | } | |
1302 | } catch (IllegalArgumentException ex) { | |
1303 | throw newParseError(e, "invalid graph attribute '%s'", a | |
1304 | .getName().getLocalPart()); | |
1305 | } | |
1306 | } | |
1307 | ||
1308 |
1
1. __edge : negated conditional → NO_COVERAGE |
if (id == null) |
1309 | throw newParseError(e, "edge must have an id"); | |
1310 | ||
1311 |
2
1. __edge : negated conditional → NO_COVERAGE 2. __edge : negated conditional → NO_COVERAGE |
if (source == null || target == null) |
1312 | throw newParseError(e, "edge must have a source and a target"); | |
1313 | ||
1314 |
1
1. __edge : removed call to org/graphstream/stream/file/FileSourceGraphML::sendEdgeAdded → NO_COVERAGE |
sendEdgeAdded(sourceId, id, source, target, directed); |
1315 | ||
1316 | e = getNextEvent(); | |
1317 | ||
1318 |
1
1. __edge : negated conditional → NO_COVERAGE |
if (isEvent(e, XMLEvent.START_ELEMENT, "desc")) { |
1319 | String desc; | |
1320 | ||
1321 |
1
1. __edge : removed call to org/graphstream/stream/file/FileSourceGraphML::pushback → NO_COVERAGE |
pushback(e); |
1322 | desc = __desc(); | |
1323 | ||
1324 |
1
1. __edge : removed call to org/graphstream/stream/file/FileSourceGraphML::sendEdgeAttributeAdded → NO_COVERAGE |
sendEdgeAttributeAdded(sourceId, id, "desc", desc); |
1325 | } else { | |
1326 |
1
1. __edge : negated conditional → NO_COVERAGE |
while (isEvent(e, XMLEvent.START_ELEMENT, "data")) { |
1327 | Data data; | |
1328 | ||
1329 |
1
1. __edge : removed call to org/graphstream/stream/file/FileSourceGraphML::pushback → NO_COVERAGE |
pushback(e); |
1330 | data = __data(); | |
1331 | ||
1332 |
1
1. __edge : removed call to org/graphstream/stream/file/FileSourceGraphML::sendEdgeAttributeAdded → NO_COVERAGE |
sendEdgeAttributeAdded(sourceId, id, data.key.name, |
1333 | getValue(data)); | |
1334 | ||
1335 | sentAttributes.add(data.key); | |
1336 | ||
1337 | e = getNextEvent(); | |
1338 | } | |
1339 | } | |
1340 | ||
1341 |
1
1. __edge : negated conditional → NO_COVERAGE |
for (Key k : keys.values()) { |
1342 |
2
1. __edge : negated conditional → NO_COVERAGE 2. __edge : negated conditional → NO_COVERAGE |
if ((k.domain == KeyDomain.EDGE || k.domain == KeyDomain.ALL) |
1343 |
1
1. __edge : negated conditional → NO_COVERAGE |
&& !sentAttributes.contains(k)) |
1344 |
1
1. __edge : removed call to org/graphstream/stream/file/FileSourceGraphML::sendEdgeAttributeAdded → NO_COVERAGE |
sendEdgeAttributeAdded(sourceId, id, k.name, getDefaultValue(k)); |
1345 | } | |
1346 | ||
1347 |
1
1. __edge : negated conditional → NO_COVERAGE |
if (isEvent(e, XMLEvent.START_ELEMENT, "graph")) { |
1348 | Location loc = e.getLocation(); | |
1349 | ||
1350 | System.err.printf( | |
1351 | "[WARNING] %d:%d graph inside node is not implemented", | |
1352 | loc.getLineNumber(), loc.getColumnNumber()); | |
1353 | ||
1354 |
1
1. __edge : removed call to org/graphstream/stream/file/FileSourceGraphML::pushback → NO_COVERAGE |
pushback(e); |
1355 |
1
1. __edge : removed call to org/graphstream/stream/file/FileSourceGraphML::__graph → NO_COVERAGE |
__graph(); |
1356 | ||
1357 | e = getNextEvent(); | |
1358 | } | |
1359 | ||
1360 |
1
1. __edge : removed call to org/graphstream/stream/file/FileSourceGraphML::checkValid → NO_COVERAGE |
checkValid(e, XMLEvent.END_ELEMENT, "edge"); |
1361 | } | |
1362 | ||
1363 | /** | |
1364 | * <pre> | |
1365 | * <!ELEMENT hyperedge ((desc)?,((data)|(endpoint))*,(graph)?)> | |
1366 | * <!ATTLIST hyperedge | |
1367 | * id ID #IMPLIED | |
1368 | * > | |
1369 | * </pre> | |
1370 | * | |
1371 | * @throws IOException | |
1372 | * @throws XMLStreamException | |
1373 | */ | |
1374 | private void __hyperedge() throws IOException, XMLStreamException { | |
1375 | XMLEvent e; | |
1376 | ||
1377 | e = getNextEvent(); | |
1378 |
1
1. __hyperedge : removed call to org/graphstream/stream/file/FileSourceGraphML::checkValid → NO_COVERAGE |
checkValid(e, XMLEvent.START_ELEMENT, "hyperedge"); |
1379 | ||
1380 | Location loc = e.getLocation(); | |
1381 | ||
1382 | System.err.printf( | |
1383 | "[WARNING] %d:%d hyperedge feature is not implemented", | |
1384 | loc.getLineNumber(), loc.getColumnNumber()); | |
1385 | ||
1386 | String id = null; | |
1387 | ||
1388 | @SuppressWarnings("unchecked") | |
1389 | Iterator<? extends Attribute> attributes = e.asStartElement() | |
1390 | .getAttributes(); | |
1391 | ||
1392 |
1
1. __hyperedge : negated conditional → NO_COVERAGE |
while (attributes.hasNext()) { |
1393 | Attribute a = attributes.next(); | |
1394 | ||
1395 | try { | |
1396 | HyperEdgeAttribute attribute = HyperEdgeAttribute | |
1397 | .valueOf(toConstantName(a)); | |
1398 | ||
1399 | switch (attribute) { | |
1400 | case ID: | |
1401 | id = a.getValue(); | |
1402 | break; | |
1403 | } | |
1404 | } catch (IllegalArgumentException ex) { | |
1405 | throw newParseError(e, | |
1406 | "invalid attribute '%s' for '<endpoint>'", a.getName() | |
1407 | .getLocalPart()); | |
1408 | } | |
1409 | } | |
1410 | ||
1411 |
1
1. __hyperedge : negated conditional → NO_COVERAGE |
if (id == null) |
1412 | throw newParseError(e, | |
1413 | "'<hyperedge>' element requires a 'node' attribute"); | |
1414 | ||
1415 | e = getNextEvent(); | |
1416 | ||
1417 |
1
1. __hyperedge : negated conditional → NO_COVERAGE |
if (isEvent(e, XMLEvent.START_ELEMENT, "desc")) { |
1418 |
1
1. __hyperedge : removed call to org/graphstream/stream/file/FileSourceGraphML::pushback → NO_COVERAGE |
pushback(e); |
1419 | __desc(); | |
1420 | } else { | |
1421 |
1
1. __hyperedge : negated conditional → NO_COVERAGE |
while (isEvent(e, XMLEvent.START_ELEMENT, "data") |
1422 |
1
1. __hyperedge : negated conditional → NO_COVERAGE |
|| isEvent(e, XMLEvent.START_ELEMENT, "endpoint")) { |
1423 |
1
1. __hyperedge : negated conditional → NO_COVERAGE |
if (isEvent(e, XMLEvent.START_ELEMENT, "data")) { |
1424 |
1
1. __hyperedge : removed call to org/graphstream/stream/file/FileSourceGraphML::pushback → NO_COVERAGE |
pushback(e); |
1425 | __data(); | |
1426 | } else { | |
1427 |
1
1. __hyperedge : removed call to org/graphstream/stream/file/FileSourceGraphML::pushback → NO_COVERAGE |
pushback(e); |
1428 | __endpoint(); | |
1429 | } | |
1430 | ||
1431 | e = getNextEvent(); | |
1432 | } | |
1433 | } | |
1434 | ||
1435 |
1
1. __hyperedge : negated conditional → NO_COVERAGE |
if (isEvent(e, XMLEvent.START_ELEMENT, "graph")) { |
1436 | loc = e.getLocation(); | |
1437 | ||
1438 | System.err.printf( | |
1439 | "[WARNING] %d:%d graph inside node is not implemented", | |
1440 | loc.getLineNumber(), loc.getColumnNumber()); | |
1441 | ||
1442 |
1
1. __hyperedge : removed call to org/graphstream/stream/file/FileSourceGraphML::pushback → NO_COVERAGE |
pushback(e); |
1443 |
1
1. __hyperedge : removed call to org/graphstream/stream/file/FileSourceGraphML::__graph → NO_COVERAGE |
__graph(); |
1444 | ||
1445 | e = getNextEvent(); | |
1446 | } | |
1447 | ||
1448 | e = getNextEvent(); | |
1449 |
1
1. __hyperedge : removed call to org/graphstream/stream/file/FileSourceGraphML::checkValid → NO_COVERAGE |
checkValid(e, XMLEvent.END_ELEMENT, "hyperedge"); |
1450 | } | |
1451 | } | |
Mutations | ||
147 |
1.1 |
|
148 |
1.1 |
|
152 |
1.1 |
|
154 |
1.1 |
|
156 |
1.1 |
|
158 |
1.1 |
|
160 |
1.1 |
|
162 |
1.1 |
|
165 |
1.1 |
|
169 |
1.1 |
|
248 |
1.1 |
|
257 |
1.1 |
|
266 |
1.1 |
|
275 |
1.1 |
|
276 |
1.1 |
|
278 |
1.1 |
|
287 |
1.1 |
|
296 |
1.1 |
|
305 |
1.1 |
|
314 |
1.1 |
|
324 |
1.1 |
|
329 |
1.1 |
|
338 |
1.1 |
|
347 |
1.1 |
|
351 |
1.1 |
|
353 |
1.1 2.2 |
|
354 |
1.1 |
|
356 |
1.1 |
|
365 |
1.1 |
|
369 |
1.1 |
|
371 |
1.1 |
|
393 |
1.1 |
|
400 |
1.1 |
|
420 |
1.1 |
|
426 |
1.1 |
|
428 |
1.1 |
|
430 |
1.1 |
|
432 |
1.1 |
|
434 |
1.1 |
|
436 |
1.1 |
|
438 |
1.1 |
|
440 |
1.1 |
|
442 |
1.1 |
|
444 |
1.1 |
|
446 |
1.1 |
|
453 |
1.1 |
|
455 |
1.1 |
|
457 |
1.1 |
|
459 |
1.1 |
|
461 |
1.1 |
|
463 |
1.1 |
|
466 |
1.1 |
|
472 |
1.1 |
|
474 |
1.1 |
|
475 |
1.1 |
|
477 |
1.1 |
|
479 |
1.1 |
|
480 |
1.1 |
|
482 |
1.1 |
|
484 |
1.1 |
|
485 |
1.1 |
|
487 |
1.1 |
|
489 |
1.1 |
|
490 |
1.1 |
|
492 |
1.1 |
|
494 |
1.1 |
|
495 |
1.1 |
|
497 |
1.1 |
|
500 |
1.1 2.2 |
|
507 |
1.1 2.2 |
|
511 |
1.1 |
|
512 |
1.1 |
|
514 |
1.1 |
|
518 |
1.1 |
|
519 |
1.1 |
|
527 |
1.1 |
|
538 |
1.1 |
|
547 |
1.1 |
|
551 |
1.1 |
|
566 |
1.1 |
|
570 |
1.1 |
|
571 |
1.1 |
|
577 |
1.1 |
|
578 |
1.1 |
|
579 |
1.1 |
|
584 |
1.1 |
|
585 |
1.1 |
|
586 |
1.1 |
|
588 |
1.1 |
|
591 |
1.1 |
|
597 |
1.1 |
|
606 |
1.1 |
|
611 |
1.1 |
|
613 |
1.1 |
|
630 |
1.1 |
|
635 |
1.1 |
|
637 |
1.1 |
|
658 |
1.1 |
|
666 |
1.1 |
|
691 |
1.1 |
|
693 |
1.1 |
|
696 |
1.1 |
|
715 |
1.1 |
|
727 |
1.1 |
|
772 |
1.1 |
|
776 |
1.1 |
|
781 |
1.1 |
|
783 |
1.1 |
|
786 |
1.1 |
|
816 |
1.1 |
|
822 |
1.1 |
|
840 |
1.1 |
|
845 |
1.1 |
|
846 |
1.1 |
|
849 |
1.1 |
|
850 |
1.1 |
|
851 |
1.1 |
|
854 |
1.1 |
|
861 |
1.1 |
|
872 |
1.1 |
|
874 |
1.1 |
|
896 |
1.1 |
|
903 |
1.1 |
|
938 |
1.1 |
|
944 |
1.1 |
|
945 |
1.1 |
|
950 |
1.1 |
|
952 |
1.1 |
|
973 |
1.1 |
|
980 |
1.1 |
|
1001 |
1.1 |
|
1007 |
1.1 |
|
1012 |
1.1 |
|
1014 |
1.1 |
|
1023 |
1.1 |
|
1042 |
1.1 |
|
1053 |
1.1 |
|
1065 |
1.1 |
|
1067 |
1.1 |
|
1083 |
1.1 |
|
1088 |
1.1 2.2 |
|
1091 |
1.1 |
|
1094 |
1.1 |
|
1100 |
1.1 |
|
1101 |
1.1 |
|
1104 |
1.1 |
|
1109 |
1.1 |
|
1110 |
1.1 |
|
1115 |
1.1 |
|
1116 |
1.1 |
|
1117 |
1.1 |
|
1118 |
1.1 |
|
1119 |
1.1 |
|
1121 |
1.1 |
|
1123 |
1.1 |
|
1124 |
1.1 |
|
1125 |
1.1 |
|
1126 |
1.1 |
|
1128 |
1.1 |
|
1136 |
1.1 |
|
1154 |
1.1 |
|
1163 |
1.1 |
|
1181 |
1.1 |
|
1184 |
1.1 |
|
1188 |
1.1 |
|
1191 |
1.1 |
|
1194 |
1.1 |
|
1195 |
1.1 |
|
1197 |
1.1 |
|
1200 |
1.1 |
|
1201 |
1.1 |
|
1202 |
1.1 |
|
1205 |
1.1 |
|
1208 |
1.1 |
|
1213 |
1.1 |
|
1221 |
1.1 |
|
1222 |
1.1 2.2 |
|
1223 |
1.1 |
|
1224 |
1.1 |
|
1227 |
1.1 |
|
1234 |
1.1 |
|
1235 |
1.1 |
|
1240 |
1.1 |
|
1265 |
1.1 |
|
1277 |
1.1 |
|
1308 |
1.1 |
|
1311 |
1.1 2.2 |
|
1314 |
1.1 |
|
1318 |
1.1 |
|
1321 |
1.1 |
|
1324 |
1.1 |
|
1326 |
1.1 |
|
1329 |
1.1 |
|
1332 |
1.1 |
|
1341 |
1.1 |
|
1342 |
1.1 2.2 |
|
1343 |
1.1 |
|
1344 |
1.1 |
|
1347 |
1.1 |
|
1354 |
1.1 |
|
1355 |
1.1 |
|
1360 |
1.1 |
|
1378 |
1.1 |
|
1392 |
1.1 |
|
1411 |
1.1 |
|
1417 |
1.1 |
|
1418 |
1.1 |
|
1421 |
1.1 |
|
1422 |
1.1 |
|
1423 |
1.1 |
|
1424 |
1.1 |
|
1427 |
1.1 |
|
1435 |
1.1 |
|
1442 |
1.1 |
|
1443 |
1.1 |
|
1449 |
1.1 |