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.dot; | |
33 | ||
34 | import java.io.InputStream; | |
35 | import java.io.IOException; | |
36 | import java.io.Reader; | |
37 | ||
38 | import java.util.HashMap; | |
39 | import java.util.HashSet; | |
40 | import java.util.LinkedList; | |
41 | ||
42 | import org.graphstream.stream.SourceBase.ElementType; | |
43 | import org.graphstream.stream.file.FileSourceDOT; | |
44 | import org.graphstream.graph.implementations.AbstractElement.AttributeChangeEvent; | |
45 | ||
46 | import org.graphstream.util.parser.ParseException; | |
47 | import org.graphstream.util.parser.Parser; | |
48 | import org.graphstream.util.parser.SimpleCharStream; | |
49 | import org.graphstream.util.parser.Token; | |
50 | import org.graphstream.util.parser.TokenMgrError; | |
51 | ||
52 | /** | |
53 | * This class defines a DOT parser. | |
54 | * | |
55 | * It respects the specifications of the DOT language that can be found <a | |
56 | * href="http://www.graphviz.org/doc/info/lang.html">here</a>. | |
57 | * | |
58 | * Subgraph produces no error but has no effect on the graph. | |
59 | */ | |
60 | @SuppressWarnings("unused") | |
61 | public class DOTParser implements Parser, DOTParserConstants { | |
62 | /** | |
63 | * The DOT source associated with this parser. | |
64 | */ | |
65 | private FileSourceDOT dot; | |
66 | ||
67 | /** | |
68 | * Id of the parser used in events. | |
69 | */ | |
70 | private String sourceId; | |
71 | ||
72 | /** | |
73 | * Flag telling if the graph is directed. | |
74 | */ | |
75 | private boolean directed; | |
76 | ||
77 | /** | |
78 | * Flag telling if the graph is 'strict'. | |
79 | */ | |
80 | private boolean strict; | |
81 | ||
82 | /** | |
83 | * Global attributes of nodes. | |
84 | */ | |
85 | private HashMap<String, Object> globalNodesAttributes; | |
86 | ||
87 | /** | |
88 | * Global attributes of edges. | |
89 | */ | |
90 | private HashMap<String, Object> globalEdgesAttributes; | |
91 | ||
92 | /** | |
93 | * IDs of added nodes. | |
94 | */ | |
95 | private HashSet<String> nodeAdded; | |
96 | ||
97 | /** | |
98 | * Create a new parser associated with a DOT source from an input stream. | |
99 | */ | |
100 | public DOTParser(FileSourceDOT dot, InputStream stream) { | |
101 | this(stream); | |
102 |
1
1. |
init(dot); |
103 | } | |
104 | ||
105 | /** | |
106 | * Create a new parser associated with a DOT source from a reader. | |
107 | */ | |
108 | public DOTParser(FileSourceDOT dot, Reader stream) { | |
109 | this(stream); | |
110 |
1
1. |
init(dot); |
111 | } | |
112 | ||
113 | /** | |
114 | * Closes the parser, closing the opened stream. | |
115 | */ | |
116 | public void close() throws IOException { | |
117 |
1
1. close : removed call to org/graphstream/util/parser/SimpleCharStream::close → NO_COVERAGE |
jj_input_stream.close(); |
118 | } | |
119 | ||
120 | private void init(FileSourceDOT dot) { | |
121 | this.dot = dot; | |
122 | this.sourceId = String.format("<DOT stream %x>", System.nanoTime()); | |
123 | ||
124 | globalNodesAttributes = new HashMap<String, Object>(); | |
125 | globalEdgesAttributes = new HashMap<String, Object>(); | |
126 | ||
127 | nodeAdded = new HashSet<String>(); | |
128 | } | |
129 | ||
130 | private void addNode(String nodeId, String[] port, | |
131 | HashMap<String, Object> attr) { | |
132 |
1
1. addNode : negated conditional → NO_COVERAGE |
if (nodeAdded.contains(nodeId)) { |
133 |
1
1. addNode : negated conditional → NO_COVERAGE |
if (attr != null) { |
134 |
1
1. addNode : negated conditional → NO_COVERAGE |
for (String key : attr.keySet()) |
135 |
1
1. addNode : removed call to org/graphstream/stream/file/FileSourceDOT::sendAttributeChangedEvent → NO_COVERAGE |
dot.sendAttributeChangedEvent(sourceId, nodeId, |
136 | ElementType.NODE, key, AttributeChangeEvent.ADD, | |
137 | null, attr.get(key)); | |
138 | } | |
139 | } else { | |
140 |
1
1. addNode : removed call to org/graphstream/stream/file/FileSourceDOT::sendNodeAdded → NO_COVERAGE |
dot.sendNodeAdded(sourceId, nodeId); |
141 | nodeAdded.add(nodeId); | |
142 | ||
143 |
1
1. addNode : negated conditional → NO_COVERAGE |
if (attr == null) { |
144 |
1
1. addNode : negated conditional → NO_COVERAGE |
for (String key : globalNodesAttributes.keySet()) |
145 |
1
1. addNode : removed call to org/graphstream/stream/file/FileSourceDOT::sendAttributeChangedEvent → NO_COVERAGE |
dot.sendAttributeChangedEvent(sourceId, nodeId, |
146 | ElementType.NODE, key, AttributeChangeEvent.ADD, | |
147 | null, globalNodesAttributes.get(key)); | |
148 | } else { | |
149 |
1
1. addNode : negated conditional → NO_COVERAGE |
for (String key : globalNodesAttributes.keySet()) { |
150 |
1
1. addNode : negated conditional → NO_COVERAGE |
if (!attr.containsKey(key)) |
151 |
1
1. addNode : removed call to org/graphstream/stream/file/FileSourceDOT::sendAttributeChangedEvent → NO_COVERAGE |
dot.sendAttributeChangedEvent(sourceId, nodeId, |
152 | ElementType.NODE, key, | |
153 | AttributeChangeEvent.ADD, null, | |
154 | globalNodesAttributes.get(key)); | |
155 | } | |
156 | ||
157 |
1
1. addNode : negated conditional → NO_COVERAGE |
for (String key : attr.keySet()) |
158 |
1
1. addNode : removed call to org/graphstream/stream/file/FileSourceDOT::sendAttributeChangedEvent → NO_COVERAGE |
dot.sendAttributeChangedEvent(sourceId, nodeId, |
159 | ElementType.NODE, key, AttributeChangeEvent.ADD, | |
160 | null, attr.get(key)); | |
161 | } | |
162 | } | |
163 | } | |
164 | ||
165 | private void addEdges(LinkedList<String> edges, HashMap<String, Object> attr) { | |
166 | HashMap<String, Integer> hash = new HashMap<String, Integer>(); | |
167 |
2
1. addEdges : Replaced integer subtraction with addition → NO_COVERAGE 2. addEdges : Replaced integer division with multiplication → NO_COVERAGE |
String[] ids = new String[(edges.size() - 1) / 2]; |
168 |
2
1. addEdges : Replaced integer subtraction with addition → NO_COVERAGE 2. addEdges : Replaced integer division with multiplication → NO_COVERAGE |
boolean[] directed = new boolean[(edges.size() - 1) / 2]; |
169 | int count = 0; | |
170 | ||
171 |
4
1. addEdges : changed conditional boundary → NO_COVERAGE 2. addEdges : Changed increment from 2 to -2 → NO_COVERAGE 3. addEdges : Replaced integer subtraction with addition → NO_COVERAGE 4. addEdges : negated conditional → NO_COVERAGE |
for (int i = 0; i < edges.size() - 1; i += 2) { |
172 | String from = edges.get(i); | |
173 |
1
1. addEdges : Replaced integer addition with subtraction → NO_COVERAGE |
String to = edges.get(i + 2); |
174 | ||
175 |
1
1. addEdges : negated conditional → NO_COVERAGE |
if (!nodeAdded.contains(from)) |
176 |
1
1. addEdges : removed call to org/graphstream/stream/file/dot/DOTParser::addNode → NO_COVERAGE |
addNode(from, null, null); |
177 |
1
1. addEdges : negated conditional → NO_COVERAGE |
if (!nodeAdded.contains(to)) |
178 |
1
1. addEdges : removed call to org/graphstream/stream/file/dot/DOTParser::addNode → NO_COVERAGE |
addNode(to, null, null); |
179 | ||
180 | String edgeId = String.format("(%s;%s)", from, to); | |
181 | String rev = String.format("(%s;%s)", to, from); | |
182 | ||
183 |
1
1. addEdges : negated conditional → NO_COVERAGE |
if (hash.containsKey(rev)) { |
184 | directed[hash.get(rev)] = false; | |
185 | } else { | |
186 | hash.put(edgeId, count); | |
187 | ids[count] = edgeId; | |
188 |
1
1. addEdges : Replaced integer addition with subtraction → NO_COVERAGE |
directed[count] = edges.get(i + 1).equals("->"); |
189 | ||
190 |
1
1. addEdges : Changed increment from 1 to -1 → NO_COVERAGE |
count++; |
191 | } | |
192 | } | |
193 | ||
194 |
1
1. addEdges : removed call to java/util/HashMap::clear → NO_COVERAGE |
hash.clear(); |
195 | ||
196 |
3
1. addEdges : negated conditional → NO_COVERAGE 2. addEdges : negated conditional → NO_COVERAGE 3. addEdges : negated conditional → NO_COVERAGE |
if (count == 1 && attr != null && attr.containsKey("id")) { |
197 | ids[0] = attr.get("id").toString(); | |
198 | attr.remove("id"); | |
199 | } | |
200 | ||
201 |
3
1. addEdges : changed conditional boundary → NO_COVERAGE 2. addEdges : Changed increment from 1 to -1 → NO_COVERAGE 3. addEdges : negated conditional → NO_COVERAGE |
for (int i = 0; i < count; i++) { |
202 |
2
1. addEdges : Replaced integer multiplication with division → NO_COVERAGE 2. addEdges : removed call to org/graphstream/stream/file/FileSourceDOT::sendEdgeAdded → NO_COVERAGE |
dot.sendEdgeAdded(sourceId, ids[i], edges.get(i * 2), edges |
203 |
2
1. addEdges : Replaced integer addition with subtraction → NO_COVERAGE 2. addEdges : Replaced integer multiplication with division → NO_COVERAGE |
.get((i + 1) * 2), directed[i]); |
204 | ||
205 |
1
1. addEdges : negated conditional → NO_COVERAGE |
if (attr == null) { |
206 |
1
1. addEdges : negated conditional → NO_COVERAGE |
for (String key : globalEdgesAttributes.keySet()) |
207 |
1
1. addEdges : removed call to org/graphstream/stream/file/FileSourceDOT::sendAttributeChangedEvent → NO_COVERAGE |
dot.sendAttributeChangedEvent(sourceId, ids[i], |
208 | ElementType.EDGE, key, AttributeChangeEvent.ADD, | |
209 | null, globalEdgesAttributes.get(key)); | |
210 | } else { | |
211 |
1
1. addEdges : negated conditional → NO_COVERAGE |
for (String key : globalEdgesAttributes.keySet()) { |
212 |
1
1. addEdges : negated conditional → NO_COVERAGE |
if (!attr.containsKey(key)) |
213 |
1
1. addEdges : removed call to org/graphstream/stream/file/FileSourceDOT::sendAttributeChangedEvent → NO_COVERAGE |
dot.sendAttributeChangedEvent(sourceId, ids[i], |
214 | ElementType.EDGE, key, | |
215 | AttributeChangeEvent.ADD, null, | |
216 | globalEdgesAttributes.get(key)); | |
217 | } | |
218 | ||
219 |
1
1. addEdges : negated conditional → NO_COVERAGE |
for (String key : attr.keySet()) |
220 |
1
1. addEdges : removed call to org/graphstream/stream/file/FileSourceDOT::sendAttributeChangedEvent → NO_COVERAGE |
dot.sendAttributeChangedEvent(sourceId, ids[i], |
221 | ElementType.EDGE, key, AttributeChangeEvent.ADD, | |
222 | null, attr.get(key)); | |
223 | } | |
224 | } | |
225 | } | |
226 | ||
227 | private void setGlobalAttributes(String who, HashMap<String, Object> attr) { | |
228 |
1
1. setGlobalAttributes : negated conditional → NO_COVERAGE |
if (who.equalsIgnoreCase("graph")) { |
229 |
1
1. setGlobalAttributes : negated conditional → NO_COVERAGE |
for (String key : attr.keySet()) |
230 |
1
1. setGlobalAttributes : removed call to org/graphstream/stream/file/FileSourceDOT::sendAttributeChangedEvent → NO_COVERAGE |
dot.sendAttributeChangedEvent(sourceId, sourceId, |
231 | ElementType.GRAPH, key, AttributeChangeEvent.ADD, null, | |
232 | attr.get(key)); | |
233 |
1
1. setGlobalAttributes : negated conditional → NO_COVERAGE |
} else if (who.equalsIgnoreCase("node")) |
234 |
1
1. setGlobalAttributes : removed call to java/util/HashMap::putAll → NO_COVERAGE |
globalNodesAttributes.putAll(attr); |
235 |
1
1. setGlobalAttributes : negated conditional → NO_COVERAGE |
else if (who.equalsIgnoreCase("edge")) |
236 |
1
1. setGlobalAttributes : removed call to java/util/HashMap::putAll → NO_COVERAGE |
globalEdgesAttributes.putAll(attr); |
237 | } | |
238 | ||
239 | final public void all() throws ParseException { | |
240 |
1
1. all : removed call to org/graphstream/stream/file/dot/DOTParser::graph → NO_COVERAGE |
graph(); |
241 | label_1: while (true) { | |
242 |
1
1. all : negated conditional → NO_COVERAGE |
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { |
243 | case GRAPH: | |
244 | case SUBGRAPH: | |
245 | case NODE: | |
246 | case EDGE: | |
247 | case REAL: | |
248 | case STRING: | |
249 | case WORD: | |
250 | ; | |
251 | break; | |
252 | default: | |
253 | jj_la1[0] = jj_gen; | |
254 | break label_1; | |
255 | } | |
256 |
1
1. all : removed call to org/graphstream/stream/file/dot/DOTParser::statement → NO_COVERAGE |
statement(); |
257 | } | |
258 | jj_consume_token(RBRACE); | |
259 | } | |
260 | ||
261 | final public boolean next() throws ParseException { | |
262 | boolean hasMore = false; | |
263 |
1
1. next : negated conditional → NO_COVERAGE |
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { |
264 | case GRAPH: | |
265 | case SUBGRAPH: | |
266 | case NODE: | |
267 | case EDGE: | |
268 | case REAL: | |
269 | case STRING: | |
270 | case WORD: | |
271 |
1
1. next : removed call to org/graphstream/stream/file/dot/DOTParser::statement → NO_COVERAGE |
statement(); |
272 | hasMore = true; | |
273 | break; | |
274 | case RBRACE: | |
275 | jj_consume_token(RBRACE); | |
276 | break; | |
277 | case 0: | |
278 | jj_consume_token(0); | |
279 | break; | |
280 | default: | |
281 | jj_la1[1] = jj_gen; | |
282 | jj_consume_token(-1); | |
283 | throw new ParseException(); | |
284 | } | |
285 | ||
286 |
1
1. next : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return hasMore; |
287 | } | |
288 | ||
289 | final public void open() throws ParseException { | |
290 |
1
1. open : removed call to org/graphstream/stream/file/dot/DOTParser::graph → NO_COVERAGE |
graph(); |
291 | } | |
292 | ||
293 | final private void graph() throws ParseException { | |
294 | directed = false; | |
295 | strict = false; | |
296 | ||
297 |
1
1. graph : removed call to java/util/HashMap::clear → NO_COVERAGE |
globalNodesAttributes.clear(); |
298 |
1
1. graph : removed call to java/util/HashMap::clear → NO_COVERAGE |
globalEdgesAttributes.clear(); |
299 |
1
1. graph : negated conditional → NO_COVERAGE |
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { |
300 | case STRICT: | |
301 | jj_consume_token(STRICT); | |
302 | strict = true; | |
303 | break; | |
304 | default: | |
305 | jj_la1[2] = jj_gen; | |
306 | ; | |
307 | } | |
308 |
1
1. graph : negated conditional → NO_COVERAGE |
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { |
309 | case GRAPH: | |
310 | jj_consume_token(GRAPH); | |
311 | break; | |
312 | case DIGRAPH: | |
313 | jj_consume_token(DIGRAPH); | |
314 | directed = true; | |
315 | break; | |
316 | default: | |
317 | jj_la1[3] = jj_gen; | |
318 | jj_consume_token(-1); | |
319 | throw new ParseException(); | |
320 | } | |
321 |
1
1. graph : negated conditional → NO_COVERAGE |
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { |
322 | case REAL: | |
323 | case STRING: | |
324 | case WORD: | |
325 | this.sourceId = id(); | |
326 | break; | |
327 | default: | |
328 | jj_la1[4] = jj_gen; | |
329 | ; | |
330 | } | |
331 | jj_consume_token(LBRACE); | |
332 | } | |
333 | ||
334 | final private void subgraph() throws ParseException { | |
335 | jj_consume_token(SUBGRAPH); | |
336 |
1
1. subgraph : negated conditional → NO_COVERAGE |
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { |
337 | case REAL: | |
338 | case STRING: | |
339 | case WORD: | |
340 | id(); | |
341 | break; | |
342 | default: | |
343 | jj_la1[5] = jj_gen; | |
344 | ; | |
345 | } | |
346 | jj_consume_token(LBRACE); | |
347 | label_2: while (true) { | |
348 |
1
1. subgraph : negated conditional → NO_COVERAGE |
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { |
349 | case GRAPH: | |
350 | case SUBGRAPH: | |
351 | case NODE: | |
352 | case EDGE: | |
353 | case REAL: | |
354 | case STRING: | |
355 | case WORD: | |
356 | ; | |
357 | break; | |
358 | default: | |
359 | jj_la1[6] = jj_gen; | |
360 | break label_2; | |
361 | } | |
362 |
1
1. subgraph : removed call to org/graphstream/stream/file/dot/DOTParser::statement → NO_COVERAGE |
statement(); |
363 | } | |
364 | jj_consume_token(RBRACE); | |
365 | } | |
366 | ||
367 | final private String id() throws ParseException { | |
368 | Token t; | |
369 | String id; | |
370 |
1
1. id : negated conditional → NO_COVERAGE |
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { |
371 | case STRING: | |
372 | t = jj_consume_token(STRING); | |
373 |
1
1. id : Replaced integer subtraction with addition → NO_COVERAGE |
id = t.image.substring(1, t.image.length() - 1); |
374 | break; | |
375 | case REAL: | |
376 | t = jj_consume_token(REAL); | |
377 | id = t.image; | |
378 | break; | |
379 | case WORD: | |
380 | t = jj_consume_token(WORD); | |
381 | id = t.image; | |
382 | break; | |
383 | default: | |
384 | jj_la1[7] = jj_gen; | |
385 | jj_consume_token(-1); | |
386 | throw new ParseException(); | |
387 | } | |
388 | ||
389 |
1
1. id : mutated return of Object value for org/graphstream/stream/file/dot/DOTParser::id to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return id; |
390 | } | |
391 | ||
392 | final private void statement() throws ParseException { | |
393 |
1
1. statement : negated conditional → NO_COVERAGE |
if (jj_2_1(3)) { |
394 |
1
1. statement : removed call to org/graphstream/stream/file/dot/DOTParser::edgeStatement → NO_COVERAGE |
edgeStatement(); |
395 | } else { | |
396 |
1
1. statement : negated conditional → NO_COVERAGE |
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { |
397 | case REAL: | |
398 | case STRING: | |
399 | case WORD: | |
400 |
1
1. statement : removed call to org/graphstream/stream/file/dot/DOTParser::nodeStatement → NO_COVERAGE |
nodeStatement(); |
401 | break; | |
402 | case GRAPH: | |
403 | case NODE: | |
404 | case EDGE: | |
405 |
1
1. statement : removed call to org/graphstream/stream/file/dot/DOTParser::attributeStatement → NO_COVERAGE |
attributeStatement(); |
406 | break; | |
407 | case SUBGRAPH: | |
408 |
1
1. statement : removed call to org/graphstream/stream/file/dot/DOTParser::subgraph → NO_COVERAGE |
subgraph(); |
409 | break; | |
410 | default: | |
411 | jj_la1[8] = jj_gen; | |
412 | jj_consume_token(-1); | |
413 | throw new ParseException(); | |
414 | } | |
415 | } | |
416 | jj_consume_token(27); | |
417 | } | |
418 | ||
419 | final private void nodeStatement() throws ParseException { | |
420 | String nodeId; | |
421 | String[] port; | |
422 | HashMap<String, Object> attr = null; | |
423 | ||
424 | port = null; | |
425 | nodeId = id(); | |
426 |
1
1. nodeStatement : negated conditional → NO_COVERAGE |
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { |
427 | case COLON: | |
428 | port = port(); | |
429 | break; | |
430 | default: | |
431 | jj_la1[9] = jj_gen; | |
432 | ; | |
433 | } | |
434 |
1
1. nodeStatement : negated conditional → NO_COVERAGE |
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { |
435 | case LSQBR: | |
436 | attr = attributesList(); | |
437 | break; | |
438 | default: | |
439 | jj_la1[10] = jj_gen; | |
440 | ; | |
441 | } | |
442 |
1
1. nodeStatement : removed call to org/graphstream/stream/file/dot/DOTParser::addNode → NO_COVERAGE |
addNode(nodeId, port, attr); |
443 | } | |
444 | ||
445 | final private String compassPoint() throws ParseException { | |
446 | Token pt = null; | |
447 |
1
1. compassPoint : negated conditional → NO_COVERAGE |
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { |
448 | case 28: | |
449 | pt = jj_consume_token(28); | |
450 | break; | |
451 | case 29: | |
452 | pt = jj_consume_token(29); | |
453 | break; | |
454 | case 30: | |
455 | pt = jj_consume_token(30); | |
456 | break; | |
457 | case 31: | |
458 | pt = jj_consume_token(31); | |
459 | break; | |
460 | case 32: | |
461 | pt = jj_consume_token(32); | |
462 | break; | |
463 | case 33: | |
464 | pt = jj_consume_token(33); | |
465 | break; | |
466 | case 34: | |
467 | pt = jj_consume_token(34); | |
468 | break; | |
469 | case 35: | |
470 | pt = jj_consume_token(35); | |
471 | break; | |
472 | case 36: | |
473 | pt = jj_consume_token(36); | |
474 | break; | |
475 | case 37: | |
476 | pt = jj_consume_token(37); | |
477 | break; | |
478 | default: | |
479 | jj_la1[11] = jj_gen; | |
480 | jj_consume_token(-1); | |
481 | throw new ParseException(); | |
482 | } | |
483 | ||
484 |
1
1. compassPoint : mutated return of Object value for org/graphstream/stream/file/dot/DOTParser::compassPoint to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return pt.image; |
485 | } | |
486 | ||
487 | final private String[] port() throws ParseException { | |
488 | String[] p = { null, null }; | |
489 | jj_consume_token(COLON); | |
490 |
1
1. port : negated conditional → NO_COVERAGE |
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { |
491 | case REAL: | |
492 | case STRING: | |
493 | case WORD: | |
494 | p[0] = id(); | |
495 |
1
1. port : negated conditional → NO_COVERAGE |
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { |
496 | case COLON: | |
497 | jj_consume_token(COLON); | |
498 | p[1] = compassPoint(); | |
499 | break; | |
500 | default: | |
501 | jj_la1[12] = jj_gen; | |
502 | ; | |
503 | } | |
504 | break; | |
505 | case 28: | |
506 | case 29: | |
507 | case 30: | |
508 | case 31: | |
509 | case 32: | |
510 | case 33: | |
511 | case 34: | |
512 | case 35: | |
513 | case 36: | |
514 | case 37: | |
515 | p[1] = compassPoint(); | |
516 | break; | |
517 | default: | |
518 | jj_la1[13] = jj_gen; | |
519 | jj_consume_token(-1); | |
520 | throw new ParseException(); | |
521 | } | |
522 | ||
523 |
1
1. port : mutated return of Object value for org/graphstream/stream/file/dot/DOTParser::port to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return p; |
524 | } | |
525 | ||
526 | final private void edgeStatement() throws ParseException { | |
527 | String id; | |
528 | LinkedList<String> edges = new LinkedList<String>(); | |
529 | HashMap<String, Object> attr = null; | |
530 | id = id(); | |
531 | edges.add(id); | |
532 |
1
1. edgeStatement : removed call to org/graphstream/stream/file/dot/DOTParser::edgeRHS → NO_COVERAGE |
edgeRHS(edges); |
533 |
1
1. edgeStatement : negated conditional → NO_COVERAGE |
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { |
534 | case LSQBR: | |
535 | attr = attributesList(); | |
536 | break; | |
537 | default: | |
538 | jj_la1[14] = jj_gen; | |
539 | ; | |
540 | } | |
541 |
1
1. edgeStatement : removed call to org/graphstream/stream/file/dot/DOTParser::addEdges → NO_COVERAGE |
addEdges(edges, attr); |
542 | } | |
543 | ||
544 | final private void edgeRHS(LinkedList<String> edges) throws ParseException { | |
545 | Token t; | |
546 | String i; | |
547 | t = jj_consume_token(EDGE_OP); | |
548 | edges.add(t.image); | |
549 | i = id(); | |
550 | edges.add(i); | |
551 |
1
1. edgeRHS : negated conditional → NO_COVERAGE |
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { |
552 | case EDGE_OP: | |
553 |
1
1. edgeRHS : removed call to org/graphstream/stream/file/dot/DOTParser::edgeRHS → NO_COVERAGE |
edgeRHS(edges); |
554 | break; | |
555 | default: | |
556 | jj_la1[15] = jj_gen; | |
557 | ; | |
558 | } | |
559 | } | |
560 | ||
561 | final private void attributeStatement() throws ParseException { | |
562 | Token t; | |
563 | HashMap<String, Object> attr; | |
564 |
1
1. attributeStatement : negated conditional → NO_COVERAGE |
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { |
565 | case GRAPH: | |
566 | t = jj_consume_token(GRAPH); | |
567 | break; | |
568 | case NODE: | |
569 | t = jj_consume_token(NODE); | |
570 | break; | |
571 | case EDGE: | |
572 | t = jj_consume_token(EDGE); | |
573 | break; | |
574 | default: | |
575 | jj_la1[16] = jj_gen; | |
576 | jj_consume_token(-1); | |
577 | throw new ParseException(); | |
578 | } | |
579 | attr = attributesList(); | |
580 |
1
1. attributeStatement : removed call to org/graphstream/stream/file/dot/DOTParser::setGlobalAttributes → NO_COVERAGE |
setGlobalAttributes(t.image, attr); |
581 | } | |
582 | ||
583 | final private HashMap<String, Object> attributesList() | |
584 | throws ParseException { | |
585 | HashMap<String, Object> attributes = new HashMap<String, Object>(); | |
586 | label_3: while (true) { | |
587 | jj_consume_token(LSQBR); | |
588 |
1
1. attributesList : negated conditional → NO_COVERAGE |
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { |
589 | case REAL: | |
590 | case STRING: | |
591 | case WORD: | |
592 |
1
1. attributesList : removed call to org/graphstream/stream/file/dot/DOTParser::attributeList → NO_COVERAGE |
attributeList(attributes); |
593 | label_4: while (true) { | |
594 |
1
1. attributesList : negated conditional → NO_COVERAGE |
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { |
595 | case COMMA: | |
596 | ; | |
597 | break; | |
598 | default: | |
599 | jj_la1[17] = jj_gen; | |
600 | break label_4; | |
601 | } | |
602 | jj_consume_token(COMMA); | |
603 |
1
1. attributesList : removed call to org/graphstream/stream/file/dot/DOTParser::attributeList → NO_COVERAGE |
attributeList(attributes); |
604 | } | |
605 | break; | |
606 | default: | |
607 | jj_la1[18] = jj_gen; | |
608 | ; | |
609 | } | |
610 | jj_consume_token(RSQBR); | |
611 |
1
1. attributesList : negated conditional → NO_COVERAGE |
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { |
612 | case LSQBR: | |
613 | ; | |
614 | break; | |
615 | default: | |
616 | jj_la1[19] = jj_gen; | |
617 | break label_3; | |
618 | } | |
619 | } | |
620 | ||
621 |
1
1. attributesList : mutated return of Object value for org/graphstream/stream/file/dot/DOTParser::attributesList to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return attributes; |
622 | } | |
623 | ||
624 | final private void attributeList(HashMap<String, Object> attributes) | |
625 | throws ParseException { | |
626 | String key; | |
627 | Object val; | |
628 | ||
629 | Token t; | |
630 | key = id(); | |
631 | val = Boolean.TRUE; | |
632 |
1
1. attributeList : negated conditional → NO_COVERAGE |
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { |
633 | case EQUALS: | |
634 | jj_consume_token(EQUALS); | |
635 |
1
1. attributeList : negated conditional → NO_COVERAGE |
if (jj_2_2(2)) { |
636 | t = jj_consume_token(REAL); | |
637 | val = Double.parseDouble(t.image); | |
638 | } else { | |
639 |
1
1. attributeList : negated conditional → NO_COVERAGE |
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { |
640 | case REAL: | |
641 | case STRING: | |
642 | case WORD: | |
643 | val = id(); | |
644 | break; | |
645 | default: | |
646 | jj_la1[20] = jj_gen; | |
647 | jj_consume_token(-1); | |
648 | throw new ParseException(); | |
649 | } | |
650 | } | |
651 | break; | |
652 | default: | |
653 | jj_la1[21] = jj_gen; | |
654 | ; | |
655 | } | |
656 | attributes.put(key, val); | |
657 | } | |
658 | ||
659 | private boolean jj_2_1(int xla) { | |
660 | jj_la = xla; | |
661 | jj_lastpos = jj_scanpos = token; | |
662 | try { | |
663 |
2
1. jj_2_1 : negated conditional → NO_COVERAGE 2. jj_2_1 : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return !jj_3_1(); |
664 | } catch (LookaheadSuccess ls) { | |
665 |
1
1. jj_2_1 : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return true; |
666 | } finally { | |
667 |
3
1. jj_2_1 : removed call to org/graphstream/stream/file/dot/DOTParser::jj_save → NO_COVERAGE 2. jj_2_1 : removed call to org/graphstream/stream/file/dot/DOTParser::jj_save → NO_COVERAGE 3. jj_2_1 : removed call to org/graphstream/stream/file/dot/DOTParser::jj_save → NO_COVERAGE |
jj_save(0, xla); |
668 | } | |
669 | } | |
670 | ||
671 | private boolean jj_2_2(int xla) { | |
672 | jj_la = xla; | |
673 | jj_lastpos = jj_scanpos = token; | |
674 | try { | |
675 |
2
1. jj_2_2 : negated conditional → NO_COVERAGE 2. jj_2_2 : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return !jj_3_2(); |
676 | } catch (LookaheadSuccess ls) { | |
677 |
1
1. jj_2_2 : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return true; |
678 | } finally { | |
679 |
3
1. jj_2_2 : removed call to org/graphstream/stream/file/dot/DOTParser::jj_save → NO_COVERAGE 2. jj_2_2 : removed call to org/graphstream/stream/file/dot/DOTParser::jj_save → NO_COVERAGE 3. jj_2_2 : removed call to org/graphstream/stream/file/dot/DOTParser::jj_save → NO_COVERAGE |
jj_save(1, xla); |
680 | } | |
681 | } | |
682 | ||
683 | private boolean jj_3R_6() { | |
684 | Token xsp; | |
685 | xsp = jj_scanpos; | |
686 |
1
1. jj_3R_6 : negated conditional → NO_COVERAGE |
if (jj_3R_8()) { |
687 | jj_scanpos = xsp; | |
688 |
1
1. jj_3R_6 : negated conditional → NO_COVERAGE |
if (jj_3R_9()) { |
689 | jj_scanpos = xsp; | |
690 |
1
1. jj_3R_6 : negated conditional → NO_COVERAGE |
if (jj_3R_10()) |
691 |
1
1. jj_3R_6 : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return true; |
692 | } | |
693 | } | |
694 |
1
1. jj_3R_6 : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return false; |
695 | } | |
696 | ||
697 | private boolean jj_3_2() { | |
698 |
1
1. jj_3_2 : negated conditional → NO_COVERAGE |
if (jj_scan_token(REAL)) |
699 |
1
1. jj_3_2 : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return true; |
700 |
1
1. jj_3_2 : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return false; |
701 | } | |
702 | ||
703 | private boolean jj_3R_8() { | |
704 |
1
1. jj_3R_8 : negated conditional → NO_COVERAGE |
if (jj_scan_token(STRING)) |
705 |
1
1. jj_3R_8 : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return true; |
706 |
1
1. jj_3R_8 : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return false; |
707 | } | |
708 | ||
709 | private boolean jj_3R_10() { | |
710 |
1
1. jj_3R_10 : negated conditional → NO_COVERAGE |
if (jj_scan_token(WORD)) |
711 |
1
1. jj_3R_10 : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return true; |
712 |
1
1. jj_3R_10 : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return false; |
713 | } | |
714 | ||
715 | private boolean jj_3R_7() { | |
716 |
1
1. jj_3R_7 : negated conditional → NO_COVERAGE |
if (jj_scan_token(EDGE_OP)) |
717 |
1
1. jj_3R_7 : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return true; |
718 |
1
1. jj_3R_7 : negated conditional → NO_COVERAGE |
if (jj_3R_6()) |
719 |
1
1. jj_3R_7 : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return true; |
720 |
1
1. jj_3R_7 : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return false; |
721 | } | |
722 | ||
723 | private boolean jj_3R_9() { | |
724 |
1
1. jj_3R_9 : negated conditional → NO_COVERAGE |
if (jj_scan_token(REAL)) |
725 |
1
1. jj_3R_9 : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return true; |
726 |
1
1. jj_3R_9 : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return false; |
727 | } | |
728 | ||
729 | private boolean jj_3R_5() { | |
730 |
1
1. jj_3R_5 : negated conditional → NO_COVERAGE |
if (jj_3R_6()) |
731 |
1
1. jj_3R_5 : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return true; |
732 |
1
1. jj_3R_5 : negated conditional → NO_COVERAGE |
if (jj_3R_7()) |
733 |
1
1. jj_3R_5 : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return true; |
734 |
1
1. jj_3R_5 : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return false; |
735 | } | |
736 | ||
737 | private boolean jj_3_1() { | |
738 |
1
1. jj_3_1 : negated conditional → NO_COVERAGE |
if (jj_3R_5()) |
739 |
1
1. jj_3_1 : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return true; |
740 |
1
1. jj_3_1 : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return false; |
741 | } | |
742 | ||
743 | /** Generated Token Manager. */ | |
744 | public DOTParserTokenManager token_source; | |
745 | SimpleCharStream jj_input_stream; | |
746 | /** Current token. */ | |
747 | public Token token; | |
748 | /** Next token. */ | |
749 | public Token jj_nt; | |
750 | private int jj_ntk; | |
751 | private Token jj_scanpos, jj_lastpos; | |
752 | private int jj_la; | |
753 | private int jj_gen; | |
754 | final private int[] jj_la1 = new int[22]; | |
755 | static private int[] jj_la1_0; | |
756 | static private int[] jj_la1_1; | |
757 | static { | |
758 | jj_la1_init_0(); | |
759 | jj_la1_init_1(); | |
760 | } | |
761 | ||
762 | private static void jj_la1_init_0() { | |
763 | jj_la1_0 = new int[] { 0x73a0000, 0x73a2001, 0x400000, 0x60000, | |
764 | 0x7000000, 0x7000000, 0x73a0000, 0x7000000, 0x73a0000, 0x4000, | |
765 | 0x400, 0xf0000000, 0x4000, 0xf7000000, 0x400, 0x800000, | |
766 | 0x320000, 0x8000, 0x7000000, 0x400, 0x7000000, 0x10000, }; | |
767 | } | |
768 | ||
769 | private static void jj_la1_init_1() { | |
770 | jj_la1_1 = new int[] { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, | |
771 | 0x0, 0x0, 0x3f, 0x0, 0x3f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, | |
772 | 0x0, }; | |
773 | } | |
774 | ||
775 | final private JJCalls[] jj_2_rtns = new JJCalls[2]; | |
776 | private boolean jj_rescan = false; | |
777 | private int jj_gc = 0; | |
778 | ||
779 | /** Constructor with InputStream. */ | |
780 | public DOTParser(java.io.InputStream stream) { | |
781 | this(stream, null); | |
782 | } | |
783 | ||
784 | /** Constructor with InputStream and supplied encoding */ | |
785 | public DOTParser(java.io.InputStream stream, String encoding) { | |
786 | try { | |
787 | jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); | |
788 | } catch (java.io.UnsupportedEncodingException e) { | |
789 | throw new RuntimeException(e); | |
790 | } | |
791 | token_source = new DOTParserTokenManager(jj_input_stream); | |
792 | token = new Token(); | |
793 | jj_ntk = -1; | |
794 | jj_gen = 0; | |
795 |
3
1. 2. 3. |
for (int i = 0; i < 22; i++) |
796 | jj_la1[i] = -1; | |
797 |
3
1. 2. 3. |
for (int i = 0; i < jj_2_rtns.length; i++) |
798 | jj_2_rtns[i] = new JJCalls(); | |
799 | } | |
800 | ||
801 | /** Reinitialise. */ | |
802 | public void ReInit(java.io.InputStream stream) { | |
803 |
1
1. ReInit : removed call to org/graphstream/stream/file/dot/DOTParser::ReInit → NO_COVERAGE |
ReInit(stream, null); |
804 | } | |
805 | ||
806 | /** Reinitialise. */ | |
807 | public void ReInit(java.io.InputStream stream, String encoding) { | |
808 | try { | |
809 |
1
1. ReInit : removed call to org/graphstream/util/parser/SimpleCharStream::ReInit → NO_COVERAGE |
jj_input_stream.ReInit(stream, encoding, 1, 1); |
810 | } catch (java.io.UnsupportedEncodingException e) { | |
811 | throw new RuntimeException(e); | |
812 | } | |
813 |
1
1. ReInit : removed call to org/graphstream/stream/file/dot/DOTParserTokenManager::ReInit → NO_COVERAGE |
token_source.ReInit(jj_input_stream); |
814 | token = new Token(); | |
815 | jj_ntk = -1; | |
816 | jj_gen = 0; | |
817 |
3
1. ReInit : changed conditional boundary → NO_COVERAGE 2. ReInit : Changed increment from 1 to -1 → NO_COVERAGE 3. ReInit : negated conditional → NO_COVERAGE |
for (int i = 0; i < 22; i++) |
818 | jj_la1[i] = -1; | |
819 |
3
1. ReInit : changed conditional boundary → NO_COVERAGE 2. ReInit : Changed increment from 1 to -1 → NO_COVERAGE 3. ReInit : negated conditional → NO_COVERAGE |
for (int i = 0; i < jj_2_rtns.length; i++) |
820 | jj_2_rtns[i] = new JJCalls(); | |
821 | } | |
822 | ||
823 | /** Constructor. */ | |
824 | public DOTParser(java.io.Reader stream) { | |
825 | jj_input_stream = new SimpleCharStream(stream, 1, 1); | |
826 | token_source = new DOTParserTokenManager(jj_input_stream); | |
827 | token = new Token(); | |
828 | jj_ntk = -1; | |
829 | jj_gen = 0; | |
830 |
3
1. 2. 3. |
for (int i = 0; i < 22; i++) |
831 | jj_la1[i] = -1; | |
832 |
3
1. 2. 3. |
for (int i = 0; i < jj_2_rtns.length; i++) |
833 | jj_2_rtns[i] = new JJCalls(); | |
834 | } | |
835 | ||
836 | /** Reinitialise. */ | |
837 | public void ReInit(java.io.Reader stream) { | |
838 |
1
1. ReInit : removed call to org/graphstream/util/parser/SimpleCharStream::ReInit → NO_COVERAGE |
jj_input_stream.ReInit(stream, 1, 1); |
839 |
1
1. ReInit : removed call to org/graphstream/stream/file/dot/DOTParserTokenManager::ReInit → NO_COVERAGE |
token_source.ReInit(jj_input_stream); |
840 | token = new Token(); | |
841 | jj_ntk = -1; | |
842 | jj_gen = 0; | |
843 |
3
1. ReInit : changed conditional boundary → NO_COVERAGE 2. ReInit : Changed increment from 1 to -1 → NO_COVERAGE 3. ReInit : negated conditional → NO_COVERAGE |
for (int i = 0; i < 22; i++) |
844 | jj_la1[i] = -1; | |
845 |
3
1. ReInit : changed conditional boundary → NO_COVERAGE 2. ReInit : Changed increment from 1 to -1 → NO_COVERAGE 3. ReInit : negated conditional → NO_COVERAGE |
for (int i = 0; i < jj_2_rtns.length; i++) |
846 | jj_2_rtns[i] = new JJCalls(); | |
847 | } | |
848 | ||
849 | /** Constructor with generated Token Manager. */ | |
850 | public DOTParser(DOTParserTokenManager tm) { | |
851 | token_source = tm; | |
852 | token = new Token(); | |
853 | jj_ntk = -1; | |
854 | jj_gen = 0; | |
855 |
3
1. 2. 3. |
for (int i = 0; i < 22; i++) |
856 | jj_la1[i] = -1; | |
857 |
3
1. 2. 3. |
for (int i = 0; i < jj_2_rtns.length; i++) |
858 | jj_2_rtns[i] = new JJCalls(); | |
859 | } | |
860 | ||
861 | /** Reinitialise. */ | |
862 | public void ReInit(DOTParserTokenManager tm) { | |
863 | token_source = tm; | |
864 | token = new Token(); | |
865 | jj_ntk = -1; | |
866 | jj_gen = 0; | |
867 |
3
1. ReInit : changed conditional boundary → NO_COVERAGE 2. ReInit : Changed increment from 1 to -1 → NO_COVERAGE 3. ReInit : negated conditional → NO_COVERAGE |
for (int i = 0; i < 22; i++) |
868 | jj_la1[i] = -1; | |
869 |
3
1. ReInit : changed conditional boundary → NO_COVERAGE 2. ReInit : Changed increment from 1 to -1 → NO_COVERAGE 3. ReInit : negated conditional → NO_COVERAGE |
for (int i = 0; i < jj_2_rtns.length; i++) |
870 | jj_2_rtns[i] = new JJCalls(); | |
871 | } | |
872 | ||
873 | private Token jj_consume_token(int kind) throws ParseException { | |
874 | Token oldToken; | |
875 |
1
1. jj_consume_token : negated conditional → NO_COVERAGE |
if ((oldToken = token).next != null) |
876 | token = token.next; | |
877 | else | |
878 | token = token.next = token_source.getNextToken(); | |
879 | jj_ntk = -1; | |
880 |
1
1. jj_consume_token : negated conditional → NO_COVERAGE |
if (token.kind == kind) { |
881 |
1
1. jj_consume_token : Replaced integer addition with subtraction → NO_COVERAGE |
jj_gen++; |
882 |
3
1. jj_consume_token : changed conditional boundary → NO_COVERAGE 2. jj_consume_token : Replaced integer addition with subtraction → NO_COVERAGE 3. jj_consume_token : negated conditional → NO_COVERAGE |
if (++jj_gc > 100) { |
883 | jj_gc = 0; | |
884 |
3
1. jj_consume_token : changed conditional boundary → NO_COVERAGE 2. jj_consume_token : Changed increment from 1 to -1 → NO_COVERAGE 3. jj_consume_token : negated conditional → NO_COVERAGE |
for (int i = 0; i < jj_2_rtns.length; i++) { |
885 | JJCalls c = jj_2_rtns[i]; | |
886 |
1
1. jj_consume_token : negated conditional → NO_COVERAGE |
while (c != null) { |
887 |
2
1. jj_consume_token : changed conditional boundary → NO_COVERAGE 2. jj_consume_token : negated conditional → NO_COVERAGE |
if (c.gen < jj_gen) |
888 | c.first = null; | |
889 | c = c.next; | |
890 | } | |
891 | } | |
892 | } | |
893 |
1
1. jj_consume_token : mutated return of Object value for org/graphstream/stream/file/dot/DOTParser::jj_consume_token to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return token; |
894 | } | |
895 | token = oldToken; | |
896 | jj_kind = kind; | |
897 | throw generateParseException(); | |
898 | } | |
899 | ||
900 | @SuppressWarnings("serial") | |
901 | static private final class LookaheadSuccess extends java.lang.Error { | |
902 | } | |
903 | ||
904 | final private LookaheadSuccess jj_ls = new LookaheadSuccess(); | |
905 | ||
906 | private boolean jj_scan_token(int kind) { | |
907 |
1
1. jj_scan_token : negated conditional → NO_COVERAGE |
if (jj_scanpos == jj_lastpos) { |
908 |
1
1. jj_scan_token : Replaced integer subtraction with addition → NO_COVERAGE |
jj_la--; |
909 |
1
1. jj_scan_token : negated conditional → NO_COVERAGE |
if (jj_scanpos.next == null) { |
910 | jj_lastpos = jj_scanpos = jj_scanpos.next = token_source | |
911 | .getNextToken(); | |
912 | } else { | |
913 | jj_lastpos = jj_scanpos = jj_scanpos.next; | |
914 | } | |
915 | } else { | |
916 | jj_scanpos = jj_scanpos.next; | |
917 | } | |
918 |
1
1. jj_scan_token : negated conditional → NO_COVERAGE |
if (jj_rescan) { |
919 | int i = 0; | |
920 | Token tok = token; | |
921 |
2
1. jj_scan_token : negated conditional → NO_COVERAGE 2. jj_scan_token : negated conditional → NO_COVERAGE |
while (tok != null && tok != jj_scanpos) { |
922 |
1
1. jj_scan_token : Changed increment from 1 to -1 → NO_COVERAGE |
i++; |
923 | tok = tok.next; | |
924 | } | |
925 |
1
1. jj_scan_token : negated conditional → NO_COVERAGE |
if (tok != null) |
926 |
1
1. jj_scan_token : removed call to org/graphstream/stream/file/dot/DOTParser::jj_add_error_token → NO_COVERAGE |
jj_add_error_token(kind, i); |
927 | } | |
928 |
1
1. jj_scan_token : negated conditional → NO_COVERAGE |
if (jj_scanpos.kind != kind) |
929 |
1
1. jj_scan_token : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return true; |
930 |
2
1. jj_scan_token : negated conditional → NO_COVERAGE 2. jj_scan_token : negated conditional → NO_COVERAGE |
if (jj_la == 0 && jj_scanpos == jj_lastpos) |
931 | throw jj_ls; | |
932 |
1
1. jj_scan_token : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return false; |
933 | } | |
934 | ||
935 | /** Get the next Token. */ | |
936 | final public Token getNextToken() { | |
937 |
1
1. getNextToken : negated conditional → NO_COVERAGE |
if (token.next != null) |
938 | token = token.next; | |
939 | else | |
940 | token = token.next = token_source.getNextToken(); | |
941 | jj_ntk = -1; | |
942 |
1
1. getNextToken : Replaced integer addition with subtraction → NO_COVERAGE |
jj_gen++; |
943 |
1
1. getNextToken : mutated return of Object value for org/graphstream/stream/file/dot/DOTParser::getNextToken to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return token; |
944 | } | |
945 | ||
946 | /** Get the specific Token. */ | |
947 | final public Token getToken(int index) { | |
948 | Token t = token; | |
949 |
3
1. getToken : changed conditional boundary → NO_COVERAGE 2. getToken : Changed increment from 1 to -1 → NO_COVERAGE 3. getToken : negated conditional → NO_COVERAGE |
for (int i = 0; i < index; i++) { |
950 |
1
1. getToken : negated conditional → NO_COVERAGE |
if (t.next != null) |
951 | t = t.next; | |
952 | else | |
953 | t = t.next = token_source.getNextToken(); | |
954 | } | |
955 |
1
1. getToken : mutated return of Object value for org/graphstream/stream/file/dot/DOTParser::getToken to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return t; |
956 | } | |
957 | ||
958 | private int jj_ntk() { | |
959 |
1
1. jj_ntk : negated conditional → NO_COVERAGE |
if ((jj_nt = token.next) == null) |
960 |
1
1. jj_ntk : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return (jj_ntk = (token.next = token_source.getNextToken()).kind); |
961 | else | |
962 |
1
1. jj_ntk : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return (jj_ntk = jj_nt.kind); |
963 | } | |
964 | ||
965 | private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>(); | |
966 | private int[] jj_expentry; | |
967 | private int jj_kind = -1; | |
968 | private int[] jj_lasttokens = new int[100]; | |
969 | private int jj_endpos; | |
970 | ||
971 | private void jj_add_error_token(int kind, int pos) { | |
972 |
2
1. jj_add_error_token : changed conditional boundary → NO_COVERAGE 2. jj_add_error_token : negated conditional → NO_COVERAGE |
if (pos >= 100) |
973 | return; | |
974 |
2
1. jj_add_error_token : Replaced integer addition with subtraction → NO_COVERAGE 2. jj_add_error_token : negated conditional → NO_COVERAGE |
if (pos == jj_endpos + 1) { |
975 |
1
1. jj_add_error_token : Replaced integer addition with subtraction → NO_COVERAGE |
jj_lasttokens[jj_endpos++] = kind; |
976 |
1
1. jj_add_error_token : negated conditional → NO_COVERAGE |
} else if (jj_endpos != 0) { |
977 | jj_expentry = new int[jj_endpos]; | |
978 |
3
1. jj_add_error_token : changed conditional boundary → NO_COVERAGE 2. jj_add_error_token : Changed increment from 1 to -1 → NO_COVERAGE 3. jj_add_error_token : negated conditional → NO_COVERAGE |
for (int i = 0; i < jj_endpos; i++) { |
979 | jj_expentry[i] = jj_lasttokens[i]; | |
980 | } | |
981 | jj_entries_loop: for (java.util.Iterator<?> it = jj_expentries | |
982 |
1
1. jj_add_error_token : negated conditional → NO_COVERAGE |
.iterator(); it.hasNext();) { |
983 | int[] oldentry = (int[]) (it.next()); | |
984 |
1
1. jj_add_error_token : negated conditional → NO_COVERAGE |
if (oldentry.length == jj_expentry.length) { |
985 |
3
1. jj_add_error_token : changed conditional boundary → NO_COVERAGE 2. jj_add_error_token : Changed increment from 1 to -1 → NO_COVERAGE 3. jj_add_error_token : negated conditional → NO_COVERAGE |
for (int i = 0; i < jj_expentry.length; i++) { |
986 |
1
1. jj_add_error_token : negated conditional → NO_COVERAGE |
if (oldentry[i] != jj_expentry[i]) { |
987 | continue jj_entries_loop; | |
988 | } | |
989 | } | |
990 | jj_expentries.add(jj_expentry); | |
991 | break jj_entries_loop; | |
992 | } | |
993 | } | |
994 |
1
1. jj_add_error_token : negated conditional → NO_COVERAGE |
if (pos != 0) |
995 |
1
1. jj_add_error_token : Replaced integer subtraction with addition → NO_COVERAGE |
jj_lasttokens[(jj_endpos = pos) - 1] = kind; |
996 | } | |
997 | } | |
998 | ||
999 | /** Generate ParseException. */ | |
1000 | public ParseException generateParseException() { | |
1001 |
1
1. generateParseException : removed call to java/util/List::clear → NO_COVERAGE |
jj_expentries.clear(); |
1002 | boolean[] la1tokens = new boolean[38]; | |
1003 |
2
1. generateParseException : changed conditional boundary → NO_COVERAGE 2. generateParseException : negated conditional → NO_COVERAGE |
if (jj_kind >= 0) { |
1004 | la1tokens[jj_kind] = true; | |
1005 | jj_kind = -1; | |
1006 | } | |
1007 |
3
1. generateParseException : changed conditional boundary → NO_COVERAGE 2. generateParseException : Changed increment from 1 to -1 → NO_COVERAGE 3. generateParseException : negated conditional → NO_COVERAGE |
for (int i = 0; i < 22; i++) { |
1008 |
1
1. generateParseException : negated conditional → NO_COVERAGE |
if (jj_la1[i] == jj_gen) { |
1009 |
3
1. generateParseException : changed conditional boundary → NO_COVERAGE 2. generateParseException : Changed increment from 1 to -1 → NO_COVERAGE 3. generateParseException : negated conditional → NO_COVERAGE |
for (int j = 0; j < 32; j++) { |
1010 |
3
1. generateParseException : Replaced Shift Left with Shift Right → NO_COVERAGE 2. generateParseException : Replaced bitwise AND with OR → NO_COVERAGE 3. generateParseException : negated conditional → NO_COVERAGE |
if ((jj_la1_0[i] & (1 << j)) != 0) { |
1011 | la1tokens[j] = true; | |
1012 | } | |
1013 |
3
1. generateParseException : Replaced Shift Left with Shift Right → NO_COVERAGE 2. generateParseException : Replaced bitwise AND with OR → NO_COVERAGE 3. generateParseException : negated conditional → NO_COVERAGE |
if ((jj_la1_1[i] & (1 << j)) != 0) { |
1014 |
1
1. generateParseException : Replaced integer addition with subtraction → NO_COVERAGE |
la1tokens[32 + j] = true; |
1015 | } | |
1016 | } | |
1017 | } | |
1018 | } | |
1019 |
3
1. generateParseException : changed conditional boundary → NO_COVERAGE 2. generateParseException : Changed increment from 1 to -1 → NO_COVERAGE 3. generateParseException : negated conditional → NO_COVERAGE |
for (int i = 0; i < 38; i++) { |
1020 |
1
1. generateParseException : negated conditional → NO_COVERAGE |
if (la1tokens[i]) { |
1021 | jj_expentry = new int[1]; | |
1022 | jj_expentry[0] = i; | |
1023 | jj_expentries.add(jj_expentry); | |
1024 | } | |
1025 | } | |
1026 | jj_endpos = 0; | |
1027 |
1
1. generateParseException : removed call to org/graphstream/stream/file/dot/DOTParser::jj_rescan_token → NO_COVERAGE |
jj_rescan_token(); |
1028 |
1
1. generateParseException : removed call to org/graphstream/stream/file/dot/DOTParser::jj_add_error_token → NO_COVERAGE |
jj_add_error_token(0, 0); |
1029 | int[][] exptokseq = new int[jj_expentries.size()][]; | |
1030 |
3
1. generateParseException : changed conditional boundary → NO_COVERAGE 2. generateParseException : Changed increment from 1 to -1 → NO_COVERAGE 3. generateParseException : negated conditional → NO_COVERAGE |
for (int i = 0; i < jj_expentries.size(); i++) { |
1031 | exptokseq[i] = jj_expentries.get(i); | |
1032 | } | |
1033 |
1
1. generateParseException : mutated return of Object value for org/graphstream/stream/file/dot/DOTParser::generateParseException to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return new ParseException(token, exptokseq, tokenImage); |
1034 | } | |
1035 | ||
1036 | /** Enable tracing. */ | |
1037 | final public void enable_tracing() { | |
1038 | } | |
1039 | ||
1040 | /** Disable tracing. */ | |
1041 | final public void disable_tracing() { | |
1042 | } | |
1043 | ||
1044 | private void jj_rescan_token() { | |
1045 | jj_rescan = true; | |
1046 |
3
1. jj_rescan_token : changed conditional boundary → NO_COVERAGE 2. jj_rescan_token : Changed increment from 1 to -1 → NO_COVERAGE 3. jj_rescan_token : negated conditional → NO_COVERAGE |
for (int i = 0; i < 2; i++) { |
1047 | try { | |
1048 | JJCalls p = jj_2_rtns[i]; | |
1049 | do { | |
1050 |
2
1. jj_rescan_token : changed conditional boundary → NO_COVERAGE 2. jj_rescan_token : negated conditional → NO_COVERAGE |
if (p.gen > jj_gen) { |
1051 | jj_la = p.arg; | |
1052 | jj_lastpos = jj_scanpos = p.first; | |
1053 | switch (i) { | |
1054 | case 0: | |
1055 | jj_3_1(); | |
1056 | break; | |
1057 | case 1: | |
1058 | jj_3_2(); | |
1059 | break; | |
1060 | } | |
1061 | } | |
1062 | p = p.next; | |
1063 |
1
1. jj_rescan_token : negated conditional → NO_COVERAGE |
} while (p != null); |
1064 | } catch (LookaheadSuccess ls) { | |
1065 | } | |
1066 | } | |
1067 | jj_rescan = false; | |
1068 | } | |
1069 | ||
1070 | private void jj_save(int index, int xla) { | |
1071 | JJCalls p = jj_2_rtns[index]; | |
1072 |
2
1. jj_save : changed conditional boundary → NO_COVERAGE 2. jj_save : negated conditional → NO_COVERAGE |
while (p.gen > jj_gen) { |
1073 |
1
1. jj_save : negated conditional → NO_COVERAGE |
if (p.next == null) { |
1074 | p = p.next = new JJCalls(); | |
1075 | break; | |
1076 | } | |
1077 | p = p.next; | |
1078 | } | |
1079 |
2
1. jj_save : Replaced integer addition with subtraction → NO_COVERAGE 2. jj_save : Replaced integer subtraction with addition → NO_COVERAGE |
p.gen = jj_gen + xla - jj_la; |
1080 | p.first = token; | |
1081 | p.arg = xla; | |
1082 | } | |
1083 | ||
1084 | static final class JJCalls { | |
1085 | int gen; | |
1086 | Token first; | |
1087 | int arg; | |
1088 | JJCalls next; | |
1089 | } | |
1090 | ||
1091 | } | |
Mutations | ||
102 |
1.1 |
|
110 |
1.1 |
|
117 |
1.1 |
|
132 |
1.1 |
|
133 |
1.1 |
|
134 |
1.1 |
|
135 |
1.1 |
|
140 |
1.1 |
|
143 |
1.1 |
|
144 |
1.1 |
|
145 |
1.1 |
|
149 |
1.1 |
|
150 |
1.1 |
|
151 |
1.1 |
|
157 |
1.1 |
|
158 |
1.1 |
|
167 |
1.1 2.2 |
|
168 |
1.1 2.2 |
|
171 |
1.1 2.2 3.3 4.4 |
|
173 |
1.1 |
|
175 |
1.1 |
|
176 |
1.1 |
|
177 |
1.1 |
|
178 |
1.1 |
|
183 |
1.1 |
|
188 |
1.1 |
|
190 |
1.1 |
|
194 |
1.1 |
|
196 |
1.1 2.2 3.3 |
|
201 |
1.1 2.2 3.3 |
|
202 |
1.1 2.2 |
|
203 |
1.1 2.2 |
|
205 |
1.1 |
|
206 |
1.1 |
|
207 |
1.1 |
|
211 |
1.1 |
|
212 |
1.1 |
|
213 |
1.1 |
|
219 |
1.1 |
|
220 |
1.1 |
|
228 |
1.1 |
|
229 |
1.1 |
|
230 |
1.1 |
|
233 |
1.1 |
|
234 |
1.1 |
|
235 |
1.1 |
|
236 |
1.1 |
|
240 |
1.1 |
|
242 |
1.1 |
|
256 |
1.1 |
|
263 |
1.1 |
|
271 |
1.1 |
|
286 |
1.1 |
|
290 |
1.1 |
|
297 |
1.1 |
|
298 |
1.1 |
|
299 |
1.1 |
|
308 |
1.1 |
|
321 |
1.1 |
|
336 |
1.1 |
|
348 |
1.1 |
|
362 |
1.1 |
|
370 |
1.1 |
|
373 |
1.1 |
|
389 |
1.1 |
|
393 |
1.1 |
|
394 |
1.1 |
|
396 |
1.1 |
|
400 |
1.1 |
|
405 |
1.1 |
|
408 |
1.1 |
|
426 |
1.1 |
|
434 |
1.1 |
|
442 |
1.1 |
|
447 |
1.1 |
|
484 |
1.1 |
|
490 |
1.1 |
|
495 |
1.1 |
|
523 |
1.1 |
|
532 |
1.1 |
|
533 |
1.1 |
|
541 |
1.1 |
|
551 |
1.1 |
|
553 |
1.1 |
|
564 |
1.1 |
|
580 |
1.1 |
|
588 |
1.1 |
|
592 |
1.1 |
|
594 |
1.1 |
|
603 |
1.1 |
|
611 |
1.1 |
|
621 |
1.1 |
|
632 |
1.1 |
|
635 |
1.1 |
|
639 |
1.1 |
|
663 |
1.1 2.2 |
|
665 |
1.1 |
|
667 |
1.1 2.2 3.3 |
|
675 |
1.1 2.2 |
|
677 |
1.1 |
|
679 |
1.1 2.2 3.3 |
|
686 |
1.1 |
|
688 |
1.1 |
|
690 |
1.1 |
|
691 |
1.1 |
|
694 |
1.1 |
|
698 |
1.1 |
|
699 |
1.1 |
|
700 |
1.1 |
|
704 |
1.1 |
|
705 |
1.1 |
|
706 |
1.1 |
|
710 |
1.1 |
|
711 |
1.1 |
|
712 |
1.1 |
|
716 |
1.1 |
|
717 |
1.1 |
|
718 |
1.1 |
|
719 |
1.1 |
|
720 |
1.1 |
|
724 |
1.1 |
|
725 |
1.1 |
|
726 |
1.1 |
|
730 |
1.1 |
|
731 |
1.1 |
|
732 |
1.1 |
|
733 |
1.1 |
|
734 |
1.1 |
|
738 |
1.1 |
|
739 |
1.1 |
|
740 |
1.1 |
|
795 |
1.1 2.2 3.3 |
|
797 |
1.1 2.2 3.3 |
|
803 |
1.1 |
|
809 |
1.1 |
|
813 |
1.1 |
|
817 |
1.1 2.2 3.3 |
|
819 |
1.1 2.2 3.3 |
|
830 |
1.1 2.2 3.3 |
|
832 |
1.1 2.2 3.3 |
|
838 |
1.1 |
|
839 |
1.1 |
|
843 |
1.1 2.2 3.3 |
|
845 |
1.1 2.2 3.3 |
|
855 |
1.1 2.2 3.3 |
|
857 |
1.1 2.2 3.3 |
|
867 |
1.1 2.2 3.3 |
|
869 |
1.1 2.2 3.3 |
|
875 |
1.1 |
|
880 |
1.1 |
|
881 |
1.1 |
|
882 |
1.1 2.2 3.3 |
|
884 |
1.1 2.2 3.3 |
|
886 |
1.1 |
|
887 |
1.1 2.2 |
|
893 |
1.1 |
|
907 |
1.1 |
|
908 |
1.1 |
|
909 |
1.1 |
|
918 |
1.1 |
|
921 |
1.1 2.2 |
|
922 |
1.1 |
|
925 |
1.1 |
|
926 |
1.1 |
|
928 |
1.1 |
|
929 |
1.1 |
|
930 |
1.1 2.2 |
|
932 |
1.1 |
|
937 |
1.1 |
|
942 |
1.1 |
|
943 |
1.1 |
|
949 |
1.1 2.2 3.3 |
|
950 |
1.1 |
|
955 |
1.1 |
|
959 |
1.1 |
|
960 |
1.1 |
|
962 |
1.1 |
|
972 |
1.1 2.2 |
|
974 |
1.1 2.2 |
|
975 |
1.1 |
|
976 |
1.1 |
|
978 |
1.1 2.2 3.3 |
|
982 |
1.1 |
|
984 |
1.1 |
|
985 |
1.1 2.2 3.3 |
|
986 |
1.1 |
|
994 |
1.1 |
|
995 |
1.1 |
|
1001 |
1.1 |
|
1003 |
1.1 2.2 |
|
1007 |
1.1 2.2 3.3 |
|
1008 |
1.1 |
|
1009 |
1.1 2.2 3.3 |
|
1010 |
1.1 2.2 3.3 |
|
1013 |
1.1 2.2 3.3 |
|
1014 |
1.1 |
|
1019 |
1.1 2.2 3.3 |
|
1020 |
1.1 |
|
1027 |
1.1 |
|
1028 |
1.1 |
|
1030 |
1.1 2.2 3.3 |
|
1033 |
1.1 |
|
1046 |
1.1 2.2 3.3 |
|
1050 |
1.1 2.2 |
|
1063 |
1.1 |
|
1072 |
1.1 2.2 |
|
1073 |
1.1 |
|
1079 |
1.1 2.2 |