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.BufferedReader; | |
35 | import java.io.FileNotFoundException; | |
36 | import java.io.FileReader; | |
37 | import java.io.IOException; | |
38 | import java.io.InputStream; | |
39 | import java.io.InputStreamReader; | |
40 | import java.io.Reader; | |
41 | import java.io.StreamTokenizer; | |
42 | import java.net.URL; | |
43 | import java.util.ArrayList; | |
44 | import java.util.Arrays; | |
45 | import java.util.HashMap; | |
46 | ||
47 | import org.graphstream.stream.SourceBase; | |
48 | import org.graphstream.ui.geom.Point3; | |
49 | ||
50 | /** | |
51 | * Base for various graph file input. | |
52 | * | |
53 | * <p> | |
54 | * This class is a piece of crap. However it is still used in many places... :-( | |
55 | * TODO use a parser generator to replace it. | |
56 | * </p> | |
57 | * | |
58 | * <p> | |
59 | * This class provides parsing utilities to help the creation of new graph | |
60 | * readers/parsers. It handles a stack of input files that allow to easily | |
61 | * implements "includes" (that is interrupting the parsing of a file to input | |
62 | * another one). It wraps stream tokenizers allowing to eat or get specific | |
63 | * token types easily. | |
64 | * </p> | |
65 | * | |
66 | * <p> | |
67 | * It is well suited for graph formats using text (not binary), but not for XML | |
68 | * based files where a real XML parser would probably be better. | |
69 | * </p> | |
70 | */ | |
71 | public abstract class FileSourceBase extends SourceBase implements FileSource { | |
72 | // Attributes | |
73 | ||
74 | /** | |
75 | * The quote character. Can be changed in descendants. | |
76 | */ | |
77 | protected int QUOTE_CHAR = '"'; | |
78 | ||
79 | /** | |
80 | * The comment character. Can be changed in descendants. | |
81 | */ | |
82 | protected int COMMENT_CHAR = '#'; | |
83 | ||
84 | /** | |
85 | * Is EOL significant?. | |
86 | */ | |
87 | protected boolean eol_is_significant = false; | |
88 | ||
89 | /** | |
90 | * Stack of tokenizers/filenames. Each tokenizer is open on a file. When an | |
91 | * include is found, the current tokenizer is pushed on the stack and a new | |
92 | * one for the included file is created. Once the included file is parsed, | |
93 | * the tokenizer is popped of the stack and the previous one is used. | |
94 | */ | |
95 | protected ArrayList<CurrentFile> tok_stack = new ArrayList<CurrentFile>(); | |
96 | ||
97 | /** | |
98 | * Current tokenizer. | |
99 | */ | |
100 | protected StreamTokenizer st; | |
101 | ||
102 | /** | |
103 | * Current file name. | |
104 | */ | |
105 | protected String filename; | |
106 | ||
107 | /** | |
108 | * Map of unknown attributes to corresponding classes. | |
109 | */ | |
110 | protected HashMap<String, String> attribute_classes = new HashMap<String, String>(); | |
111 | ||
112 | // Constructors | |
113 | ||
114 | /** | |
115 | * No-op constructor. | |
116 | */ | |
117 | protected FileSourceBase() { | |
118 | } | |
119 | ||
120 | /** | |
121 | * Setup the reader End-Of-Line policy. | |
122 | * | |
123 | * @param eol_is_significant | |
124 | * If true EOL will be returned as a token, else it is ignored. | |
125 | */ | |
126 | protected FileSourceBase(boolean eol_is_significant) { | |
127 | this.eol_is_significant = eol_is_significant; | |
128 | } | |
129 | ||
130 | /** | |
131 | * Setup the reader End-Of-Line policy and specific comment and quote | |
132 | * characters. | |
133 | * | |
134 | * @param eol_is_significant | |
135 | * If true EOL will be returned as a token, else it is ignored. | |
136 | * @param commentChar | |
137 | * Character used for one line comments. | |
138 | * @param quoteChar | |
139 | * Character used to enclose quotations. | |
140 | */ | |
141 | protected FileSourceBase(boolean eol_is_significant, int commentChar, int quoteChar) { | |
142 | this.eol_is_significant = eol_is_significant; | |
143 | ||
144 | this.COMMENT_CHAR = commentChar; | |
145 | this.QUOTE_CHAR = quoteChar; | |
146 | } | |
147 | ||
148 | // Access | |
149 | ||
150 | // Command -- Complete modeField. | |
151 | ||
152 | public void readAll(String filename) throws IOException { | |
153 |
1
1. readAll : removed call to org/graphstream/stream/file/FileSourceBase::begin → NO_COVERAGE |
begin(filename); |
154 |
1
1. readAll : negated conditional → NO_COVERAGE |
while (nextEvents()) |
155 | ; | |
156 |
1
1. readAll : removed call to org/graphstream/stream/file/FileSourceBase::end → NO_COVERAGE |
end(); |
157 | } | |
158 | ||
159 | public void readAll(URL url) throws IOException { | |
160 |
1
1. readAll : removed call to org/graphstream/stream/file/FileSourceBase::begin → NO_COVERAGE |
begin(url); |
161 |
1
1. readAll : negated conditional → NO_COVERAGE |
while (nextEvents()) |
162 | ; | |
163 |
1
1. readAll : removed call to org/graphstream/stream/file/FileSourceBase::end → NO_COVERAGE |
end(); |
164 | } | |
165 | ||
166 | public void readAll(InputStream stream) throws IOException { | |
167 |
1
1. readAll : removed call to org/graphstream/stream/file/FileSourceBase::begin → NO_COVERAGE |
begin(stream); |
168 |
1
1. readAll : negated conditional → NO_COVERAGE |
while (nextEvents()) |
169 | ; | |
170 |
1
1. readAll : removed call to org/graphstream/stream/file/FileSourceBase::end → NO_COVERAGE |
end(); |
171 | } | |
172 | ||
173 | public void readAll(Reader reader) throws IOException { | |
174 |
1
1. readAll : removed call to org/graphstream/stream/file/FileSourceBase::begin → NO_COVERAGE |
begin(reader); |
175 |
1
1. readAll : negated conditional → NO_COVERAGE |
while (nextEvents()) |
176 | ; | |
177 |
1
1. readAll : removed call to org/graphstream/stream/file/FileSourceBase::end → NO_COVERAGE |
end(); |
178 | } | |
179 | ||
180 | // Commands -- By-event modeField. | |
181 | ||
182 | public void begin(String filename) throws IOException { | |
183 |
1
1. begin : removed call to org/graphstream/stream/file/FileSourceBase::pushTokenizer → NO_COVERAGE |
pushTokenizer(filename); |
184 | } | |
185 | ||
186 | public void begin(InputStream stream) throws IOException { | |
187 |
1
1. begin : removed call to org/graphstream/stream/file/FileSourceBase::pushTokenizer → NO_COVERAGE |
pushTokenizer(stream); |
188 | } | |
189 | ||
190 | public void begin(URL url) throws IOException { | |
191 |
1
1. begin : removed call to org/graphstream/stream/file/FileSourceBase::pushTokenizer → NO_COVERAGE |
pushTokenizer(url); |
192 | } | |
193 | ||
194 | public void begin(Reader reader) throws IOException { | |
195 |
1
1. begin : removed call to org/graphstream/stream/file/FileSourceBase::pushTokenizer → NO_COVERAGE |
pushTokenizer(reader); |
196 | } | |
197 | ||
198 | public abstract boolean nextEvents() throws IOException; | |
199 | ||
200 | public void end() throws IOException { | |
201 |
1
1. end : removed call to org/graphstream/stream/file/FileSourceBase::popTokenizer → NO_COVERAGE |
popTokenizer(); |
202 | } | |
203 | ||
204 | // Command | |
205 | ||
206 | /** | |
207 | * Declare that when <code>attribute</code> is found, the corresponding | |
208 | * <code>attribute_class</code> must be instantiated and inserted in the | |
209 | * current element being parsed. This is equivalent to the "map" keyword of | |
210 | * the GML file. An attribute appears in a GML file as a name followed by a | |
211 | * "[...]" block. The contents of this block defines sub-attributes that | |
212 | * must map to public fields of the attribute. Only attributes that are not | |
213 | * handled specifically by this parser can be added. | |
214 | * | |
215 | * @param attribute | |
216 | * must name the attribute. | |
217 | * @param attribute_class | |
218 | * must be the complete name of a Java class that will represent | |
219 | * the attribute. | |
220 | */ | |
221 | public void addAttributeClass(String attribute, String attribute_class) { | |
222 | attribute_classes.put(attribute, attribute_class); | |
223 | } | |
224 | ||
225 | // Command -- Parsing -- Include mechanism | |
226 | ||
227 | /** | |
228 | * Include the content of a <code>file</code>. This pushes a new tokenizer | |
229 | * on the input stack, calls the {@link #continueParsingInInclude()} method | |
230 | * (that must be implemented to read the include contents) and when finished | |
231 | * pops the tokenizer of the input stack. | |
232 | */ | |
233 | protected void include(String file) throws IOException { | |
234 |
1
1. include : removed call to org/graphstream/stream/file/FileSourceBase::pushTokenizer → NO_COVERAGE |
pushTokenizer(file); |
235 |
1
1. include : removed call to org/graphstream/stream/file/FileSourceBase::continueParsingInInclude → NO_COVERAGE |
continueParsingInInclude(); |
236 |
1
1. include : removed call to org/graphstream/stream/file/FileSourceBase::popTokenizer → NO_COVERAGE |
popTokenizer(); |
237 | } | |
238 | ||
239 | /** | |
240 | * Must be implemented to read the content of an include. The current | |
241 | * tokenizer will be set to the included file. When this method returns, the | |
242 | * include file will be closed an parsing will continue where it was before | |
243 | * inclusion. | |
244 | */ | |
245 | protected abstract void continueParsingInInclude() throws IOException; | |
246 | ||
247 | /** | |
248 | * Push a tokenizer created from a file name on the file stack and make it | |
249 | * current. | |
250 | * | |
251 | * @param file | |
252 | * Name of the file used as source for the tokenizer. | |
253 | */ | |
254 | protected void pushTokenizer(String file) throws IOException { | |
255 | StreamTokenizer tok; | |
256 | CurrentFile cur; | |
257 | Reader reader; | |
258 | ||
259 | try { | |
260 | reader = createReaderFrom(file); | |
261 | tok = createTokenizer(reader); | |
262 | | |
263 | cur = new CurrentFile(file, tok, reader); | |
264 | } catch (FileNotFoundException e) { | |
265 | throw new IOException("cannot read file '" + file | |
266 | + "', not found: " + e.getMessage()); | |
267 | } | |
268 | ||
269 |
1
1. pushTokenizer : removed call to org/graphstream/stream/file/FileSourceBase::configureTokenizer → NO_COVERAGE |
configureTokenizer(tok); |
270 | tok_stack.add(cur); | |
271 | ||
272 | st = tok; | |
273 | filename = file; | |
274 | } | |
275 | ||
276 | /** | |
277 | * Create a reader for by the tokenizer. | |
278 | * | |
279 | * @param file | |
280 | * File name to be opened. | |
281 | * @return a reader for the tokenizer. | |
282 | * @throws FileNotFoundException | |
283 | * If the given file does not exist or un readable. | |
284 | */ | |
285 | protected Reader createReaderFrom(String file) throws FileNotFoundException { | |
286 |
1
1. createReaderFrom : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::createReaderFrom to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return new BufferedReader(new FileReader(file)); |
287 | } | |
288 | ||
289 | /** | |
290 | * Create a stream that can be read by the tokenizer. | |
291 | * | |
292 | * @param stream | |
293 | * Input stream to be open as a reader. | |
294 | * @return a reader for the tokenizer. | |
295 | */ | |
296 | protected Reader createReaderFrom(InputStream stream) { | |
297 |
1
1. createReaderFrom : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::createReaderFrom to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return new BufferedReader(new InputStreamReader(stream)); |
298 | } | |
299 | | |
300 | | |
301 | /** | |
302 | * Push a tokenizer created from a stream on the file stack and make it | |
303 | * current. | |
304 | * | |
305 | * @param url | |
306 | * The URL used as source for the tokenizer. | |
307 | */ | |
308 | protected void pushTokenizer(URL url) throws IOException { | |
309 |
1
1. pushTokenizer : removed call to org/graphstream/stream/file/FileSourceBase::pushTokenizer → NO_COVERAGE |
pushTokenizer(url.openStream(), url.toString()); |
310 | } | |
311 | ||
312 | /** | |
313 | * Push a tokenizer created from a stream on the file stack and make it | |
314 | * current. | |
315 | * | |
316 | * @param stream | |
317 | * The stream used as source for the tokenizer. | |
318 | */ | |
319 | protected void pushTokenizer(InputStream stream) throws IOException { | |
320 |
1
1. pushTokenizer : removed call to org/graphstream/stream/file/FileSourceBase::pushTokenizer → NO_COVERAGE |
pushTokenizer(stream, "<?input-stream?>"); |
321 | } | |
322 | ||
323 | /** | |
324 | * Push a tokenizer created from a stream on the file stack and make it | |
325 | * current. | |
326 | * | |
327 | * @param stream | |
328 | * The stream used as source for the tokenizer. | |
329 | * @param name | |
330 | * The name of the input stream. | |
331 | */ | |
332 | protected void pushTokenizer(InputStream stream, String name) | |
333 | throws IOException { | |
334 | StreamTokenizer tok; | |
335 | CurrentFile cur; | |
336 | Reader reader; | |
337 | ||
338 | reader = createReaderFrom(stream); | |
339 | tok = createTokenizer(reader); | |
340 | cur = new CurrentFile(name, tok, reader); | |
341 | ||
342 |
1
1. pushTokenizer : removed call to org/graphstream/stream/file/FileSourceBase::configureTokenizer → NO_COVERAGE |
configureTokenizer(tok); |
343 | tok_stack.add(cur); | |
344 | ||
345 | st = tok; | |
346 | filename = name; | |
347 | } | |
348 | ||
349 | ||
350 | ||
351 | /** | |
352 | * Push a tokenizer created from a reader on the file stack and make it | |
353 | * current. | |
354 | * | |
355 | * @param reader | |
356 | * The reader used as source for the tokenizer. | |
357 | */ | |
358 | protected void pushTokenizer(Reader reader) throws IOException { | |
359 | StreamTokenizer tok; | |
360 | CurrentFile cur; | |
361 | | |
362 | tok = createTokenizer(reader); | |
363 | cur = new CurrentFile("<?reader?>", tok,reader); | |
364 |
1
1. pushTokenizer : removed call to org/graphstream/stream/file/FileSourceBase::configureTokenizer → NO_COVERAGE |
configureTokenizer(tok); |
365 | tok_stack.add(cur); | |
366 | ||
367 | st = tok; | |
368 | filename = "<?reader?>"; | |
369 | ||
370 | } | |
371 | ||
372 | /** | |
373 | * Create a tokenizer from an input source. | |
374 | * | |
375 | * @param reader | |
376 | * The reader. | |
377 | * @return The new tokenizer. | |
378 | * @throws IOException | |
379 | * For any I/O error. | |
380 | */ | |
381 | private StreamTokenizer createTokenizer(Reader reader) | |
382 | throws IOException { | |
383 |
1
1. createTokenizer : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::createTokenizer to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return new StreamTokenizer(new BufferedReader(reader)); |
384 | } | |
385 | ||
386 | | |
387 | /** | |
388 | * Method to override to configure the tokenizer behaviour. It is called | |
389 | * each time a tokenizer is created (for the parsed file and all included | |
390 | * files). | |
391 | */ | |
392 | protected void configureTokenizer(StreamTokenizer tok) throws IOException { | |
393 |
2
1. configureTokenizer : changed conditional boundary → NO_COVERAGE 2. configureTokenizer : negated conditional → NO_COVERAGE |
if (COMMENT_CHAR > 0) |
394 |
1
1. configureTokenizer : removed call to java/io/StreamTokenizer::commentChar → NO_COVERAGE |
tok.commentChar(COMMENT_CHAR); |
395 |
1
1. configureTokenizer : removed call to java/io/StreamTokenizer::quoteChar → NO_COVERAGE |
tok.quoteChar(QUOTE_CHAR); |
396 |
1
1. configureTokenizer : removed call to java/io/StreamTokenizer::eolIsSignificant → NO_COVERAGE |
tok.eolIsSignificant(eol_is_significant); |
397 |
1
1. configureTokenizer : removed call to java/io/StreamTokenizer::wordChars → NO_COVERAGE |
tok.wordChars('_', '_'); |
398 |
1
1. configureTokenizer : removed call to java/io/StreamTokenizer::parseNumbers → NO_COVERAGE |
tok.parseNumbers(); |
399 | } | |
400 | ||
401 | /** | |
402 | * Remove the current tokenizer from the stack and restore the previous one | |
403 | * (if any). | |
404 | */ | |
405 | protected void popTokenizer() throws IOException { | |
406 | int n = tok_stack.size(); | |
407 | ||
408 |
2
1. popTokenizer : changed conditional boundary → NO_COVERAGE 2. popTokenizer : negated conditional → NO_COVERAGE |
if (n <= 0) |
409 | throw new RuntimeException("poped one too many tokenizer"); | |
410 | ||
411 |
1
1. popTokenizer : Changed increment from -1 to 1 → NO_COVERAGE |
n -= 1; |
412 | ||
413 | CurrentFile cur = tok_stack.remove(n); | |
414 |
1
1. popTokenizer : removed call to java/io/Reader::close → NO_COVERAGE |
cur.reader.close(); |
415 | | |
416 |
2
1. popTokenizer : changed conditional boundary → NO_COVERAGE 2. popTokenizer : negated conditional → NO_COVERAGE |
if (n > 0) { |
417 |
1
1. popTokenizer : Changed increment from -1 to 1 → NO_COVERAGE |
n -= 1; |
418 | ||
419 | cur = tok_stack.get(n); | |
420 | ||
421 | st = cur.tok; | |
422 | filename = cur.file; | |
423 | } | |
424 | } | |
425 | ||
426 | // Low level parsing | |
427 | ||
428 | /** | |
429 | * Push back the last read thing, so that it can be read anew. This allows | |
430 | * to explore one token ahead, and if not corresponding to what is expected, | |
431 | * go back. | |
432 | */ | |
433 | protected void pushBack() { | |
434 |
1
1. pushBack : removed call to java/io/StreamTokenizer::pushBack → NO_COVERAGE |
st.pushBack(); |
435 | } | |
436 | ||
437 | /** | |
438 | * Read EOF or report garbage at end of file. | |
439 | */ | |
440 | protected void eatEof() throws IOException { | |
441 | int tok = st.nextToken(); | |
442 | ||
443 |
1
1. eatEof : negated conditional → NO_COVERAGE |
if (tok != StreamTokenizer.TT_EOF) |
444 |
1
1. eatEof : removed call to org/graphstream/stream/file/FileSourceBase::parseError → NO_COVERAGE |
parseError("garbage at end of file, expecting EOF, " + gotWhat(tok)); |
445 | } | |
446 | ||
447 | /** | |
448 | * Read EOL. | |
449 | */ | |
450 | protected void eatEol() throws IOException { | |
451 | int tok = st.nextToken(); | |
452 | ||
453 |
1
1. eatEol : negated conditional → NO_COVERAGE |
if (tok != StreamTokenizer.TT_EOL) |
454 |
1
1. eatEol : removed call to org/graphstream/stream/file/FileSourceBase::parseError → NO_COVERAGE |
parseError("expecting EOL, " + gotWhat(tok)); |
455 | } | |
456 | ||
457 | /** | |
458 | * Read EOL or EOF. | |
459 | * | |
460 | * @return The token read StreamTokenizer.TT_EOL or StreamTokenizer.TT_EOF. | |
461 | */ | |
462 | protected int eatEolOrEof() throws IOException { | |
463 | int tok = st.nextToken(); | |
464 | ||
465 |
2
1. eatEolOrEof : negated conditional → NO_COVERAGE 2. eatEolOrEof : negated conditional → NO_COVERAGE |
if (tok != StreamTokenizer.TT_EOL && tok != StreamTokenizer.TT_EOF) |
466 |
1
1. eatEolOrEof : removed call to org/graphstream/stream/file/FileSourceBase::parseError → NO_COVERAGE |
parseError("expecting EOL or EOF, " + gotWhat(tok)); |
467 | ||
468 |
1
1. eatEolOrEof : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return tok; |
469 | } | |
470 | ||
471 | /** | |
472 | * Read an expected <code>word</code> token or generate a parse error. | |
473 | */ | |
474 | protected void eatWord(String word) throws IOException { | |
475 | int tok = st.nextToken(); | |
476 | ||
477 |
1
1. eatWord : negated conditional → NO_COVERAGE |
if (tok != StreamTokenizer.TT_WORD) |
478 |
1
1. eatWord : removed call to org/graphstream/stream/file/FileSourceBase::parseError → NO_COVERAGE |
parseError("expecting `" + word + "', " + gotWhat(tok)); |
479 | ||
480 |
1
1. eatWord : negated conditional → NO_COVERAGE |
if (!st.sval.equals(word)) |
481 |
1
1. eatWord : removed call to org/graphstream/stream/file/FileSourceBase::parseError → NO_COVERAGE |
parseError("expecting `" + word + "' got `" + st.sval + "'"); |
482 | } | |
483 | ||
484 | /** | |
485 | * Read an expected word among the given word list or generate a parse | |
486 | * error. | |
487 | * | |
488 | * @param words | |
489 | * The expected words. | |
490 | */ | |
491 | protected void eatWords(String... words) throws IOException { | |
492 | int tok = st.nextToken(); | |
493 | ||
494 |
1
1. eatWords : negated conditional → NO_COVERAGE |
if (tok != StreamTokenizer.TT_WORD) |
495 |
1
1. eatWords : removed call to org/graphstream/stream/file/FileSourceBase::parseError → NO_COVERAGE |
parseError("expecting one of `[" + Arrays.toString(words) + "]', " + gotWhat(tok)); |
496 | ||
497 | boolean found = false; | |
498 | ||
499 |
3
1. eatWords : changed conditional boundary → NO_COVERAGE 2. eatWords : Changed increment from 1 to -1 → NO_COVERAGE 3. eatWords : negated conditional → NO_COVERAGE |
for (String word : words) { |
500 |
1
1. eatWords : negated conditional → NO_COVERAGE |
if (st.sval.equals(word)) { |
501 | found = true; | |
502 | break; | |
503 | } | |
504 | } | |
505 | ||
506 |
1
1. eatWords : negated conditional → NO_COVERAGE |
if (!found) |
507 |
1
1. eatWords : removed call to org/graphstream/stream/file/FileSourceBase::parseError → NO_COVERAGE |
parseError("expecting one of `[" + Arrays.toString(words) + "]', got `" + st.sval + "'"); |
508 | } | |
509 | ||
510 | /** | |
511 | * Eat either a word or another, and return the eated one. | |
512 | * | |
513 | * @param word1 | |
514 | * The first word to eat. | |
515 | * @param word2 | |
516 | * The alternative word to eat. | |
517 | * @return The word eaten. | |
518 | */ | |
519 | protected String eatOneOfTwoWords(String word1, String word2) | |
520 | throws IOException { | |
521 | int tok = st.nextToken(); | |
522 | ||
523 |
1
1. eatOneOfTwoWords : negated conditional → NO_COVERAGE |
if (tok != StreamTokenizer.TT_WORD) |
524 |
1
1. eatOneOfTwoWords : removed call to org/graphstream/stream/file/FileSourceBase::parseError → NO_COVERAGE |
parseError("expecting `" + word1 + "' or `" + word2 + "', " |
525 | + gotWhat(tok)); | |
526 | ||
527 |
1
1. eatOneOfTwoWords : negated conditional → NO_COVERAGE |
if (st.sval.equals(word1)) |
528 |
1
1. eatOneOfTwoWords : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::eatOneOfTwoWords to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return word1; |
529 | ||
530 |
1
1. eatOneOfTwoWords : negated conditional → NO_COVERAGE |
if (st.sval.equals(word2)) |
531 |
1
1. eatOneOfTwoWords : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::eatOneOfTwoWords to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return word2; |
532 | ||
533 |
1
1. eatOneOfTwoWords : removed call to org/graphstream/stream/file/FileSourceBase::parseError → NO_COVERAGE |
parseError("expecting `" + word1 + "' or `" + word2 + "' got `" |
534 | + st.sval + "'"); | |
535 |
1
1. eatOneOfTwoWords : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::eatOneOfTwoWords to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return null; |
536 | } | |
537 | ||
538 | /** | |
539 | * Eat the expected symbol or generate a parse error. | |
540 | */ | |
541 | protected void eatSymbol(char symbol) throws IOException { | |
542 | int tok = st.nextToken(); | |
543 | ||
544 |
1
1. eatSymbol : negated conditional → NO_COVERAGE |
if (tok != symbol) |
545 |
1
1. eatSymbol : removed call to org/graphstream/stream/file/FileSourceBase::parseError → NO_COVERAGE |
parseError("expecting symbol `" + symbol + "', " + gotWhat(tok)); |
546 | } | |
547 | ||
548 | /** | |
549 | * Eat one of the list of expected <code>symbols</code> or generate a parse | |
550 | * error none of <code>symbols</code> can be found. | |
551 | */ | |
552 | protected int eatSymbols(String symbols) throws IOException { | |
553 | int tok = st.nextToken(); | |
554 | int n = symbols.length(); | |
555 | boolean f = false; | |
556 | ||
557 |
3
1. eatSymbols : changed conditional boundary → NO_COVERAGE 2. eatSymbols : Changed increment from 1 to -1 → NO_COVERAGE 3. eatSymbols : negated conditional → NO_COVERAGE |
for (int i = 0; i < n; ++i) { |
558 |
1
1. eatSymbols : negated conditional → NO_COVERAGE |
if (tok == symbols.charAt(i)) { |
559 | f = true; | |
560 | i = n; | |
561 | } | |
562 | } | |
563 | ||
564 |
1
1. eatSymbols : negated conditional → NO_COVERAGE |
if (!f) |
565 |
1
1. eatSymbols : removed call to org/graphstream/stream/file/FileSourceBase::parseError → NO_COVERAGE |
parseError("expecting one of symbols `" + symbols + "', " |
566 | + gotWhat(tok)); | |
567 | | |
568 |
1
1. eatSymbols : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return tok; |
569 | } | |
570 | ||
571 | /** | |
572 | * Eat the expected <code>word</code> or push back what was read so that it | |
573 | * can be read anew. | |
574 | */ | |
575 | protected void eatWordOrPushbak(String word) throws IOException { | |
576 | int tok = st.nextToken(); | |
577 | ||
578 |
1
1. eatWordOrPushbak : negated conditional → NO_COVERAGE |
if (tok != StreamTokenizer.TT_WORD) |
579 |
1
1. eatWordOrPushbak : removed call to org/graphstream/stream/file/FileSourceBase::pushBack → NO_COVERAGE |
pushBack(); |
580 | ||
581 |
1
1. eatWordOrPushbak : negated conditional → NO_COVERAGE |
if (!st.sval.equals(word)) |
582 |
1
1. eatWordOrPushbak : removed call to org/graphstream/stream/file/FileSourceBase::pushBack → NO_COVERAGE |
pushBack(); |
583 | } | |
584 | ||
585 | /** | |
586 | * Eat the expected <code>symbol</code> or push back what was read so that | |
587 | * it can be read anew. | |
588 | */ | |
589 | protected void eatSymbolOrPushback(char symbol) throws IOException { | |
590 | int tok = st.nextToken(); | |
591 | ||
592 |
1
1. eatSymbolOrPushback : negated conditional → NO_COVERAGE |
if (tok != symbol) |
593 |
1
1. eatSymbolOrPushback : removed call to org/graphstream/stream/file/FileSourceBase::pushBack → NO_COVERAGE |
pushBack(); |
594 | } | |
595 | ||
596 | /** | |
597 | * Eat all until an EOL is found. The EOL is also eaten. This works only if | |
598 | * EOL is significant (else it does nothing). | |
599 | */ | |
600 | protected void eatAllUntilEol() throws IOException { | |
601 |
1
1. eatAllUntilEol : negated conditional → NO_COVERAGE |
if (!eol_is_significant) |
602 | return; | |
603 | ||
604 | int tok = st.nextToken(); | |
605 | ||
606 |
1
1. eatAllUntilEol : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_EOF) |
607 | return; | |
608 | ||
609 |
1
1. eatAllUntilEol : negated conditional → NO_COVERAGE |
while ((tok != StreamTokenizer.TT_EOL) |
610 |
1
1. eatAllUntilEol : negated conditional → NO_COVERAGE |
&& (tok != StreamTokenizer.TT_EOF)) { |
611 | tok = st.nextToken(); | |
612 | } | |
613 | } | |
614 | ||
615 | /** | |
616 | * Eat all availables EOLs. | |
617 | */ | |
618 | protected void eatAllEols() throws IOException { | |
619 |
1
1. eatAllEols : negated conditional → NO_COVERAGE |
if (!eol_is_significant) |
620 | return; | |
621 | ||
622 | int tok = st.nextToken(); | |
623 | ||
624 |
1
1. eatAllEols : negated conditional → NO_COVERAGE |
while (tok == StreamTokenizer.TT_EOL) |
625 | tok = st.nextToken(); | |
626 | ||
627 |
1
1. eatAllEols : removed call to org/graphstream/stream/file/FileSourceBase::pushBack → NO_COVERAGE |
pushBack(); |
628 | } | |
629 | ||
630 | /** | |
631 | * Read a word or generate a parse error. | |
632 | */ | |
633 | protected String getWord() throws IOException { | |
634 | int tok = st.nextToken(); | |
635 | ||
636 |
1
1. getWord : negated conditional → NO_COVERAGE |
if (tok != StreamTokenizer.TT_WORD) |
637 |
1
1. getWord : removed call to org/graphstream/stream/file/FileSourceBase::parseError → NO_COVERAGE |
parseError("expecting a word, " + gotWhat(tok)); |
638 | ||
639 |
1
1. getWord : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWord to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return st.sval; |
640 | } | |
641 | ||
642 | /** | |
643 | * Get a symbol. | |
644 | */ | |
645 | protected char getSymbol() throws IOException { | |
646 | int tok = st.nextToken(); | |
647 | ||
648 |
3
1. getSymbol : changed conditional boundary → NO_COVERAGE 2. getSymbol : negated conditional → NO_COVERAGE 3. getSymbol : negated conditional → NO_COVERAGE |
if (tok > 0 && tok != StreamTokenizer.TT_WORD |
649 |
1
1. getSymbol : negated conditional → NO_COVERAGE |
&& tok != StreamTokenizer.TT_NUMBER |
650 |
1
1. getSymbol : negated conditional → NO_COVERAGE |
&& tok != StreamTokenizer.TT_EOL |
651 |
2
1. getSymbol : negated conditional → NO_COVERAGE 2. getSymbol : negated conditional → NO_COVERAGE |
&& tok != StreamTokenizer.TT_EOF && tok != QUOTE_CHAR |
652 |
1
1. getSymbol : negated conditional → NO_COVERAGE |
&& tok != COMMENT_CHAR) { |
653 |
1
1. getSymbol : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return (char) tok; |
654 | } | |
655 | ||
656 |
1
1. getSymbol : removed call to org/graphstream/stream/file/FileSourceBase::parseError → NO_COVERAGE |
parseError("expecting a symbol, " + gotWhat(tok)); |
657 |
1
1. getSymbol : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return (char) 0; // Never reached. |
658 | } | |
659 | ||
660 | /** | |
661 | * Get a symbol or push back what was read so that it can be read anew. If | |
662 | * no symbol is found, 0 is returned. | |
663 | */ | |
664 | protected char getSymbolOrPushback() throws IOException { | |
665 | int tok = st.nextToken(); | |
666 | ||
667 |
3
1. getSymbolOrPushback : changed conditional boundary → NO_COVERAGE 2. getSymbolOrPushback : negated conditional → NO_COVERAGE 3. getSymbolOrPushback : negated conditional → NO_COVERAGE |
if (tok > 0 && tok != StreamTokenizer.TT_WORD |
668 |
1
1. getSymbolOrPushback : negated conditional → NO_COVERAGE |
&& tok != StreamTokenizer.TT_NUMBER |
669 |
1
1. getSymbolOrPushback : negated conditional → NO_COVERAGE |
&& tok != StreamTokenizer.TT_EOL |
670 |
2
1. getSymbolOrPushback : negated conditional → NO_COVERAGE 2. getSymbolOrPushback : negated conditional → NO_COVERAGE |
&& tok != StreamTokenizer.TT_EOF && tok != QUOTE_CHAR |
671 |
1
1. getSymbolOrPushback : negated conditional → NO_COVERAGE |
&& tok != COMMENT_CHAR) { |
672 |
1
1. getSymbolOrPushback : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return (char) tok; |
673 | } | |
674 | ||
675 |
1
1. getSymbolOrPushback : removed call to org/graphstream/stream/file/FileSourceBase::pushBack → NO_COVERAGE |
pushBack(); |
676 | ||
677 |
1
1. getSymbolOrPushback : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return (char) 0; |
678 | } | |
679 | ||
680 | /** | |
681 | * Read a string constant (between quotes) or generate a parse error. Return | |
682 | * the content of the string without the quotes. | |
683 | */ | |
684 | protected String getString() throws IOException { | |
685 | int tok = st.nextToken(); | |
686 | ||
687 |
1
1. getString : negated conditional → NO_COVERAGE |
if (tok != QUOTE_CHAR) |
688 |
1
1. getString : removed call to org/graphstream/stream/file/FileSourceBase::parseError → NO_COVERAGE |
parseError("expecting a string constant, " + gotWhat(tok)); |
689 | ||
690 |
1
1. getString : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return st.sval; |
691 | } | |
692 | ||
693 | /** | |
694 | * Read a word or number or generate a parse error. If it is a number it is | |
695 | * converted to a string before being returned. | |
696 | */ | |
697 | protected String getWordOrNumber() throws IOException { | |
698 | int tok = st.nextToken(); | |
699 | ||
700 |
2
1. getWordOrNumber : negated conditional → NO_COVERAGE 2. getWordOrNumber : negated conditional → NO_COVERAGE |
if (tok != StreamTokenizer.TT_WORD && tok != StreamTokenizer.TT_NUMBER) |
701 |
1
1. getWordOrNumber : removed call to org/graphstream/stream/file/FileSourceBase::parseError → NO_COVERAGE |
parseError("expecting a word or number, " + gotWhat(tok)); |
702 | ||
703 |
1
1. getWordOrNumber : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_NUMBER) { |
704 | // If st.nval is an integer, as it is stored into a double, | |
705 | // toString() will transform it by automatically adding ".0", we | |
706 | // prevent this. The tokenizer does not allow to read integers. | |
707 | ||
708 |
2
1. getWordOrNumber : Replaced double subtraction with addition → NO_COVERAGE 2. getWordOrNumber : negated conditional → NO_COVERAGE |
if ((st.nval - ((int) st.nval)) == 0) |
709 |
1
1. getWordOrNumber : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrNumber to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Integer.toString((int) st.nval); |
710 | else | |
711 |
1
1. getWordOrNumber : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrNumber to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Double.toString(st.nval); |
712 | } else { | |
713 |
1
1. getWordOrNumber : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrNumber to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return st.sval; |
714 | } | |
715 | } | |
716 | ||
717 | /** | |
718 | * Read a string or number or generate a parse error. If it is a number it | |
719 | * is converted to a string before being returned. | |
720 | */ | |
721 | protected String getStringOrNumber() throws IOException { | |
722 | int tok = st.nextToken(); | |
723 | ||
724 |
2
1. getStringOrNumber : negated conditional → NO_COVERAGE 2. getStringOrNumber : negated conditional → NO_COVERAGE |
if (tok != QUOTE_CHAR && tok != StreamTokenizer.TT_NUMBER) |
725 |
1
1. getStringOrNumber : removed call to org/graphstream/stream/file/FileSourceBase::parseError → NO_COVERAGE |
parseError("expecting a string constant or a number, " |
726 | + gotWhat(tok)); | |
727 | ||
728 |
1
1. getStringOrNumber : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_NUMBER) { |
729 |
2
1. getStringOrNumber : Replaced double subtraction with addition → NO_COVERAGE 2. getStringOrNumber : negated conditional → NO_COVERAGE |
if ((st.nval - ((int) st.nval)) == 0) |
730 |
1
1. getStringOrNumber : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getStringOrNumber to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Integer.toString((int) st.nval); |
731 | else | |
732 |
1
1. getStringOrNumber : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getStringOrNumber to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Double.toString(st.nval); |
733 | } else { | |
734 |
1
1. getStringOrNumber : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getStringOrNumber to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return st.sval; |
735 | } | |
736 | } | |
737 | ||
738 | /** | |
739 | * Read a string or number or pushback and return null. If it is a number it | |
740 | * is converted to a string before being returned. | |
741 | */ | |
742 | protected String getStringOrWordOrNumberOrPushback() throws IOException { | |
743 | int tok = st.nextToken(); | |
744 | ||
745 |
2
1. getStringOrWordOrNumberOrPushback : negated conditional → NO_COVERAGE 2. getStringOrWordOrNumberOrPushback : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_EOL || tok == StreamTokenizer.TT_EOF) { |
746 |
1
1. getStringOrWordOrNumberOrPushback : removed call to org/graphstream/stream/file/FileSourceBase::pushBack → NO_COVERAGE |
pushBack(); |
747 |
1
1. getStringOrWordOrNumberOrPushback : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getStringOrWordOrNumberOrPushback to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return null; |
748 | } | |
749 | ||
750 |
1
1. getStringOrWordOrNumberOrPushback : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_NUMBER) { |
751 |
2
1. getStringOrWordOrNumberOrPushback : Replaced double subtraction with addition → NO_COVERAGE 2. getStringOrWordOrNumberOrPushback : negated conditional → NO_COVERAGE |
if ((st.nval - ((int) st.nval)) == 0) |
752 |
1
1. getStringOrWordOrNumberOrPushback : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getStringOrWordOrNumberOrPushback to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Integer.toString((int) st.nval); |
753 | else | |
754 |
1
1. getStringOrWordOrNumberOrPushback : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getStringOrWordOrNumberOrPushback to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Double.toString(st.nval); |
755 |
2
1. getStringOrWordOrNumberOrPushback : negated conditional → NO_COVERAGE 2. getStringOrWordOrNumberOrPushback : negated conditional → NO_COVERAGE |
} else if (tok == StreamTokenizer.TT_WORD || tok == QUOTE_CHAR) { |
756 |
1
1. getStringOrWordOrNumberOrPushback : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getStringOrWordOrNumberOrPushback to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return st.sval; |
757 | } else { | |
758 |
1
1. getStringOrWordOrNumberOrPushback : removed call to org/graphstream/stream/file/FileSourceBase::pushBack → NO_COVERAGE |
pushBack(); |
759 |
1
1. getStringOrWordOrNumberOrPushback : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getStringOrWordOrNumberOrPushback to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return null; |
760 | } | |
761 | } | |
762 | ||
763 | /** | |
764 | * Read a string or number or generate a parse error. If it is a number it | |
765 | * is converted to a string before being returned. | |
766 | */ | |
767 | protected String getStringOrWordOrNumber() throws IOException { | |
768 | int tok = st.nextToken(); | |
769 | ||
770 |
2
1. getStringOrWordOrNumber : negated conditional → NO_COVERAGE 2. getStringOrWordOrNumber : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_EOL || tok == StreamTokenizer.TT_EOF) |
771 |
1
1. getStringOrWordOrNumber : removed call to org/graphstream/stream/file/FileSourceBase::parseError → NO_COVERAGE |
parseError("expecting word, string or number, " + gotWhat(tok)); |
772 | ||
773 |
1
1. getStringOrWordOrNumber : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_NUMBER) { |
774 |
2
1. getStringOrWordOrNumber : Replaced double subtraction with addition → NO_COVERAGE 2. getStringOrWordOrNumber : negated conditional → NO_COVERAGE |
if ((st.nval - ((int) st.nval)) == 0) |
775 |
1
1. getStringOrWordOrNumber : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getStringOrWordOrNumber to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Integer.toString((int) st.nval); |
776 | else | |
777 |
1
1. getStringOrWordOrNumber : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getStringOrWordOrNumber to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Double.toString(st.nval); |
778 | } else { | |
779 |
1
1. getStringOrWordOrNumber : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getStringOrWordOrNumber to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return st.sval; |
780 | } | |
781 | } | |
782 | ||
783 | /** | |
784 | * Read a string or number or generate a parse error. The returned value is | |
785 | * converted to a Number of a String depending on its type. | |
786 | */ | |
787 | protected Object getStringOrWordOrNumberO() throws IOException { | |
788 | int tok = st.nextToken(); | |
789 | ||
790 |
2
1. getStringOrWordOrNumberO : negated conditional → NO_COVERAGE 2. getStringOrWordOrNumberO : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_EOL || tok == StreamTokenizer.TT_EOF) |
791 |
1
1. getStringOrWordOrNumberO : removed call to org/graphstream/stream/file/FileSourceBase::parseError → NO_COVERAGE |
parseError("expecting word, string or number, " + gotWhat(tok)); |
792 | ||
793 |
1
1. getStringOrWordOrNumberO : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_NUMBER) { |
794 |
1
1. getStringOrWordOrNumberO : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getStringOrWordOrNumberO to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return st.nval; |
795 | } else { | |
796 |
1
1. getStringOrWordOrNumberO : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getStringOrWordOrNumberO to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return st.sval; |
797 | } | |
798 | } | |
799 | ||
800 | /** | |
801 | * Read a string or number or generate a parse error. The returned value is | |
802 | * converted to a Number of a String depending on its type. | |
803 | */ | |
804 | protected Object getStringOrWordOrSymbolOrNumberO() throws IOException { | |
805 | int tok = st.nextToken(); | |
806 | ||
807 |
2
1. getStringOrWordOrSymbolOrNumberO : negated conditional → NO_COVERAGE 2. getStringOrWordOrSymbolOrNumberO : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_EOL || tok == StreamTokenizer.TT_EOF) |
808 |
1
1. getStringOrWordOrSymbolOrNumberO : removed call to org/graphstream/stream/file/FileSourceBase::parseError → NO_COVERAGE |
parseError("expecting word, string or number, " + gotWhat(tok)); |
809 | ||
810 |
1
1. getStringOrWordOrSymbolOrNumberO : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_NUMBER) { |
811 |
1
1. getStringOrWordOrSymbolOrNumberO : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getStringOrWordOrSymbolOrNumberO to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return st.nval; |
812 |
1
1. getStringOrWordOrSymbolOrNumberO : negated conditional → NO_COVERAGE |
} else if (tok == StreamTokenizer.TT_WORD) { |
813 |
1
1. getStringOrWordOrSymbolOrNumberO : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getStringOrWordOrSymbolOrNumberO to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return st.sval; |
814 | } else | |
815 |
1
1. getStringOrWordOrSymbolOrNumberO : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getStringOrWordOrSymbolOrNumberO to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Character.toString((char) tok); |
816 | } | |
817 | ||
818 | /** | |
819 | * Read a word or string or generate a parse error. | |
820 | */ | |
821 | protected String getWordOrString() throws IOException { | |
822 | int tok = st.nextToken(); | |
823 | ||
824 |
2
1. getWordOrString : negated conditional → NO_COVERAGE 2. getWordOrString : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_WORD || tok == QUOTE_CHAR) |
825 |
1
1. getWordOrString : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return st.sval; |
826 | ||
827 |
1
1. getWordOrString : removed call to org/graphstream/stream/file/FileSourceBase::parseError → NO_COVERAGE |
parseError("expecting a word or string, " + gotWhat(tok)); |
828 |
1
1. getWordOrString : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return null; |
829 | } | |
830 | ||
831 | /** | |
832 | * Read a word or symbol or generate a parse error. | |
833 | */ | |
834 | protected String getWordOrSymbol() throws IOException { | |
835 | int tok = st.nextToken(); | |
836 | ||
837 |
2
1. getWordOrSymbol : negated conditional → NO_COVERAGE 2. getWordOrSymbol : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_NUMBER || tok == QUOTE_CHAR |
838 |
1
1. getWordOrSymbol : negated conditional → NO_COVERAGE |
|| tok == StreamTokenizer.TT_EOF) |
839 |
1
1. getWordOrSymbol : removed call to org/graphstream/stream/file/FileSourceBase::parseError → NO_COVERAGE |
parseError("expecting a word or symbol, " + gotWhat(tok)); |
840 | ||
841 |
1
1. getWordOrSymbol : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_WORD) |
842 |
1
1. getWordOrSymbol : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrSymbol to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return st.sval; |
843 | else | |
844 |
1
1. getWordOrSymbol : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrSymbol to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Character.toString((char) tok); |
845 | } | |
846 | ||
847 | /** | |
848 | * Read a word or symbol or push back the read thing so that it is readable | |
849 | * anew. In the second case, null is returned. | |
850 | */ | |
851 | protected String getWordOrSymbolOrPushback() throws IOException { | |
852 | int tok = st.nextToken(); | |
853 | ||
854 |
2
1. getWordOrSymbolOrPushback : negated conditional → NO_COVERAGE 2. getWordOrSymbolOrPushback : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_NUMBER || tok == QUOTE_CHAR |
855 |
1
1. getWordOrSymbolOrPushback : negated conditional → NO_COVERAGE |
|| tok == StreamTokenizer.TT_EOF) { |
856 |
1
1. getWordOrSymbolOrPushback : removed call to org/graphstream/stream/file/FileSourceBase::pushBack → NO_COVERAGE |
pushBack(); |
857 |
1
1. getWordOrSymbolOrPushback : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrSymbolOrPushback to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return null; |
858 | } | |
859 | ||
860 |
1
1. getWordOrSymbolOrPushback : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_WORD) |
861 |
1
1. getWordOrSymbolOrPushback : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrSymbolOrPushback to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return st.sval; |
862 | else | |
863 |
1
1. getWordOrSymbolOrPushback : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrSymbolOrPushback to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Character.toString((char) tok); |
864 | } | |
865 | ||
866 | /** | |
867 | * Read a word or symbol or string or generate a parse error. | |
868 | */ | |
869 | protected String getWordOrSymbolOrString() throws IOException { | |
870 | int tok = st.nextToken(); | |
871 | ||
872 |
2
1. getWordOrSymbolOrString : negated conditional → NO_COVERAGE 2. getWordOrSymbolOrString : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_NUMBER || tok == StreamTokenizer.TT_EOF) |
873 |
1
1. getWordOrSymbolOrString : removed call to org/graphstream/stream/file/FileSourceBase::parseError → NO_COVERAGE |
parseError("expecting a word, symbol or string, " + gotWhat(tok)); |
874 | ||
875 |
1
1. getWordOrSymbolOrString : negated conditional → NO_COVERAGE |
if (tok == QUOTE_CHAR) |
876 |
1
1. getWordOrSymbolOrString : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrSymbolOrString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return st.sval; |
877 | ||
878 |
1
1. getWordOrSymbolOrString : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_WORD) |
879 |
1
1. getWordOrSymbolOrString : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrSymbolOrString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return st.sval; |
880 | else | |
881 |
1
1. getWordOrSymbolOrString : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrSymbolOrString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Character.toString((char) tok); |
882 | } | |
883 | ||
884 | /** | |
885 | * Read a word or symbol or string or number or generate a parse error. | |
886 | */ | |
887 | protected String getAllExceptedEof() throws IOException { | |
888 | int tok = st.nextToken(); | |
889 | ||
890 |
1
1. getAllExceptedEof : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_EOF) |
891 |
1
1. getAllExceptedEof : removed call to org/graphstream/stream/file/FileSourceBase::parseError → NO_COVERAGE |
parseError("expecting all excepted EOF, " + gotWhat(tok)); |
892 | ||
893 |
2
1. getAllExceptedEof : negated conditional → NO_COVERAGE 2. getAllExceptedEof : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_NUMBER || tok == StreamTokenizer.TT_EOF) { |
894 |
2
1. getAllExceptedEof : Replaced double subtraction with addition → NO_COVERAGE 2. getAllExceptedEof : negated conditional → NO_COVERAGE |
if ((st.nval - ((int) st.nval)) == 0) |
895 |
1
1. getAllExceptedEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getAllExceptedEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Integer.toString((int) st.nval); |
896 | else | |
897 |
1
1. getAllExceptedEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getAllExceptedEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Double.toString(st.nval); |
898 | } | |
899 | ||
900 |
1
1. getAllExceptedEof : negated conditional → NO_COVERAGE |
if (tok == QUOTE_CHAR) |
901 |
1
1. getAllExceptedEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getAllExceptedEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return st.sval; |
902 | ||
903 |
1
1. getAllExceptedEof : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_WORD) |
904 |
1
1. getAllExceptedEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getAllExceptedEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return st.sval; |
905 | else | |
906 |
1
1. getAllExceptedEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getAllExceptedEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Character.toString((char) tok); |
907 | } | |
908 | ||
909 | /** | |
910 | * Read a word, a symbol or EOF, or generate a parse error. If this is EOF, | |
911 | * the string "EOF" is returned. | |
912 | */ | |
913 | protected String getWordOrSymbolOrEof() throws IOException { | |
914 | int tok = st.nextToken(); | |
915 | ||
916 |
2
1. getWordOrSymbolOrEof : negated conditional → NO_COVERAGE 2. getWordOrSymbolOrEof : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_NUMBER || tok == QUOTE_CHAR) |
917 |
1
1. getWordOrSymbolOrEof : removed call to org/graphstream/stream/file/FileSourceBase::parseError → NO_COVERAGE |
parseError("expecting a word or symbol, " + gotWhat(tok)); |
918 | ||
919 |
1
1. getWordOrSymbolOrEof : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_WORD) |
920 |
1
1. getWordOrSymbolOrEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrSymbolOrEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return st.sval; |
921 |
1
1. getWordOrSymbolOrEof : negated conditional → NO_COVERAGE |
else if (tok == StreamTokenizer.TT_EOF) |
922 |
1
1. getWordOrSymbolOrEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrSymbolOrEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "EOF"; |
923 | else | |
924 |
1
1. getWordOrSymbolOrEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrSymbolOrEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Character.toString((char) tok); |
925 | } | |
926 | ||
927 | /** | |
928 | * Read a word or symbol or string or EOL/EOF or generate a parse error. If | |
929 | * EOL is read the "EOL" string is returned. If EOF is read the "EOF" string | |
930 | * is returned. | |
931 | * | |
932 | * @return A string. | |
933 | */ | |
934 | protected String getWordOrSymbolOrStringOrEolOrEof() throws IOException { | |
935 | int tok = st.nextToken(); | |
936 | ||
937 |
1
1. getWordOrSymbolOrStringOrEolOrEof : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_NUMBER) |
938 |
1
1. getWordOrSymbolOrStringOrEolOrEof : removed call to org/graphstream/stream/file/FileSourceBase::parseError → NO_COVERAGE |
parseError("expecting a word, symbol or string, " + gotWhat(tok)); |
939 | ||
940 |
1
1. getWordOrSymbolOrStringOrEolOrEof : negated conditional → NO_COVERAGE |
if (tok == QUOTE_CHAR) |
941 |
1
1. getWordOrSymbolOrStringOrEolOrEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrSymbolOrStringOrEolOrEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return st.sval; |
942 | ||
943 |
1
1. getWordOrSymbolOrStringOrEolOrEof : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_WORD) |
944 |
1
1. getWordOrSymbolOrStringOrEolOrEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrSymbolOrStringOrEolOrEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return st.sval; |
945 | ||
946 |
1
1. getWordOrSymbolOrStringOrEolOrEof : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_EOF) |
947 |
1
1. getWordOrSymbolOrStringOrEolOrEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrSymbolOrStringOrEolOrEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "EOF"; |
948 | ||
949 |
1
1. getWordOrSymbolOrStringOrEolOrEof : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_EOL) |
950 |
1
1. getWordOrSymbolOrStringOrEolOrEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrSymbolOrStringOrEolOrEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "EOL"; |
951 | ||
952 |
1
1. getWordOrSymbolOrStringOrEolOrEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrSymbolOrStringOrEolOrEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Character.toString((char) tok); |
953 | } | |
954 | ||
955 | /** | |
956 | * Read a word or number or string or EOL/EOF or generate a parse error. If | |
957 | * EOL is read the "EOL" string is returned. If EOF is read the "EOF" string | |
958 | * is returned. If a number is returned, it is converted to a string as | |
959 | * follows: if it is an integer, only the integer part is converted to a | |
960 | * string without dot or comma and no leading zeros. If it is a float the | |
961 | * fractional part is also converted and the dot is used as separator. | |
962 | * | |
963 | * @return A string. | |
964 | */ | |
965 | protected String getWordOrNumberOrStringOrEolOrEof() throws IOException { | |
966 | int tok = st.nextToken(); | |
967 | ||
968 |
1
1. getWordOrNumberOrStringOrEolOrEof : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_NUMBER) { |
969 |
2
1. getWordOrNumberOrStringOrEolOrEof : Replaced double subtraction with addition → NO_COVERAGE 2. getWordOrNumberOrStringOrEolOrEof : negated conditional → NO_COVERAGE |
if (st.nval - ((int) st.nval) != 0) |
970 |
1
1. getWordOrNumberOrStringOrEolOrEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrNumberOrStringOrEolOrEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Double.toString(st.nval); |
971 | ||
972 |
1
1. getWordOrNumberOrStringOrEolOrEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrNumberOrStringOrEolOrEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Integer.toString((int) st.nval); |
973 | } | |
974 | ||
975 |
1
1. getWordOrNumberOrStringOrEolOrEof : negated conditional → NO_COVERAGE |
if (tok == QUOTE_CHAR) |
976 |
1
1. getWordOrNumberOrStringOrEolOrEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrNumberOrStringOrEolOrEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return st.sval; |
977 | ||
978 |
1
1. getWordOrNumberOrStringOrEolOrEof : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_WORD) |
979 |
1
1. getWordOrNumberOrStringOrEolOrEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrNumberOrStringOrEolOrEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return st.sval; |
980 | ||
981 |
1
1. getWordOrNumberOrStringOrEolOrEof : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_EOF) |
982 |
1
1. getWordOrNumberOrStringOrEolOrEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrNumberOrStringOrEolOrEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "EOF"; |
983 | ||
984 |
1
1. getWordOrNumberOrStringOrEolOrEof : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_EOL) |
985 |
1
1. getWordOrNumberOrStringOrEolOrEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrNumberOrStringOrEolOrEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "EOL"; |
986 | ||
987 |
1
1. getWordOrNumberOrStringOrEolOrEof : removed call to org/graphstream/stream/file/FileSourceBase::parseError → NO_COVERAGE |
parseError("expecting a word, a number, a string, EOL or EOF, " |
988 | + gotWhat(tok)); | |
989 |
1
1. getWordOrNumberOrStringOrEolOrEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrNumberOrStringOrEolOrEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return null; // Never happen, parseError throws unconditionally an |
990 | // exception. | |
991 | } | |
992 | ||
993 | /** | |
994 | * Read a word or string or EOL/EOF or generate a parse error. If EOL is | |
995 | * read the "EOL" string is returned. If EOF is read the "EOF" string is | |
996 | * returned. | |
997 | * | |
998 | * @return A string. | |
999 | */ | |
1000 | protected String getWordOrStringOrEolOrEof() throws IOException { | |
1001 | int tok = st.nextToken(); | |
1002 | ||
1003 |
1
1. getWordOrStringOrEolOrEof : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_WORD) |
1004 |
1
1. getWordOrStringOrEolOrEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrStringOrEolOrEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return st.sval; |
1005 | ||
1006 |
1
1. getWordOrStringOrEolOrEof : negated conditional → NO_COVERAGE |
if (tok == QUOTE_CHAR) |
1007 |
1
1. getWordOrStringOrEolOrEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrStringOrEolOrEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return st.sval; |
1008 | ||
1009 |
1
1. getWordOrStringOrEolOrEof : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_EOL) |
1010 |
1
1. getWordOrStringOrEolOrEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrStringOrEolOrEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "EOL"; |
1011 | ||
1012 |
1
1. getWordOrStringOrEolOrEof : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_EOF) |
1013 |
1
1. getWordOrStringOrEolOrEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrStringOrEolOrEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "EOF"; |
1014 | ||
1015 |
1
1. getWordOrStringOrEolOrEof : removed call to org/graphstream/stream/file/FileSourceBase::parseError → NO_COVERAGE |
parseError("expecting a word, a string, EOL or EOF, " + gotWhat(tok)); |
1016 |
1
1. getWordOrStringOrEolOrEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrStringOrEolOrEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return null; // Never happen, parseError throws unconditionally an |
1017 | // exception. | |
1018 | } | |
1019 | ||
1020 | // Order: Word | String | Symbol | Number | Eol | Eof | |
1021 | ||
1022 | /** | |
1023 | * Read a word or number or string or EOL/EOF or generate a parse error. If | |
1024 | * EOL is read the "EOL" string is returned. If EOF is read the "EOF" string | |
1025 | * is returned. If a number is returned, it is converted to a string as | |
1026 | * follows: if it is an integer, only the integer part is converted to a | |
1027 | * string without dot or comma and no leading zeros. If it is a float the | |
1028 | * fractional part is also converted and the dot is used as separator. | |
1029 | * | |
1030 | * @return A string. | |
1031 | */ | |
1032 | protected String getWordOrSymbolOrNumberOrStringOrEolOrEof() | |
1033 | throws IOException { | |
1034 | int tok = st.nextToken(); | |
1035 | ||
1036 |
1
1. getWordOrSymbolOrNumberOrStringOrEolOrEof : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_NUMBER) { |
1037 |
2
1. getWordOrSymbolOrNumberOrStringOrEolOrEof : Replaced double subtraction with addition → NO_COVERAGE 2. getWordOrSymbolOrNumberOrStringOrEolOrEof : negated conditional → NO_COVERAGE |
if (st.nval - ((int) st.nval) != 0) |
1038 |
1
1. getWordOrSymbolOrNumberOrStringOrEolOrEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrSymbolOrNumberOrStringOrEolOrEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Double.toString(st.nval); |
1039 | ||
1040 |
1
1. getWordOrSymbolOrNumberOrStringOrEolOrEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrSymbolOrNumberOrStringOrEolOrEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Integer.toString((int) st.nval); |
1041 | } | |
1042 | ||
1043 |
1
1. getWordOrSymbolOrNumberOrStringOrEolOrEof : negated conditional → NO_COVERAGE |
if (tok == QUOTE_CHAR) |
1044 |
1
1. getWordOrSymbolOrNumberOrStringOrEolOrEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrSymbolOrNumberOrStringOrEolOrEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return st.sval; |
1045 | ||
1046 |
1
1. getWordOrSymbolOrNumberOrStringOrEolOrEof : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_WORD) |
1047 |
1
1. getWordOrSymbolOrNumberOrStringOrEolOrEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrSymbolOrNumberOrStringOrEolOrEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return st.sval; |
1048 | ||
1049 |
1
1. getWordOrSymbolOrNumberOrStringOrEolOrEof : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_EOF) |
1050 |
1
1. getWordOrSymbolOrNumberOrStringOrEolOrEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrSymbolOrNumberOrStringOrEolOrEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "EOF"; |
1051 | ||
1052 |
1
1. getWordOrSymbolOrNumberOrStringOrEolOrEof : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_EOL) |
1053 |
1
1. getWordOrSymbolOrNumberOrStringOrEolOrEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrSymbolOrNumberOrStringOrEolOrEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "EOL"; |
1054 | ||
1055 |
1
1. getWordOrSymbolOrNumberOrStringOrEolOrEof : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getWordOrSymbolOrNumberOrStringOrEolOrEof to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return Character.toString((char) tok); |
1056 | } | |
1057 | ||
1058 | /** | |
1059 | * Read a number or generate a parse error. | |
1060 | */ | |
1061 | protected double getNumber() throws IOException { | |
1062 | int tok = st.nextToken(); | |
1063 | ||
1064 |
1
1. getNumber : negated conditional → NO_COVERAGE |
if (tok != StreamTokenizer.TT_NUMBER) |
1065 |
1
1. getNumber : removed call to org/graphstream/stream/file/FileSourceBase::parseError → NO_COVERAGE |
parseError("expecting a number, " + gotWhat(tok)); |
1066 | ||
1067 |
1
1. getNumber : replaced return of double value with -(x + 1) for org/graphstream/stream/file/FileSourceBase::getNumber → NO_COVERAGE |
return st.nval; |
1068 | } | |
1069 | ||
1070 | /** | |
1071 | * Read a number (possibly with an exponent) or generate a parse error. | |
1072 | */ | |
1073 | protected double getNumberExp() throws IOException { | |
1074 | int tok = st.nextToken(); | |
1075 | ||
1076 |
1
1. getNumberExp : negated conditional → NO_COVERAGE |
if (tok != StreamTokenizer.TT_NUMBER) |
1077 |
1
1. getNumberExp : removed call to org/graphstream/stream/file/FileSourceBase::parseError → NO_COVERAGE |
parseError("expecting a number, " + gotWhat(tok)); |
1078 | ||
1079 | double nb = st.nval; | |
1080 | ||
1081 | tok = st.nextToken(); | |
1082 | ||
1083 |
1
1. getNumberExp : negated conditional → NO_COVERAGE |
if (tok == StreamTokenizer.TT_WORD |
1084 |
2
1. getNumberExp : negated conditional → NO_COVERAGE 2. getNumberExp : negated conditional → NO_COVERAGE |
&& (st.sval.startsWith("e-") || st.sval.startsWith("e+"))) { |
1085 | double exp = Double.parseDouble(st.sval.substring(2)); | |
1086 |
1
1. getNumberExp : replaced return of double value with -(x + 1) for org/graphstream/stream/file/FileSourceBase::getNumberExp → NO_COVERAGE |
return Math.pow(nb, exp); |
1087 | } else { | |
1088 |
1
1. getNumberExp : removed call to java/io/StreamTokenizer::pushBack → NO_COVERAGE |
st.pushBack(); |
1089 | } | |
1090 | ||
1091 |
1
1. getNumberExp : replaced return of double value with -(x + 1) for org/graphstream/stream/file/FileSourceBase::getNumberExp → NO_COVERAGE |
return nb; |
1092 | } | |
1093 | ||
1094 | /** | |
1095 | * Return a string containing "got " then the content of the current | |
1096 | * <code>token</code>. | |
1097 | */ | |
1098 | protected String gotWhat(int token) { | |
1099 | switch (token) { | |
1100 | case StreamTokenizer.TT_NUMBER: | |
1101 |
1
1. gotWhat : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::gotWhat to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "got number `" + st.nval + "'"; |
1102 | case StreamTokenizer.TT_WORD: | |
1103 |
1
1. gotWhat : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::gotWhat to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "got word `" + st.sval + "'"; |
1104 | case StreamTokenizer.TT_EOF: | |
1105 |
1
1. gotWhat : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::gotWhat to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "got EOF"; |
1106 | default: | |
1107 |
1
1. gotWhat : negated conditional → NO_COVERAGE |
if (token == QUOTE_CHAR) |
1108 |
1
1. gotWhat : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::gotWhat to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "got string constant `" + st.sval + "'"; |
1109 | else | |
1110 |
1
1. gotWhat : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::gotWhat to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return "unknown symbol `" + token + "' (" + ((char) token) |
1111 | + ")"; | |
1112 | } | |
1113 | } | |
1114 | ||
1115 | /** | |
1116 | * Generate a parse error. | |
1117 | */ | |
1118 | protected void parseError(String message) throws IOException { | |
1119 | throw new IOException("parse error: " + filename + ": " + st.lineno() | |
1120 | + ": " + message); | |
1121 | } | |
1122 | ||
1123 | // Access | |
1124 | ||
1125 | /** | |
1126 | * True if the <code>string</code> represents a truth statement ("1", | |
1127 | * "true", "yes", "on"). | |
1128 | */ | |
1129 | protected boolean isTrue(String string) { | |
1130 | string = string.toLowerCase(); | |
1131 | ||
1132 |
1
1. isTrue : negated conditional → NO_COVERAGE |
if (string.equals("1")) |
1133 |
1
1. isTrue : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return true; |
1134 |
1
1. isTrue : negated conditional → NO_COVERAGE |
if (string.equals("true")) |
1135 |
1
1. isTrue : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return true; |
1136 |
1
1. isTrue : negated conditional → NO_COVERAGE |
if (string.equals("yes")) |
1137 |
1
1. isTrue : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return true; |
1138 |
1
1. isTrue : negated conditional → NO_COVERAGE |
if (string.equals("on")) |
1139 |
1
1. isTrue : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return true; |
1140 | ||
1141 |
1
1. isTrue : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return false; |
1142 | } | |
1143 | ||
1144 | /** | |
1145 | * True if the <code>string</code> represents a false statement ("0", | |
1146 | * "false", "no", "off"). | |
1147 | */ | |
1148 | protected boolean isFalse(String string) { | |
1149 | string = string.toLowerCase(); | |
1150 | ||
1151 |
1
1. isFalse : negated conditional → NO_COVERAGE |
if (string.equals("0")) |
1152 |
1
1. isFalse : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return true; |
1153 |
1
1. isFalse : negated conditional → NO_COVERAGE |
if (string.equals("false")) |
1154 |
1
1. isFalse : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return true; |
1155 |
1
1. isFalse : negated conditional → NO_COVERAGE |
if (string.equals("no")) |
1156 |
1
1. isFalse : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return true; |
1157 |
1
1. isFalse : negated conditional → NO_COVERAGE |
if (string.equals("off")) |
1158 |
1
1. isFalse : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return true; |
1159 | ||
1160 |
1
1. isFalse : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return false; |
1161 | } | |
1162 | ||
1163 | /** | |
1164 | * Uses {@link #isTrue(String)} and {@link #isFalse(String)} to determine if | |
1165 | * <code>value</code> is a truth value and return the corresponding boolean. | |
1166 | * | |
1167 | * @throws NumberFormatException | |
1168 | * if the <code>value</code> is not a truth value. | |
1169 | */ | |
1170 | protected boolean getBoolean(String value) throws NumberFormatException { | |
1171 |
1
1. getBoolean : negated conditional → NO_COVERAGE |
if (isTrue(value)) |
1172 |
1
1. getBoolean : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return true; |
1173 |
1
1. getBoolean : negated conditional → NO_COVERAGE |
if (isFalse(value)) |
1174 |
1
1. getBoolean : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return false; |
1175 | throw new NumberFormatException("not a truth value `" + value + "'"); | |
1176 | } | |
1177 | ||
1178 | /** | |
1179 | * Try to transform <code>value</code> into a double. | |
1180 | * | |
1181 | * @throws NumberFormatException | |
1182 | * if the <code>value</code> is not a double. | |
1183 | */ | |
1184 | protected double getReal(String value) throws NumberFormatException { | |
1185 |
1
1. getReal : replaced return of double value with -(x + 1) for org/graphstream/stream/file/FileSourceBase::getReal → NO_COVERAGE |
return Double.parseDouble(value); |
1186 | } | |
1187 | ||
1188 | /** | |
1189 | * Try to transform <code>value</code> into a long. | |
1190 | * | |
1191 | * @throws NumberFormatException | |
1192 | * if the <code>value</code> is not a long. | |
1193 | */ | |
1194 | protected long getInteger(String value) throws NumberFormatException { | |
1195 |
1
1. getInteger : replaced return of long value with value + 1 for org/graphstream/stream/file/FileSourceBase::getInteger → NO_COVERAGE |
return Long.parseLong(value); |
1196 | } | |
1197 | ||
1198 | /** | |
1199 | * Get a number triplet with numbers separated by comas and return a new | |
1200 | * point for it. For example "0,1,2". | |
1201 | */ | |
1202 | protected Point3 getPoint3(String value) throws NumberFormatException { | |
1203 | int p0 = value.indexOf(','); | |
1204 |
1
1. getPoint3 : Replaced integer addition with subtraction → NO_COVERAGE |
int p1 = value.indexOf(',', p0 + 1); |
1205 | ||
1206 |
4
1. getPoint3 : changed conditional boundary → NO_COVERAGE 2. getPoint3 : changed conditional boundary → NO_COVERAGE 3. getPoint3 : negated conditional → NO_COVERAGE 4. getPoint3 : negated conditional → NO_COVERAGE |
if (p0 > 0 && p1 > 0) { |
1207 | String n0, n1, n2; | |
1208 | float v0, v1, v2; | |
1209 | ||
1210 | n0 = value.substring(0, p0); | |
1211 |
1
1. getPoint3 : Replaced integer addition with subtraction → NO_COVERAGE |
n1 = value.substring(p0 + 1, p1); |
1212 |
1
1. getPoint3 : Replaced integer addition with subtraction → NO_COVERAGE |
n2 = value.substring(p1 + 1); |
1213 | ||
1214 | v0 = Float.parseFloat(n0); | |
1215 | v1 = Float.parseFloat(n1); | |
1216 | v2 = Float.parseFloat(n2); | |
1217 | ||
1218 |
1
1. getPoint3 : mutated return of Object value for org/graphstream/stream/file/FileSourceBase::getPoint3 to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return new Point3(v0, v1, v2); |
1219 | } | |
1220 | ||
1221 | throw new NumberFormatException("value '" + value | |
1222 | + "' not in a valid point3 format"); | |
1223 | } | |
1224 | ||
1225 | /* | |
1226 | * Get a number triplet with numbers separated by comas and return new | |
1227 | * bounds for it. For example "0,1,2". | |
1228 | protected Bounds3 getBounds3(String value) throws NumberFormatException { | |
1229 | int p0 = value.indexOf(','); | |
1230 | int p1 = value.indexOf(',', p0 + 1); | |
1231 | ||
1232 | if (p0 > 0 && p1 > 0) { | |
1233 | String n0, n1, n2; | |
1234 | float v0, v1, v2; | |
1235 | ||
1236 | n0 = value.substring(0, p0); | |
1237 | n1 = value.substring(p0 + 1, p1); | |
1238 | n2 = value.substring(p1 + 1); | |
1239 | ||
1240 | v0 = Float.parseFloat(n0); | |
1241 | v1 = Float.parseFloat(n1); | |
1242 | v2 = Float.parseFloat(n2); | |
1243 | ||
1244 | return new Bounds3(v0, v1, v2); | |
1245 | } | |
1246 | ||
1247 | throw new NumberFormatException("value '" + value | |
1248 | + "' not in a valid point3 format"); | |
1249 | } | |
1250 | */ | |
1251 | ||
1252 | // Nested classes | |
1253 | ||
1254 | /** | |
1255 | * Currently processed file. | |
1256 | * <p> | |
1257 | * The graph reader base can process includes in files, and handles a stack | |
1258 | * of files. | |
1259 | * </p> | |
1260 | * | |
1261 | */ | |
1262 | protected static class CurrentFile { | |
1263 | /** | |
1264 | * The file name. | |
1265 | */ | |
1266 | public String file; | |
1267 | ||
1268 | /** | |
1269 | * The stream tokenizer. | |
1270 | */ | |
1271 | public StreamTokenizer tok; | |
1272 | | |
1273 | public Reader reader; | |
1274 | ||
1275 | public CurrentFile(String f, StreamTokenizer t, Reader reader) { | |
1276 | file = f; | |
1277 | tok = t; | |
1278 | this.reader=reader; | |
1279 | } | |
1280 | } | |
1281 | } | |
Mutations | ||
153 |
1.1 |
|
154 |
1.1 |
|
156 |
1.1 |
|
160 |
1.1 |
|
161 |
1.1 |
|
163 |
1.1 |
|
167 |
1.1 |
|
168 |
1.1 |
|
170 |
1.1 |
|
174 |
1.1 |
|
175 |
1.1 |
|
177 |
1.1 |
|
183 |
1.1 |
|
187 |
1.1 |
|
191 |
1.1 |
|
195 |
1.1 |
|
201 |
1.1 |
|
234 |
1.1 |
|
235 |
1.1 |
|
236 |
1.1 |
|
269 |
1.1 |
|
286 |
1.1 |
|
297 |
1.1 |
|
309 |
1.1 |
|
320 |
1.1 |
|
342 |
1.1 |
|
364 |
1.1 |
|
383 |
1.1 |
|
393 |
1.1 2.2 |
|
394 |
1.1 |
|
395 |
1.1 |
|
396 |
1.1 |
|
397 |
1.1 |
|
398 |
1.1 |
|
408 |
1.1 2.2 |
|
411 |
1.1 |
|
414 |
1.1 |
|
416 |
1.1 2.2 |
|
417 |
1.1 |
|
434 |
1.1 |
|
443 |
1.1 |
|
444 |
1.1 |
|
453 |
1.1 |
|
454 |
1.1 |
|
465 |
1.1 2.2 |
|
466 |
1.1 |
|
468 |
1.1 |
|
477 |
1.1 |
|
478 |
1.1 |
|
480 |
1.1 |
|
481 |
1.1 |
|
494 |
1.1 |
|
495 |
1.1 |
|
499 |
1.1 2.2 3.3 |
|
500 |
1.1 |
|
506 |
1.1 |
|
507 |
1.1 |
|
523 |
1.1 |
|
524 |
1.1 |
|
527 |
1.1 |
|
528 |
1.1 |
|
530 |
1.1 |
|
531 |
1.1 |
|
533 |
1.1 |
|
535 |
1.1 |
|
544 |
1.1 |
|
545 |
1.1 |
|
557 |
1.1 2.2 3.3 |
|
558 |
1.1 |
|
564 |
1.1 |
|
565 |
1.1 |
|
568 |
1.1 |
|
578 |
1.1 |
|
579 |
1.1 |
|
581 |
1.1 |
|
582 |
1.1 |
|
592 |
1.1 |
|
593 |
1.1 |
|
601 |
1.1 |
|
606 |
1.1 |
|
609 |
1.1 |
|
610 |
1.1 |
|
619 |
1.1 |
|
624 |
1.1 |
|
627 |
1.1 |
|
636 |
1.1 |
|
637 |
1.1 |
|
639 |
1.1 |
|
648 |
1.1 2.2 3.3 |
|
649 |
1.1 |
|
650 |
1.1 |
|
651 |
1.1 2.2 |
|
652 |
1.1 |
|
653 |
1.1 |
|
656 |
1.1 |
|
657 |
1.1 |
|
667 |
1.1 2.2 3.3 |
|
668 |
1.1 |
|
669 |
1.1 |
|
670 |
1.1 2.2 |
|
671 |
1.1 |
|
672 |
1.1 |
|
675 |
1.1 |
|
677 |
1.1 |
|
687 |
1.1 |
|
688 |
1.1 |
|
690 |
1.1 |
|
700 |
1.1 2.2 |
|
701 |
1.1 |
|
703 |
1.1 |
|
708 |
1.1 2.2 |
|
709 |
1.1 |
|
711 |
1.1 |
|
713 |
1.1 |
|
724 |
1.1 2.2 |
|
725 |
1.1 |
|
728 |
1.1 |
|
729 |
1.1 2.2 |
|
730 |
1.1 |
|
732 |
1.1 |
|
734 |
1.1 |
|
745 |
1.1 2.2 |
|
746 |
1.1 |
|
747 |
1.1 |
|
750 |
1.1 |
|
751 |
1.1 2.2 |
|
752 |
1.1 |
|
754 |
1.1 |
|
755 |
1.1 2.2 |
|
756 |
1.1 |
|
758 |
1.1 |
|
759 |
1.1 |
|
770 |
1.1 2.2 |
|
771 |
1.1 |
|
773 |
1.1 |
|
774 |
1.1 2.2 |
|
775 |
1.1 |
|
777 |
1.1 |
|
779 |
1.1 |
|
790 |
1.1 2.2 |
|
791 |
1.1 |
|
793 |
1.1 |
|
794 |
1.1 |
|
796 |
1.1 |
|
807 |
1.1 2.2 |
|
808 |
1.1 |
|
810 |
1.1 |
|
811 |
1.1 |
|
812 |
1.1 |
|
813 |
1.1 |
|
815 |
1.1 |
|
824 |
1.1 2.2 |
|
825 |
1.1 |
|
827 |
1.1 |
|
828 |
1.1 |
|
837 |
1.1 2.2 |
|
838 |
1.1 |
|
839 |
1.1 |
|
841 |
1.1 |
|
842 |
1.1 |
|
844 |
1.1 |
|
854 |
1.1 2.2 |
|
855 |
1.1 |
|
856 |
1.1 |
|
857 |
1.1 |
|
860 |
1.1 |
|
861 |
1.1 |
|
863 |
1.1 |
|
872 |
1.1 2.2 |
|
873 |
1.1 |
|
875 |
1.1 |
|
876 |
1.1 |
|
878 |
1.1 |
|
879 |
1.1 |
|
881 |
1.1 |
|
890 |
1.1 |
|
891 |
1.1 |
|
893 |
1.1 2.2 |
|
894 |
1.1 2.2 |
|
895 |
1.1 |
|
897 |
1.1 |
|
900 |
1.1 |
|
901 |
1.1 |
|
903 |
1.1 |
|
904 |
1.1 |
|
906 |
1.1 |
|
916 |
1.1 2.2 |
|
917 |
1.1 |
|
919 |
1.1 |
|
920 |
1.1 |
|
921 |
1.1 |
|
922 |
1.1 |
|
924 |
1.1 |
|
937 |
1.1 |
|
938 |
1.1 |
|
940 |
1.1 |
|
941 |
1.1 |
|
943 |
1.1 |
|
944 |
1.1 |
|
946 |
1.1 |
|
947 |
1.1 |
|
949 |
1.1 |
|
950 |
1.1 |
|
952 |
1.1 |
|
968 |
1.1 |
|
969 |
1.1 2.2 |
|
970 |
1.1 |
|
972 |
1.1 |
|
975 |
1.1 |
|
976 |
1.1 |
|
978 |
1.1 |
|
979 |
1.1 |
|
981 |
1.1 |
|
982 |
1.1 |
|
984 |
1.1 |
|
985 |
1.1 |
|
987 |
1.1 |
|
989 |
1.1 |
|
1003 |
1.1 |
|
1004 |
1.1 |
|
1006 |
1.1 |
|
1007 |
1.1 |
|
1009 |
1.1 |
|
1010 |
1.1 |
|
1012 |
1.1 |
|
1013 |
1.1 |
|
1015 |
1.1 |
|
1016 |
1.1 |
|
1036 |
1.1 |
|
1037 |
1.1 2.2 |
|
1038 |
1.1 |
|
1040 |
1.1 |
|
1043 |
1.1 |
|
1044 |
1.1 |
|
1046 |
1.1 |
|
1047 |
1.1 |
|
1049 |
1.1 |
|
1050 |
1.1 |
|
1052 |
1.1 |
|
1053 |
1.1 |
|
1055 |
1.1 |
|
1064 |
1.1 |
|
1065 |
1.1 |
|
1067 |
1.1 |
|
1076 |
1.1 |
|
1077 |
1.1 |
|
1083 |
1.1 |
|
1084 |
1.1 2.2 |
|
1086 |
1.1 |
|
1088 |
1.1 |
|
1091 |
1.1 |
|
1101 |
1.1 |
|
1103 |
1.1 |
|
1105 |
1.1 |
|
1107 |
1.1 |
|
1108 |
1.1 |
|
1110 |
1.1 |
|
1132 |
1.1 |
|
1133 |
1.1 |
|
1134 |
1.1 |
|
1135 |
1.1 |
|
1136 |
1.1 |
|
1137 |
1.1 |
|
1138 |
1.1 |
|
1139 |
1.1 |
|
1141 |
1.1 |
|
1151 |
1.1 |
|
1152 |
1.1 |
|
1153 |
1.1 |
|
1154 |
1.1 |
|
1155 |
1.1 |
|
1156 |
1.1 |
|
1157 |
1.1 |
|
1158 |
1.1 |
|
1160 |
1.1 |
|
1171 |
1.1 |
|
1172 |
1.1 |
|
1173 |
1.1 |
|
1174 |
1.1 |
|
1185 |
1.1 |
|
1195 |
1.1 |
|
1204 |
1.1 |
|
1206 |
1.1 2.2 3.3 4.4 |
|
1211 |
1.1 |
|
1212 |
1.1 |
|
1218 |
1.1 |