OldFileSourceDGS.java

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.dgs;
33
34
import java.io.BufferedReader;
35
import java.io.FileInputStream;
36
import java.io.FileNotFoundException;
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.HashMap;
45
import java.util.zip.GZIPInputStream;
46
47
import org.graphstream.stream.file.FileSource;
48
import org.graphstream.stream.file.FileSourceBase;
49
50
/**
51
 * Class responsible for parsing files in the DGS format.
52
 * 
53
 * <p>
54
 * The DGS file format is especially designed for storing dynamic graph
55
 * definitions into a file. More information about the DGS file format will be
56
 * found on the GraphStream web site: <a
57
 * href="http://graphstream-project.org/">http://graphstream-project.org/</a>
58
 * </p>
59
 * 
60
 * The usual file name extension used for this format is ".dgs".
61
 * 
62
 * @see FileSource
63
 */
64
public class OldFileSourceDGS extends FileSourceBase {
65
	// Attribute
66
67
	/**
68
	 * Format version.
69
	 */
70
	protected int version;
71
72
	/**
73
	 * Name of the graph.
74
	 */
75
	protected String graphName;
76
77
	/**
78
	 * Number of step given in the header.
79
	 */
80
	protected int stepCountAnnounced;
81
82
	/**
83
	 * Number of events given in the header.
84
	 */
85
	protected int eventCountAnnounced;
86
87
	/**
88
	 * Real number of step at current time.
89
	 */
90
	protected int stepCount;
91
92
	/**
93
	 * Real number of events at current time.
94
	 */
95
	protected int eventCount;
96
97
	/**
98
	 * An attribute set used everywhere.
99
	 */
100
	protected HashMap<String, Object> attributes = new HashMap<String, Object>();
101
102
	/**
103
	 * True as soon as the end of file is reached.
104
	 */
105
	protected boolean finished;
106
107
	// Construction
108
109
	/**
110
	 * New reader for the DGS graph file format version 3.
111
	 */
112
	public OldFileSourceDGS() {
113
		super(true /* EOL is significant */);
114
	}
115
116
	// Command -- Parsing
117
118
	@Override
119
	public boolean nextEvents() throws IOException {
120 1 1. nextEvents : negated conditional → NO_COVERAGE
		if (finished)
121 1 1. nextEvents : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
			return false;
122
123 1 1. nextEvents : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
		return next(false, false);
124
	}
125
126
	public boolean nextStep() throws IOException {
127 1 1. nextStep : negated conditional → NO_COVERAGE
		if (finished)
128 1 1. nextStep : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
			return false;
129
130 1 1. nextStep : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
		return next(true, false);
131
	}
132
133
	/**
134
	 * Read either one event or several.
135
	 * 
136
	 * @param readSteps
137
	 *            If true, read several events (usually starting with a step
138
	 *            event, but it may be preceded by other events), until another
139
	 *            step is encountered.
140
	 * @param stop
141
	 *            If true stop at the next step encountered (and push it back so
142
	 *            that is is readable at the next call to this method).
143
	 * @return True if it remains things to read.
144
	 */
145
	protected boolean next(boolean readSteps, boolean stop) throws IOException {
146
		String key = null;
147
		boolean loop = readSteps;
148
149
		// Sorted in probability of appearance ...
150
151
		do {
152
			key = getWordOrSymbolOrStringOrEolOrEof();
153
154 1 1. next : negated conditional → NO_COVERAGE
			if (key.equals("ce")) {
155 1 1. next : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::readCE → NO_COVERAGE
				readCE();
156 1 1. next : negated conditional → NO_COVERAGE
			} else if (key.equals("cn")) {
157 1 1. next : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::readCN → NO_COVERAGE
				readCN();
158 1 1. next : negated conditional → NO_COVERAGE
			} else if (key.equals("ae")) {
159 1 1. next : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::readAE → NO_COVERAGE
				readAE();
160 1 1. next : negated conditional → NO_COVERAGE
			} else if (key.equals("an")) {
161 1 1. next : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::readAN → NO_COVERAGE
				readAN();
162 1 1. next : negated conditional → NO_COVERAGE
			} else if (key.equals("de")) {
163 1 1. next : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::readDE → NO_COVERAGE
				readDE();
164 1 1. next : negated conditional → NO_COVERAGE
			} else if (key.equals("dn")) {
165 1 1. next : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::readDN → NO_COVERAGE
				readDN();
166 1 1. next : negated conditional → NO_COVERAGE
			} else if (key.equals("cg")) {
167 1 1. next : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::readCG → NO_COVERAGE
				readCG();
168 1 1. next : negated conditional → NO_COVERAGE
			} else if (key.equals("st")) {
169 1 1. next : negated conditional → NO_COVERAGE
				if (readSteps) {
170 1 1. next : negated conditional → NO_COVERAGE
					if (stop) {
171
						loop = false;
172 1 1. next : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::pushBack → NO_COVERAGE
						pushBack();
173
					} else {
174
						stop = true;
175 1 1. next : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::readST → NO_COVERAGE
						readST();
176
					}
177
				} else {
178 1 1. next : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::readST → NO_COVERAGE
					readST();
179
				}
180 1 1. next : negated conditional → NO_COVERAGE
			} else if (key.equals("#")) {
181 1 1. next : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::eatAllUntilEol → NO_COVERAGE
				eatAllUntilEol();
182 1 1. next : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
				return next(readSteps, stop);
183 1 1. next : negated conditional → NO_COVERAGE
			} else if (key.equals("EOL")) {
184
				// Probably an empty line.
185
				// NOP
186 1 1. next : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
				return next(readSteps, stop);
187 1 1. next : negated conditional → NO_COVERAGE
			} else if (key.equals("EOF")) {
188
				finished = true;
189 1 1. next : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
				return false;
190
			} else {
191 1 1. next : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::parseError → NO_COVERAGE
				parseError("unknown token '" + key + "'");
192
			}
193 1 1. next : negated conditional → NO_COVERAGE
		} while (loop);
194
195 1 1. next : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
		return true;
196
	}
197
198
	protected void readCE() throws IOException {
199
		String tag = getStringOrWordOrNumber();
200
201 1 1. readCE : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::readAttributes → NO_COVERAGE
		readAttributes(attributes);
202
203 1 1. readCE : negated conditional → NO_COVERAGE
		for (String key : attributes.keySet()) {
204
			Object value = attributes.get(key);
205
206 1 1. readCE : negated conditional → NO_COVERAGE
			if (value == null)
207 1 1. readCE : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::sendEdgeAttributeRemoved → NO_COVERAGE
				sendEdgeAttributeRemoved(graphName, tag, key);
208
			else
209 1 1. readCE : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::sendEdgeAttributeChanged → NO_COVERAGE
				sendEdgeAttributeChanged(graphName, tag, key, null, value);
210
		}
211
212 1 1. readCE : negated conditional → NO_COVERAGE
		if (eatEolOrEof() == StreamTokenizer.TT_EOF)
213 1 1. readCE : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::pushBack → NO_COVERAGE
			pushBack();
214
	}
215
216
	protected void readCN() throws IOException {
217
		String tag = getStringOrWordOrNumber();
218
219 1 1. readCN : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::readAttributes → NO_COVERAGE
		readAttributes(attributes);
220
221 1 1. readCN : negated conditional → NO_COVERAGE
		for (String key : attributes.keySet()) {
222
			Object value = attributes.get(key);
223
224 1 1. readCN : negated conditional → NO_COVERAGE
			if (value == null)
225 1 1. readCN : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::sendNodeAttributeRemoved → NO_COVERAGE
				sendNodeAttributeRemoved(graphName, tag, key);
226
			else
227 1 1. readCN : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::sendNodeAttributeChanged → NO_COVERAGE
				sendNodeAttributeChanged(graphName, tag, key, null, value);
228
		}
229
230 1 1. readCN : negated conditional → NO_COVERAGE
		if (eatEolOrEof() == StreamTokenizer.TT_EOF)
231 1 1. readCN : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::pushBack → NO_COVERAGE
			pushBack();
232
	}
233
234
	protected void readCG() throws IOException {
235 1 1. readCG : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::readAttributes → NO_COVERAGE
		readAttributes(attributes);
236
237 1 1. readCG : negated conditional → NO_COVERAGE
		for (String key : attributes.keySet()) {
238
			Object value = attributes.get(key);
239
240 1 1. readCG : negated conditional → NO_COVERAGE
			if (value == null)
241 1 1. readCG : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::sendGraphAttributeRemoved → NO_COVERAGE
				sendGraphAttributeRemoved(graphName, key);
242
			else
243 1 1. readCG : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::sendGraphAttributeChanged → NO_COVERAGE
				sendGraphAttributeChanged(graphName, key, null, value);
244
		}
245
246 1 1. readCG : negated conditional → NO_COVERAGE
		if (eatEolOrEof() == StreamTokenizer.TT_EOF)
247 1 1. readCG : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::pushBack → NO_COVERAGE
			pushBack();
248
	}
249
250
	protected void readAE() throws IOException {
251
		int dir = 0;
252
		boolean directed = false;
253
		String dirc = null;
254
		String tag = null;
255
		String fromTag = null;
256
		String toTag = null;
257
258
		tag = getStringOrWordOrNumber();
259
		fromTag = getStringOrWordOrNumber();
260
		dirc = getWordOrSymbolOrNumberOrStringOrEolOrEof();
261
262 1 1. readAE : negated conditional → NO_COVERAGE
		if (dirc.equals(">")) {
263
			directed = true;
264
			dir = 1;
265 1 1. readAE : negated conditional → NO_COVERAGE
		} else if (dirc.equals("<")) {
266
			directed = true;
267
			dir = 2;
268
		} else {
269 1 1. readAE : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::pushBack → NO_COVERAGE
			pushBack();
270
		}
271
272
		toTag = getStringOrWordOrNumber();
273
274 1 1. readAE : negated conditional → NO_COVERAGE
		if (dir == 2) {
275
			String tmp = toTag;
276
			toTag = fromTag;
277
			fromTag = tmp;
278
		}
279
280 1 1. readAE : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::readAttributes → NO_COVERAGE
		readAttributes(attributes);
281 1 1. readAE : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::sendEdgeAdded → NO_COVERAGE
		sendEdgeAdded(graphName, tag, fromTag, toTag, directed);
282
283 1 1. readAE : negated conditional → NO_COVERAGE
		for (String key : attributes.keySet()) {
284
			Object value = attributes.get(key);
285 1 1. readAE : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::sendEdgeAttributeAdded → NO_COVERAGE
			sendEdgeAttributeAdded(graphName, tag, key, value);
286
		}
287
288 1 1. readAE : negated conditional → NO_COVERAGE
		if (eatEolOrEof() == StreamTokenizer.TT_EOF)
289 1 1. readAE : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::pushBack → NO_COVERAGE
			pushBack();
290
	}
291
292
	protected void readAN() throws IOException {
293
		String tag = getStringOrWordOrNumber();
294
295 1 1. readAN : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::readAttributes → NO_COVERAGE
		readAttributes(attributes);
296
297 1 1. readAN : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::sendNodeAdded → NO_COVERAGE
		sendNodeAdded(graphName, tag);
298
299 1 1. readAN : negated conditional → NO_COVERAGE
		for (String key : attributes.keySet()) {
300
			Object value = attributes.get(key);
301 1 1. readAN : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::sendNodeAttributeAdded → NO_COVERAGE
			sendNodeAttributeAdded(graphName, tag, key, value);
302
		}
303
304 1 1. readAN : negated conditional → NO_COVERAGE
		if (eatEolOrEof() == StreamTokenizer.TT_EOF)
305 1 1. readAN : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::pushBack → NO_COVERAGE
			pushBack();
306
	}
307
308
	protected void readDE() throws IOException {
309
		String tag = getStringOrWordOrNumber();
310
311 1 1. readDE : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::sendEdgeRemoved → NO_COVERAGE
		sendEdgeRemoved(graphName, tag);
312
313 1 1. readDE : negated conditional → NO_COVERAGE
		if (eatEolOrEof() == StreamTokenizer.TT_EOF)
314 1 1. readDE : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::pushBack → NO_COVERAGE
			pushBack();
315
	}
316
317
	protected void readDN() throws IOException {
318
		String tag = getStringOrWordOrNumber();
319
320 1 1. readDN : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::sendNodeRemoved → NO_COVERAGE
		sendNodeRemoved(graphName, tag);
321
322 1 1. readDN : negated conditional → NO_COVERAGE
		if (eatEolOrEof() == StreamTokenizer.TT_EOF)
323 1 1. readDN : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::pushBack → NO_COVERAGE
			pushBack();
324
	}
325
326
	protected void readST() throws IOException {
327
		String w = getWordOrNumber();
328
329
		try {
330
			double time = Double.parseDouble(w);
331
332 1 1. readST : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::sendStepBegins → NO_COVERAGE
			sendStepBegins(graphName, time);
333
		} catch (NumberFormatException e) {
334 1 1. readST : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::parseError → NO_COVERAGE
			parseError("expecting a number after `st', got `" + w + "'");
335
		}
336
337 1 1. readST : negated conditional → NO_COVERAGE
		if (eatEolOrEof() == StreamTokenizer.TT_EOF)
338 1 1. readST : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::pushBack → NO_COVERAGE
			pushBack();
339
	}
340
341
	protected void readAttributes(HashMap<String, Object> attributes)
342
			throws IOException {
343
		boolean del = false;
344
		String key = getWordOrSymbolOrStringOrEolOrEof();
345
346 1 1. readAttributes : removed call to java/util/HashMap::clear → NO_COVERAGE
		attributes.clear();
347
348 1 1. readAttributes : negated conditional → NO_COVERAGE
		if (key.equals("-")) {
349
			key = getWordOrSymbolOrStringOrEolOrEof();
350
			del = true;
351
		}
352
353 1 1. readAttributes : negated conditional → NO_COVERAGE
		if (key.equals("+"))
354
			key = getWordOrSymbolOrStringOrEolOrEof();
355
356 3 1. readAttributes : negated conditional → NO_COVERAGE
2. readAttributes : negated conditional → NO_COVERAGE
3. readAttributes : negated conditional → NO_COVERAGE
		while (!key.equals("EOF") && !key.equals("EOL") && !key.equals("]")) {
357 1 1. readAttributes : negated conditional → NO_COVERAGE
			if (del)
358
				attributes.put(key, null);
359
			else
360
				attributes.put(key, readAttributeValue(key));
361
362
			key = getWordOrSymbolOrStringOrEolOrEof();
363
364 1 1. readAttributes : negated conditional → NO_COVERAGE
			if (key.equals("-")) {
365
				key = getWordOrStringOrEolOrEof();
366
				del = true;
367
			}
368
369 1 1. readAttributes : negated conditional → NO_COVERAGE
			if (key.equals("+")) {
370
				key = getWordOrStringOrEolOrEof();
371
				del = false;
372
			}
373
		}
374
375 1 1. readAttributes : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::pushBack → NO_COVERAGE
		pushBack();
376
	}
377
378
	/**
379
	 * Read an attribute. The "key" (attribute name) is already read.
380
	 * 
381
	 * @param key
382
	 *            The attribute name, already read.
383
	 */
384
	protected Object readAttributeValue(String key) throws IOException {
385
		ArrayList<Object> vector = null;
386
		Object value = null;
387
		Object value2 = null;
388
		String next = null;
389
390 1 1. readAttributeValue : negated conditional → NO_COVERAGE
		if (key != null)
391
			eatSymbols(":=");
392
393
		value = getStringOrWordOrSymbolOrNumberO();
394
395 1 1. readAttributeValue : negated conditional → NO_COVERAGE
		if (value.equals("[")) {
396
			HashMap<String, Object> map = new HashMap<String, Object>();
397
398 1 1. readAttributeValue : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::readAttributes → NO_COVERAGE
			readAttributes(map);
399
			;
400 1 1. readAttributeValue : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::eatSymbol → NO_COVERAGE
			eatSymbol(']');
401
402
			value = map;
403 1 1. readAttributeValue : negated conditional → NO_COVERAGE
		} else if (value.equals("{")) {
404
			vector = readAttributeArray(key);
405 1 1. readAttributeValue : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::eatSymbol → NO_COVERAGE
			eatSymbol('}');
406
		} else {
407 1 1. readAttributeValue : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::pushBack → NO_COVERAGE
			pushBack();
408
409
			value = getStringOrWordOrNumberO();
410
411 1 1. readAttributeValue : negated conditional → NO_COVERAGE
			if (key != null) {
412
				next = getWordOrSymbolOrNumberOrStringOrEolOrEof();
413
414 1 1. readAttributeValue : negated conditional → NO_COVERAGE
				while (next.equals(",")) {
415 1 1. readAttributeValue : negated conditional → NO_COVERAGE
					if (vector == null) {
416
						vector = new ArrayList<Object>();
417
						vector.add(value);
418
					}
419
420
					value2 = getStringOrWordOrNumberO();
421
					next = getWordOrSymbolOrNumberOrStringOrEolOrEof();
422
423
					vector.add(value2);
424
				}
425
426 1 1. readAttributeValue : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::pushBack → NO_COVERAGE
				pushBack();
427
			}
428
		}
429
430 1 1. readAttributeValue : negated conditional → NO_COVERAGE
		if (vector != null)
431 1 1. readAttributeValue : mutated return of Object value for org/graphstream/stream/file/dgs/OldFileSourceDGS::readAttributeValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
			return vector.toArray();
432
		else
433 1 1. readAttributeValue : mutated return of Object value for org/graphstream/stream/file/dgs/OldFileSourceDGS::readAttributeValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
			return value;
434
	}
435
436
	/**
437
	 * Read a list of values.
438
	 * 
439
	 * @param key
440
	 *            attribute key
441
	 * @return a vector
442
	 * @throws IOException
443
	 */
444
	protected ArrayList<Object> readAttributeArray(String key)
445
			throws IOException {
446
		ArrayList<Object> list = new ArrayList<Object>();
447
448
		Object value;
449
		String next;
450
451
		do {
452
			value = readAttributeValue(null);
453
			next = getWordOrSymbolOrNumberOrStringOrEolOrEof();
454
455
			list.add(value);
456 1 1. readAttributeArray : negated conditional → NO_COVERAGE
		} while (next.equals(","));
457
458 1 1. readAttributeArray : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::pushBack → NO_COVERAGE
		pushBack();
459
460 1 1. readAttributeArray : mutated return of Object value for org/graphstream/stream/file/dgs/OldFileSourceDGS::readAttributeArray to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
		return list;
461
	}
462
463
	// Command -- Basic parsing
464
465
	@Override
466
	public void begin(String filename) throws IOException {
467 1 1. begin : removed call to org/graphstream/stream/file/FileSourceBase::begin → NO_COVERAGE
		super.begin(filename);
468 1 1. begin : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::begin → NO_COVERAGE
		begin();
469
	}
470
471
	@Override
472
	public void begin(URL url) throws IOException {
473 1 1. begin : removed call to org/graphstream/stream/file/FileSourceBase::begin → NO_COVERAGE
		super.begin(url);
474 1 1. begin : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::begin → NO_COVERAGE
		begin();
475
	}
476
477
	@Override
478
	public void begin(InputStream stream) throws IOException {
479 1 1. begin : removed call to org/graphstream/stream/file/FileSourceBase::begin → NO_COVERAGE
		super.begin(stream);
480 1 1. begin : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::begin → NO_COVERAGE
		begin();
481
	}
482
483
	@Override
484
	public void begin(Reader reader) throws IOException {
485 1 1. begin : removed call to org/graphstream/stream/file/FileSourceBase::begin → NO_COVERAGE
		super.begin(reader);
486 1 1. begin : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::begin → NO_COVERAGE
		begin();
487
	}
488
489
	protected void begin() throws IOException {
490 1 1. begin : removed call to java/io/StreamTokenizer::parseNumbers → NO_COVERAGE
		st.parseNumbers();
491 1 1. begin : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::eatWords → NO_COVERAGE
		eatWords("DGS003", "DGS004");
492
493
		version = 3;
494
495 1 1. begin : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::eatEol → NO_COVERAGE
		eatEol();
496
		graphName = getWordOrString();
497
		stepCountAnnounced = (int) getNumber();// Integer.parseInt( getWord() );
498
		eventCountAnnounced = (int) getNumber();// Integer.parseInt( getWord()
499
												// );
500 1 1. begin : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::eatEol → NO_COVERAGE
		eatEol();
501
502 1 1. begin : negated conditional → NO_COVERAGE
		if (graphName != null)
503 1 1. begin : removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::sendGraphAttributeAdded → NO_COVERAGE
			sendGraphAttributeAdded(graphName, "label", graphName);
504
		else
505
			graphName = "DGS_";
506
507
		graphName = String.format("%s_%d", graphName,
508 2 1. begin : Replaced long multiplication with division → NO_COVERAGE
2. begin : Replaced long addition with subtraction → NO_COVERAGE
				System.currentTimeMillis() + ((long) Math.random() * 10));
509
	}
510
511
	@Override
512
	protected void continueParsingInInclude() throws IOException {
513
	}
514
515
	@Override
516
	protected Reader createReaderFrom(String file) throws FileNotFoundException {
517
		InputStream is = null;
518
519
		is = new FileInputStream(file);
520
521 1 1. createReaderFrom : negated conditional → NO_COVERAGE
		if (is.markSupported())
522 1 1. createReaderFrom : removed call to java/io/InputStream::mark → NO_COVERAGE
			is.mark(128);
523
524
		try {
525
			is = new GZIPInputStream(is);
526
		} catch (IOException e1) {
527
			//
528
			// This is not a gzip input.
529
			// But gzip has eat some bytes so we reset the stream
530
			// or close and open it again.
531
			//
532 1 1. createReaderFrom : negated conditional → NO_COVERAGE
			if (is.markSupported()) {
533
				try {
534 1 1. createReaderFrom : removed call to java/io/InputStream::reset → NO_COVERAGE
					is.reset();
535
				} catch (IOException e2) {
536
					//
537
					// Dirty but we hope do not get there
538
					//
539 1 1. createReaderFrom : removed call to java/io/IOException::printStackTrace → NO_COVERAGE
					e2.printStackTrace();
540
				}
541
			} else {
542
				try {
543 1 1. createReaderFrom : removed call to java/io/InputStream::close → NO_COVERAGE
					is.close();
544
				} catch (IOException e2) {
545
					//
546
					// Dirty but we hope do not get there
547
					//
548 1 1. createReaderFrom : removed call to java/io/IOException::printStackTrace → NO_COVERAGE
					e2.printStackTrace();
549
				}
550
				
551
				is = new FileInputStream(file);
552
			}
553
		}
554
555 1 1. createReaderFrom : mutated return of Object value for org/graphstream/stream/file/dgs/OldFileSourceDGS::createReaderFrom to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
		return new BufferedReader(new InputStreamReader(is));
556
	}
557
558
	@Override
559
	protected Reader createReaderFrom(InputStream stream) {
560 1 1. createReaderFrom : mutated return of Object value for org/graphstream/stream/file/dgs/OldFileSourceDGS::createReaderFrom to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
		return new BufferedReader(new InputStreamReader(stream));
561
	}
562
563
	@Override
564
	protected void configureTokenizer(StreamTokenizer tok) throws IOException {
565 2 1. configureTokenizer : changed conditional boundary → NO_COVERAGE
2. configureTokenizer : negated conditional → NO_COVERAGE
		if (COMMENT_CHAR > 0)
566 1 1. configureTokenizer : removed call to java/io/StreamTokenizer::commentChar → NO_COVERAGE
			tok.commentChar(COMMENT_CHAR);
567
		// tok.quoteChar( QUOTE_CHAR );
568 1 1. configureTokenizer : removed call to java/io/StreamTokenizer::eolIsSignificant → NO_COVERAGE
		tok.eolIsSignificant(eol_is_significant);
569 1 1. configureTokenizer : removed call to java/io/StreamTokenizer::parseNumbers → NO_COVERAGE
		tok.parseNumbers();
570 1 1. configureTokenizer : removed call to java/io/StreamTokenizer::wordChars → NO_COVERAGE
		tok.wordChars('_', '_');
571
	}
572
}

Mutations

120

1.1
Location : nextEvents
Killed by : none
negated conditional → NO_COVERAGE

121

1.1
Location : nextEvents
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

123

1.1
Location : nextEvents
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

127

1.1
Location : nextStep
Killed by : none
negated conditional → NO_COVERAGE

128

1.1
Location : nextStep
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

130

1.1
Location : nextStep
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

154

1.1
Location : next
Killed by : none
negated conditional → NO_COVERAGE

155

1.1
Location : next
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::readCE → NO_COVERAGE

156

1.1
Location : next
Killed by : none
negated conditional → NO_COVERAGE

157

1.1
Location : next
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::readCN → NO_COVERAGE

158

1.1
Location : next
Killed by : none
negated conditional → NO_COVERAGE

159

1.1
Location : next
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::readAE → NO_COVERAGE

160

1.1
Location : next
Killed by : none
negated conditional → NO_COVERAGE

161

1.1
Location : next
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::readAN → NO_COVERAGE

162

1.1
Location : next
Killed by : none
negated conditional → NO_COVERAGE

163

1.1
Location : next
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::readDE → NO_COVERAGE

164

1.1
Location : next
Killed by : none
negated conditional → NO_COVERAGE

165

1.1
Location : next
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::readDN → NO_COVERAGE

166

1.1
Location : next
Killed by : none
negated conditional → NO_COVERAGE

167

1.1
Location : next
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::readCG → NO_COVERAGE

168

1.1
Location : next
Killed by : none
negated conditional → NO_COVERAGE

169

1.1
Location : next
Killed by : none
negated conditional → NO_COVERAGE

170

1.1
Location : next
Killed by : none
negated conditional → NO_COVERAGE

172

1.1
Location : next
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::pushBack → NO_COVERAGE

175

1.1
Location : next
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::readST → NO_COVERAGE

178

1.1
Location : next
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::readST → NO_COVERAGE

180

1.1
Location : next
Killed by : none
negated conditional → NO_COVERAGE

181

1.1
Location : next
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::eatAllUntilEol → NO_COVERAGE

182

1.1
Location : next
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

183

1.1
Location : next
Killed by : none
negated conditional → NO_COVERAGE

186

1.1
Location : next
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

187

1.1
Location : next
Killed by : none
negated conditional → NO_COVERAGE

189

1.1
Location : next
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

191

1.1
Location : next
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::parseError → NO_COVERAGE

193

1.1
Location : next
Killed by : none
negated conditional → NO_COVERAGE

195

1.1
Location : next
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

201

1.1
Location : readCE
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::readAttributes → NO_COVERAGE

203

1.1
Location : readCE
Killed by : none
negated conditional → NO_COVERAGE

206

1.1
Location : readCE
Killed by : none
negated conditional → NO_COVERAGE

207

1.1
Location : readCE
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::sendEdgeAttributeRemoved → NO_COVERAGE

209

1.1
Location : readCE
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::sendEdgeAttributeChanged → NO_COVERAGE

212

1.1
Location : readCE
Killed by : none
negated conditional → NO_COVERAGE

213

1.1
Location : readCE
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::pushBack → NO_COVERAGE

219

1.1
Location : readCN
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::readAttributes → NO_COVERAGE

221

1.1
Location : readCN
Killed by : none
negated conditional → NO_COVERAGE

224

1.1
Location : readCN
Killed by : none
negated conditional → NO_COVERAGE

225

1.1
Location : readCN
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::sendNodeAttributeRemoved → NO_COVERAGE

227

1.1
Location : readCN
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::sendNodeAttributeChanged → NO_COVERAGE

230

1.1
Location : readCN
Killed by : none
negated conditional → NO_COVERAGE

231

1.1
Location : readCN
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::pushBack → NO_COVERAGE

235

1.1
Location : readCG
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::readAttributes → NO_COVERAGE

237

1.1
Location : readCG
Killed by : none
negated conditional → NO_COVERAGE

240

1.1
Location : readCG
Killed by : none
negated conditional → NO_COVERAGE

241

1.1
Location : readCG
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::sendGraphAttributeRemoved → NO_COVERAGE

243

1.1
Location : readCG
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::sendGraphAttributeChanged → NO_COVERAGE

246

1.1
Location : readCG
Killed by : none
negated conditional → NO_COVERAGE

247

1.1
Location : readCG
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::pushBack → NO_COVERAGE

262

1.1
Location : readAE
Killed by : none
negated conditional → NO_COVERAGE

265

1.1
Location : readAE
Killed by : none
negated conditional → NO_COVERAGE

269

1.1
Location : readAE
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::pushBack → NO_COVERAGE

274

1.1
Location : readAE
Killed by : none
negated conditional → NO_COVERAGE

280

1.1
Location : readAE
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::readAttributes → NO_COVERAGE

281

1.1
Location : readAE
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::sendEdgeAdded → NO_COVERAGE

283

1.1
Location : readAE
Killed by : none
negated conditional → NO_COVERAGE

285

1.1
Location : readAE
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::sendEdgeAttributeAdded → NO_COVERAGE

288

1.1
Location : readAE
Killed by : none
negated conditional → NO_COVERAGE

289

1.1
Location : readAE
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::pushBack → NO_COVERAGE

295

1.1
Location : readAN
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::readAttributes → NO_COVERAGE

297

1.1
Location : readAN
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::sendNodeAdded → NO_COVERAGE

299

1.1
Location : readAN
Killed by : none
negated conditional → NO_COVERAGE

301

1.1
Location : readAN
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::sendNodeAttributeAdded → NO_COVERAGE

304

1.1
Location : readAN
Killed by : none
negated conditional → NO_COVERAGE

305

1.1
Location : readAN
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::pushBack → NO_COVERAGE

311

1.1
Location : readDE
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::sendEdgeRemoved → NO_COVERAGE

313

1.1
Location : readDE
Killed by : none
negated conditional → NO_COVERAGE

314

1.1
Location : readDE
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::pushBack → NO_COVERAGE

320

1.1
Location : readDN
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::sendNodeRemoved → NO_COVERAGE

322

1.1
Location : readDN
Killed by : none
negated conditional → NO_COVERAGE

323

1.1
Location : readDN
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::pushBack → NO_COVERAGE

332

1.1
Location : readST
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::sendStepBegins → NO_COVERAGE

334

1.1
Location : readST
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::parseError → NO_COVERAGE

337

1.1
Location : readST
Killed by : none
negated conditional → NO_COVERAGE

338

1.1
Location : readST
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::pushBack → NO_COVERAGE

346

1.1
Location : readAttributes
Killed by : none
removed call to java/util/HashMap::clear → NO_COVERAGE

348

1.1
Location : readAttributes
Killed by : none
negated conditional → NO_COVERAGE

353

1.1
Location : readAttributes
Killed by : none
negated conditional → NO_COVERAGE

356

1.1
Location : readAttributes
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : readAttributes
Killed by : none
negated conditional → NO_COVERAGE

3.3
Location : readAttributes
Killed by : none
negated conditional → NO_COVERAGE

357

1.1
Location : readAttributes
Killed by : none
negated conditional → NO_COVERAGE

364

1.1
Location : readAttributes
Killed by : none
negated conditional → NO_COVERAGE

369

1.1
Location : readAttributes
Killed by : none
negated conditional → NO_COVERAGE

375

1.1
Location : readAttributes
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::pushBack → NO_COVERAGE

390

1.1
Location : readAttributeValue
Killed by : none
negated conditional → NO_COVERAGE

395

1.1
Location : readAttributeValue
Killed by : none
negated conditional → NO_COVERAGE

398

1.1
Location : readAttributeValue
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::readAttributes → NO_COVERAGE

400

1.1
Location : readAttributeValue
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::eatSymbol → NO_COVERAGE

403

1.1
Location : readAttributeValue
Killed by : none
negated conditional → NO_COVERAGE

405

1.1
Location : readAttributeValue
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::eatSymbol → NO_COVERAGE

407

1.1
Location : readAttributeValue
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::pushBack → NO_COVERAGE

411

1.1
Location : readAttributeValue
Killed by : none
negated conditional → NO_COVERAGE

414

1.1
Location : readAttributeValue
Killed by : none
negated conditional → NO_COVERAGE

415

1.1
Location : readAttributeValue
Killed by : none
negated conditional → NO_COVERAGE

426

1.1
Location : readAttributeValue
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::pushBack → NO_COVERAGE

430

1.1
Location : readAttributeValue
Killed by : none
negated conditional → NO_COVERAGE

431

1.1
Location : readAttributeValue
Killed by : none
mutated return of Object value for org/graphstream/stream/file/dgs/OldFileSourceDGS::readAttributeValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

433

1.1
Location : readAttributeValue
Killed by : none
mutated return of Object value for org/graphstream/stream/file/dgs/OldFileSourceDGS::readAttributeValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

456

1.1
Location : readAttributeArray
Killed by : none
negated conditional → NO_COVERAGE

458

1.1
Location : readAttributeArray
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::pushBack → NO_COVERAGE

460

1.1
Location : readAttributeArray
Killed by : none
mutated return of Object value for org/graphstream/stream/file/dgs/OldFileSourceDGS::readAttributeArray to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

467

1.1
Location : begin
Killed by : none
removed call to org/graphstream/stream/file/FileSourceBase::begin → NO_COVERAGE

468

1.1
Location : begin
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::begin → NO_COVERAGE

473

1.1
Location : begin
Killed by : none
removed call to org/graphstream/stream/file/FileSourceBase::begin → NO_COVERAGE

474

1.1
Location : begin
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::begin → NO_COVERAGE

479

1.1
Location : begin
Killed by : none
removed call to org/graphstream/stream/file/FileSourceBase::begin → NO_COVERAGE

480

1.1
Location : begin
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::begin → NO_COVERAGE

485

1.1
Location : begin
Killed by : none
removed call to org/graphstream/stream/file/FileSourceBase::begin → NO_COVERAGE

486

1.1
Location : begin
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::begin → NO_COVERAGE

490

1.1
Location : begin
Killed by : none
removed call to java/io/StreamTokenizer::parseNumbers → NO_COVERAGE

491

1.1
Location : begin
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::eatWords → NO_COVERAGE

495

1.1
Location : begin
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::eatEol → NO_COVERAGE

500

1.1
Location : begin
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::eatEol → NO_COVERAGE

502

1.1
Location : begin
Killed by : none
negated conditional → NO_COVERAGE

503

1.1
Location : begin
Killed by : none
removed call to org/graphstream/stream/file/dgs/OldFileSourceDGS::sendGraphAttributeAdded → NO_COVERAGE

508

1.1
Location : begin
Killed by : none
Replaced long multiplication with division → NO_COVERAGE

2.2
Location : begin
Killed by : none
Replaced long addition with subtraction → NO_COVERAGE

521

1.1
Location : createReaderFrom
Killed by : none
negated conditional → NO_COVERAGE

522

1.1
Location : createReaderFrom
Killed by : none
removed call to java/io/InputStream::mark → NO_COVERAGE

532

1.1
Location : createReaderFrom
Killed by : none
negated conditional → NO_COVERAGE

534

1.1
Location : createReaderFrom
Killed by : none
removed call to java/io/InputStream::reset → NO_COVERAGE

539

1.1
Location : createReaderFrom
Killed by : none
removed call to java/io/IOException::printStackTrace → NO_COVERAGE

543

1.1
Location : createReaderFrom
Killed by : none
removed call to java/io/InputStream::close → NO_COVERAGE

548

1.1
Location : createReaderFrom
Killed by : none
removed call to java/io/IOException::printStackTrace → NO_COVERAGE

555

1.1
Location : createReaderFrom
Killed by : none
mutated return of Object value for org/graphstream/stream/file/dgs/OldFileSourceDGS::createReaderFrom to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

560

1.1
Location : createReaderFrom
Killed by : none
mutated return of Object value for org/graphstream/stream/file/dgs/OldFileSourceDGS::createReaderFrom to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

565

1.1
Location : configureTokenizer
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : configureTokenizer
Killed by : none
negated conditional → NO_COVERAGE

566

1.1
Location : configureTokenizer
Killed by : none
removed call to java/io/StreamTokenizer::commentChar → NO_COVERAGE

568

1.1
Location : configureTokenizer
Killed by : none
removed call to java/io/StreamTokenizer::eolIsSignificant → NO_COVERAGE

569

1.1
Location : configureTokenizer
Killed by : none
removed call to java/io/StreamTokenizer::parseNumbers → NO_COVERAGE

570

1.1
Location : configureTokenizer
Killed by : none
removed call to java/io/StreamTokenizer::wordChars → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 0.33