Timeline.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;
33
34
import java.util.Iterator;
35
import java.util.TreeSet;
36
37
public class Timeline extends SourceBase implements Sink {
38
39
	public static final String TIME_PREFIX = "time";
40
41
	protected TreeSet<Event> events;
42
	protected boolean changed;
43
	protected long currentDate;
44
	protected int currentEvent;
45
46
	public Timeline() {
47
		this.events = new TreeSet<Event>();
48
		this.changed = false;
49
		this.currentDate = 0;
50
		this.currentEvent = 0;
51
	}
52
53
	private void insert(Event e) {
54
		events.add(e);
55
	}
56
57
	public void reset() {
58
		currentEvent = 0;
59 1 1. reset : removed call to java/util/TreeSet::clear → NO_COVERAGE
		events.clear();
60
	}
61
62
	public boolean next() {
63 1 1. next : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
		return false;
64
	}
65
	
66
	public void play(long dateFrom, long dateTo) {
67
		long timeId;
68
		Iterator<Event> it;
69
		Event e;
70
71 2 1. play : changed conditional boundary → NO_COVERAGE
2. play : negated conditional → NO_COVERAGE
		if (dateFrom < dateTo)
72
			it = events.iterator();
73
		else {
74
			timeId = dateTo;
75
			dateTo = dateFrom;
76
			dateFrom = timeId;
77
			it = events.descendingIterator();
78
		}
79
80
		timeId = 0;
81
82 1 1. play : negated conditional → NO_COVERAGE
		while (it.hasNext()) {
83
			e = it.next();
84
85 4 1. play : changed conditional boundary → NO_COVERAGE
2. play : changed conditional boundary → NO_COVERAGE
3. play : negated conditional → NO_COVERAGE
4. play : negated conditional → NO_COVERAGE
			if (e.date >= dateFrom && e.date <= dateTo)
86 2 1. play : Replaced long addition with subtraction → NO_COVERAGE
2. play : removed call to org/graphstream/stream/Timeline$Event::doEvent → NO_COVERAGE
				e.doEvent(timeId++);
87
		}
88
	}
89
90
	public void playAll() {
91 1 1. playAll : removed call to org/graphstream/stream/Timeline::play → NO_COVERAGE
		play(events.first().date, events.last().date);
92
	}
93
94
	public void addNodeAt(long date, String nodeId) {
95 1 1. addNodeAt : removed call to org/graphstream/stream/Timeline::insert → NO_COVERAGE
		insert(new NodeAdded(date, nodeId));
96
	}
97
98
	public void removeNodeAt(long date, String nodeId) {
99 1 1. removeNodeAt : removed call to org/graphstream/stream/Timeline::insert → NO_COVERAGE
		insert(new NodeRemoved(date, nodeId));
100
	}
101
102
	public void addEdgeAt(long date, String edgeId, String source,
103
			String target, boolean directed) {
104 1 1. addEdgeAt : removed call to org/graphstream/stream/Timeline::insert → NO_COVERAGE
		insert(new EdgeAdded(date, edgeId, source, target, directed));
105
	}
106
107
	public void removeEdgeAt(long date, String edgeId) {
108 1 1. removeEdgeAt : removed call to org/graphstream/stream/Timeline::insert → NO_COVERAGE
		insert(new EdgeRemoved(date, edgeId));
109
	}
110
111
	public void addNodeAttributeAt(long date, String nodeId,
112
			String attributeId, Object value) {
113 1 1. addNodeAttributeAt : removed call to org/graphstream/stream/Timeline::insert → NO_COVERAGE
		insert(new AttributeAdded(date, ElementType.NODE, nodeId, attributeId,
114
				value));
115
	}
116
117
	public void addEdgeAttributeAt(long date, String edgeId,
118
			String attributeId, Object value) {
119 1 1. addEdgeAttributeAt : removed call to org/graphstream/stream/Timeline::insert → NO_COVERAGE
		insert(new AttributeAdded(date, ElementType.EDGE, edgeId, attributeId,
120
				value));
121
	}
122
123
	public void addGraphAttributeAt(long date, String attributeId, Object value) {
124 1 1. addGraphAttributeAt : removed call to org/graphstream/stream/Timeline::insert → NO_COVERAGE
		insert(new AttributeAdded(date, ElementType.GRAPH, null, attributeId,
125
				value));
126
	}
127
128
	public void changeNodeAttributeAt(long date, String nodeId,
129
			String attributeId, Object oldValue, Object newValue) {
130 1 1. changeNodeAttributeAt : removed call to org/graphstream/stream/Timeline::insert → NO_COVERAGE
		insert(new AttributeChanged(date, ElementType.NODE, nodeId,
131
				attributeId, oldValue, newValue));
132
	}
133
134
	public void changeEdgeAttributeAt(long date, String edgeId,
135
			String attributeId, Object oldValue, Object newValue) {
136 1 1. changeEdgeAttributeAt : removed call to org/graphstream/stream/Timeline::insert → NO_COVERAGE
		insert(new AttributeChanged(date, ElementType.EDGE, edgeId,
137
				attributeId, oldValue, newValue));
138
	}
139
140
	public void changeGraphAttributeAt(long date, String attributeId,
141
			Object oldValue, Object newValue) {
142 1 1. changeGraphAttributeAt : removed call to org/graphstream/stream/Timeline::insert → NO_COVERAGE
		insert(new AttributeChanged(date, ElementType.GRAPH, null, attributeId,
143
				oldValue, newValue));
144
	}
145
146
	public void removeNodeAttributeAt(long date, String nodeId,
147
			String attributeId) {
148 1 1. removeNodeAttributeAt : removed call to org/graphstream/stream/Timeline::insert → NO_COVERAGE
		insert(new AttributeRemoved(date, ElementType.NODE, nodeId, attributeId));
149
	}
150
151
	public void removeEdgeAttributeAt(long date, String edgeId,
152
			String attributeId) {
153 1 1. removeEdgeAttributeAt : removed call to org/graphstream/stream/Timeline::insert → NO_COVERAGE
		insert(new AttributeRemoved(date, ElementType.EDGE, edgeId, attributeId));
154
	}
155
156
	public void removeGraphAttributeAt(long date, String attributeId) {
157 1 1. removeGraphAttributeAt : removed call to org/graphstream/stream/Timeline::insert → NO_COVERAGE
		insert(new AttributeRemoved(date, ElementType.GRAPH, null, attributeId));
158
	}
159
160
	public void stepBeginsAt(long date, double step) {
161 1 1. stepBeginsAt : removed call to org/graphstream/stream/Timeline::insert → NO_COVERAGE
		insert(new StepBegins(date, step));
162
	}
163
164
	public void clearGraphAt(long date) {
165 1 1. clearGraphAt : removed call to org/graphstream/stream/Timeline::insert → NO_COVERAGE
		insert(new GraphCleared(date));
166
	}
167
168
	protected void handleTimeAttribute(boolean delete, String key, Object value) {
169
		TimeAction action;
170
171 1 1. handleTimeAttribute : Replaced integer addition with subtraction → NO_COVERAGE
		action = TimeAction.valueOf(key.substring(TIME_PREFIX.length() + 1)
172
				.toUpperCase());
173
174
		switch (action) {
175
		case FORMAT:
176
		case SET:
177
		}
178
	}
179
180
	/*
181
	 * (non-Javadoc)
182
	 * 
183
	 * @see
184
	 * org.graphstream.stream.AttributeSink#edgeAttributeAdded(java.lang.String,
185
	 * long, java.lang.String, java.lang.String, java.lang.Object)
186
	 */
187
	public void edgeAttributeAdded(String sourceId, long timeId, String edgeId,
188
			String attribute, Object value) {
189 1 1. edgeAttributeAdded : removed call to org/graphstream/stream/Timeline::addEdgeAttributeAt → NO_COVERAGE
		addEdgeAttributeAt(currentDate, edgeId, attribute, value);
190
	}
191
192
	/*
193
	 * (non-Javadoc)
194
	 * 
195
	 * @see
196
	 * org.graphstream.stream.AttributeSink#edgeAttributeChanged(java.lang.String
197
	 * , long, java.lang.String, java.lang.String, java.lang.Object,
198
	 * java.lang.Object)
199
	 */
200
	public void edgeAttributeChanged(String sourceId, long timeId,
201
			String edgeId, String attribute, Object oldValue, Object newValue) {
202 1 1. edgeAttributeChanged : removed call to org/graphstream/stream/Timeline::changeEdgeAttributeAt → NO_COVERAGE
		changeEdgeAttributeAt(currentDate, edgeId, attribute, oldValue,
203
				newValue);
204
	}
205
206
	/*
207
	 * (non-Javadoc)
208
	 * 
209
	 * @see
210
	 * org.graphstream.stream.AttributeSink#edgeAttributeRemoved(java.lang.String
211
	 * , long, java.lang.String, java.lang.String)
212
	 */
213
	public void edgeAttributeRemoved(String sourceId, long timeId,
214
			String edgeId, String attribute) {
215 1 1. edgeAttributeRemoved : removed call to org/graphstream/stream/Timeline::removeEdgeAttributeAt → NO_COVERAGE
		removeEdgeAttributeAt(currentDate, edgeId, attribute);
216
	}
217
218
	/*
219
	 * (non-Javadoc)
220
	 * 
221
	 * @see
222
	 * org.graphstream.stream.AttributeSink#graphAttributeAdded(java.lang.String
223
	 * , long, java.lang.String, java.lang.Object)
224
	 */
225
	public void graphAttributeAdded(String sourceId, long timeId,
226
			String attribute, Object value) {
227 1 1. graphAttributeAdded : negated conditional → NO_COVERAGE
		if (attribute.startsWith(TIME_PREFIX + "."))
228 1 1. graphAttributeAdded : removed call to org/graphstream/stream/Timeline::handleTimeAttribute → NO_COVERAGE
			handleTimeAttribute(false, attribute, value);
229
230 1 1. graphAttributeAdded : removed call to org/graphstream/stream/Timeline::addGraphAttributeAt → NO_COVERAGE
		addGraphAttributeAt(currentDate, attribute, value);
231
	}
232
233
	/*
234
	 * (non-Javadoc)
235
	 * 
236
	 * @see
237
	 * org.graphstream.stream.AttributeSink#graphAttributeChanged(java.lang.
238
	 * String, long, java.lang.String, java.lang.Object, java.lang.Object)
239
	 */
240
	public void graphAttributeChanged(String sourceId, long timeId,
241
			String attribute, Object oldValue, Object newValue) {
242 1 1. graphAttributeChanged : negated conditional → NO_COVERAGE
		if (attribute.startsWith(TIME_PREFIX + "."))
243 1 1. graphAttributeChanged : removed call to org/graphstream/stream/Timeline::handleTimeAttribute → NO_COVERAGE
			handleTimeAttribute(false, attribute, newValue);
244
245 1 1. graphAttributeChanged : removed call to org/graphstream/stream/Timeline::changeGraphAttributeAt → NO_COVERAGE
		changeGraphAttributeAt(currentDate, attribute, oldValue, newValue);
246
	}
247
248
	/*
249
	 * (non-Javadoc)
250
	 * 
251
	 * @see
252
	 * org.graphstream.stream.AttributeSink#graphAttributeRemoved(java.lang.
253
	 * String, long, java.lang.String)
254
	 */
255
	public void graphAttributeRemoved(String sourceId, long timeId,
256
			String attribute) {
257 1 1. graphAttributeRemoved : negated conditional → NO_COVERAGE
		if (attribute.startsWith(TIME_PREFIX + "."))
258 1 1. graphAttributeRemoved : removed call to org/graphstream/stream/Timeline::handleTimeAttribute → NO_COVERAGE
			handleTimeAttribute(true, attribute, null);
259
260 1 1. graphAttributeRemoved : removed call to org/graphstream/stream/Timeline::removeGraphAttributeAt → NO_COVERAGE
		removeGraphAttributeAt(currentDate, attribute);
261
	}
262
263
	/*
264
	 * (non-Javadoc)
265
	 * 
266
	 * @see
267
	 * org.graphstream.stream.AttributeSink#nodeAttributeAdded(java.lang.String,
268
	 * long, java.lang.String, java.lang.String, java.lang.Object)
269
	 */
270
	public void nodeAttributeAdded(String sourceId, long timeId, String nodeId,
271
			String attribute, Object value) {
272 1 1. nodeAttributeAdded : removed call to org/graphstream/stream/Timeline::addNodeAttributeAt → NO_COVERAGE
		addNodeAttributeAt(currentDate, nodeId, attribute, value);
273
	}
274
275
	/*
276
	 * (non-Javadoc)
277
	 * 
278
	 * @see
279
	 * org.graphstream.stream.AttributeSink#nodeAttributeChanged(java.lang.String
280
	 * , long, java.lang.String, java.lang.String, java.lang.Object,
281
	 * java.lang.Object)
282
	 */
283
	public void nodeAttributeChanged(String sourceId, long timeId,
284
			String nodeId, String attribute, Object oldValue, Object newValue) {
285 1 1. nodeAttributeChanged : removed call to org/graphstream/stream/Timeline::changeNodeAttributeAt → NO_COVERAGE
		changeNodeAttributeAt(currentDate, nodeId, attribute, oldValue,
286
				newValue);
287
	}
288
289
	/*
290
	 * (non-Javadoc)
291
	 * 
292
	 * @see
293
	 * org.graphstream.stream.AttributeSink#nodeAttributeRemoved(java.lang.String
294
	 * , long, java.lang.String, java.lang.String)
295
	 */
296
	public void nodeAttributeRemoved(String sourceId, long timeId,
297
			String nodeId, String attribute) {
298 1 1. nodeAttributeRemoved : removed call to org/graphstream/stream/Timeline::removeNodeAttributeAt → NO_COVERAGE
		removeNodeAttributeAt(currentDate, nodeId, attribute);
299
	}
300
301
	/*
302
	 * (non-Javadoc)
303
	 * 
304
	 * @see org.graphstream.stream.ElementSink#edgeAdded(java.lang.String, long,
305
	 * java.lang.String, java.lang.String, java.lang.String, boolean)
306
	 */
307
	public void edgeAdded(String sourceId, long timeId, String edgeId,
308
			String fromNodeId, String toNodeId, boolean directed) {
309 1 1. edgeAdded : removed call to org/graphstream/stream/Timeline::addEdgeAt → NO_COVERAGE
		addEdgeAt(currentDate, edgeId, fromNodeId, toNodeId, directed);
310
	}
311
312
	/*
313
	 * (non-Javadoc)
314
	 * 
315
	 * @see org.graphstream.stream.ElementSink#edgeRemoved(java.lang.String,
316
	 * long, java.lang.String)
317
	 */
318
	public void edgeRemoved(String sourceId, long timeId, String edgeId) {
319 1 1. edgeRemoved : removed call to org/graphstream/stream/Timeline::removeEdgeAt → NO_COVERAGE
		removeEdgeAt(currentDate, edgeId);
320
	}
321
322
	/*
323
	 * (non-Javadoc)
324
	 * 
325
	 * @see org.graphstream.stream.ElementSink#graphCleared(java.lang.String,
326
	 * long)
327
	 */
328
	public void graphCleared(String sourceId, long timeId) {
329 1 1. graphCleared : removed call to org/graphstream/stream/Timeline::clearGraphAt → NO_COVERAGE
		clearGraphAt(currentDate);
330
	}
331
332
	/*
333
	 * (non-Javadoc)
334
	 * 
335
	 * @see org.graphstream.stream.ElementSink#nodeAdded(java.lang.String, long,
336
	 * java.lang.String)
337
	 */
338
	public void nodeAdded(String sourceId, long timeId, String nodeId) {
339 1 1. nodeAdded : removed call to org/graphstream/stream/Timeline::addNodeAt → NO_COVERAGE
		addNodeAt(currentDate, nodeId);
340
	}
341
342
	/*
343
	 * (non-Javadoc)
344
	 * 
345
	 * @see org.graphstream.stream.ElementSink#nodeRemoved(java.lang.String,
346
	 * long, java.lang.String)
347
	 */
348
	public void nodeRemoved(String sourceId, long timeId, String nodeId) {
349 1 1. nodeRemoved : removed call to org/graphstream/stream/Timeline::removeNodeAt → NO_COVERAGE
		removeNodeAt(currentDate, nodeId);
350
	}
351
352
	/*
353
	 * (non-Javadoc)
354
	 * 
355
	 * @see org.graphstream.stream.ElementSink#stepBegins(java.lang.String,
356
	 * long, double)
357
	 */
358
	public void stepBegins(String sourceId, long timeId, double step) {
359 1 1. stepBegins : removed call to org/graphstream/stream/Timeline::stepBeginsAt → NO_COVERAGE
		stepBeginsAt(currentDate, step);
360
	}
361
362
	protected static enum ElementType {
363
		NODE, EDGE, GRAPH
364
	}
365
366
	protected abstract class Event implements Comparable<Event> {
367
		long date;
368
		int priority;
369
370
		protected Event(long date, int priority) {
371
			this.date = date;
372
		}
373
374
		abstract void doEvent(long timeId);
375
376
		abstract void reverse(long timeId);
377
378
		public int compareTo(Event e) {
379 1 1. compareTo : negated conditional → NO_COVERAGE
			if (date == e.date)
380 2 1. compareTo : Replaced integer subtraction with addition → NO_COVERAGE
2. compareTo : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
				return priority - e.priority;
381
382 2 1. compareTo : Replaced long subtraction with addition → NO_COVERAGE
2. compareTo : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
			return (int) (date - e.date);
383
		}
384
	}
385
386
	protected class NodeAdded extends Event {
387
		String nodeId;
388
389
		public NodeAdded(long timeId, String nodeId) {
390
			super(timeId, 10);
391
			this.nodeId = nodeId;
392
		}
393
394
		/*
395
		 * (non-Javadoc)
396
		 * 
397
		 * @see org.graphstream.stream.Timeline.Event#doEvent(long)
398
		 */
399
		public void doEvent(long timeId) {
400 1 1. doEvent : removed call to org/graphstream/stream/Timeline::sendNodeAdded → NO_COVERAGE
			sendNodeAdded(sourceId, timeId, nodeId);
401
		}
402
403
		/*
404
		 * (non-Javadoc)
405
		 * 
406
		 * @see org.graphstream.stream.Timeline.Event#reverse(long)
407
		 */
408
		public void reverse(long timeId) {
409 1 1. reverse : removed call to org/graphstream/stream/Timeline::sendNodeRemoved → NO_COVERAGE
			sendNodeRemoved(sourceId, timeId, nodeId);
410
		}
411
	}
412
413
	protected class NodeRemoved extends Event {
414
		String nodeId;
415
416
		public NodeRemoved(long timeId, String nodeId) {
417
			super(timeId, 4);
418
			this.nodeId = nodeId;
419
		}
420
421
		/*
422
		 * (non-Javadoc)
423
		 * 
424
		 * @see org.graphstream.stream.Timeline.Event#doEvent(long)
425
		 */
426
		public void doEvent(long timeId) {
427 1 1. doEvent : removed call to org/graphstream/stream/Timeline::sendNodeRemoved → NO_COVERAGE
			sendNodeRemoved(sourceId, timeId, nodeId);
428
		}
429
430
		/*
431
		 * (non-Javadoc)
432
		 * 
433
		 * @see org.graphstream.stream.Timeline.Event#reverse(long)
434
		 */
435
		public void reverse(long timeId) {
436 1 1. reverse : removed call to org/graphstream/stream/Timeline::sendNodeAdded → NO_COVERAGE
			sendNodeAdded(sourceId, timeId, nodeId);
437
		}
438
	}
439
440
	protected class AttributeAdded extends Event {
441
		ElementType type;
442
		String elementId;
443
		String attrId;
444
		Object value;
445
446
		public AttributeAdded(long timeId, ElementType type, String elementId,
447
				String attrId, Object value) {
448
			super(timeId, 8);
449
			this.type = type;
450
			this.elementId = elementId;
451
			this.value = value;
452
		}
453
454
		/*
455
		 * (non-Javadoc)
456
		 * 
457
		 * @see org.graphstream.stream.Timeline.Event#doEvent(long)
458
		 */
459
		public void doEvent(long timeId) {
460
			switch (type) {
461
			case NODE:
462 1 1. doEvent : removed call to org/graphstream/stream/Timeline::sendNodeAttributeAdded → NO_COVERAGE
				sendNodeAttributeAdded(sourceId, timeId, elementId, attrId,
463
						value);
464
				break;
465
			case EDGE:
466 1 1. doEvent : removed call to org/graphstream/stream/Timeline::sendEdgeAttributeAdded → NO_COVERAGE
				sendEdgeAttributeAdded(sourceId, timeId, elementId, attrId,
467
						value);
468
				break;
469
			case GRAPH:
470 1 1. doEvent : removed call to org/graphstream/stream/Timeline::sendGraphAttributeAdded → NO_COVERAGE
				sendGraphAttributeAdded(sourceId, timeId, attrId, value);
471
				break;
472
			}
473
		}
474
475
		public void reverse(long timeId) {
476
			// TODO
477
		}
478
	}
479
480
	protected class AttributeChanged extends Event {
481
		ElementType type;
482
		String elementId;
483
		String attrId;
484
		Object newValue;
485
		Object oldValue;
486
487
		public AttributeChanged(long date, ElementType type, String elementId,
488
				String attrId, Object newValue, Object oldValue) {
489
			super(date, 7);
490
491
			this.type = type;
492
			this.elementId = elementId;
493
			this.attrId = attrId;
494
			this.newValue = newValue;
495
			this.oldValue = oldValue;
496
		}
497
498
		/*
499
		 * (non-Javadoc)
500
		 * 
501
		 * @see org.graphstream.stream.Timeline.Event#doEvent(long)
502
		 */
503
		public void doEvent(long timeId) {
504
			switch (type) {
505
			case NODE:
506 1 1. doEvent : removed call to org/graphstream/stream/Timeline::sendNodeAttributeChanged → NO_COVERAGE
				sendNodeAttributeChanged(sourceId, timeId, elementId, attrId,
507
						oldValue, newValue);
508
			case EDGE:
509 1 1. doEvent : removed call to org/graphstream/stream/Timeline::sendEdgeAttributeChanged → NO_COVERAGE
				sendEdgeAttributeChanged(sourceId, timeId, elementId, attrId,
510
						oldValue, newValue);
511
				break;
512
			case GRAPH:
513 1 1. doEvent : removed call to org/graphstream/stream/Timeline::sendGraphAttributeChanged → NO_COVERAGE
				sendGraphAttributeChanged(sourceId, timeId, attrId, oldValue,
514
						newValue);
515
				break;
516
			}
517
		}
518
519
		/*
520
		 * (non-Javadoc)
521
		 * 
522
		 * @see org.graphstream.stream.Timeline.Event#reverse(long)
523
		 */
524
		public void reverse(long timeId) {
525
			// TODO
526
		}
527
	}
528
529
	protected class AttributeRemoved extends Event {
530
		ElementType type;
531
		String elementId;
532
		String attrId;
533
534
		public AttributeRemoved(long date, ElementType type, String elementId,
535
				String attrId) {
536
			super(date, 6);
537
538
			this.type = type;
539
			this.elementId = elementId;
540
		}
541
542
		/*
543
		 * (non-Javadoc)
544
		 * 
545
		 * @see org.graphstream.stream.Timeline.Event#doEvent(long)
546
		 */
547
		public void doEvent(long timeId) {
548
			switch (type) {
549
			case NODE:
550 1 1. doEvent : removed call to org/graphstream/stream/Timeline::sendNodeAttributeRemoved → NO_COVERAGE
				sendNodeAttributeRemoved(sourceId, timeId, elementId, attrId);
551
				break;
552
			case EDGE:
553 1 1. doEvent : removed call to org/graphstream/stream/Timeline::sendEdgeAttributeRemoved → NO_COVERAGE
				sendEdgeAttributeRemoved(sourceId, timeId, elementId, attrId);
554
				break;
555
			case GRAPH:
556 1 1. doEvent : removed call to org/graphstream/stream/Timeline::sendGraphAttributeRemoved → NO_COVERAGE
				sendGraphAttributeRemoved(sourceId, timeId, attrId);
557
				break;
558
			}
559
		}
560
561
		/*
562
		 * (non-Javadoc)
563
		 * 
564
		 * @see org.graphstream.stream.Timeline.Event#reverse(long)
565
		 */
566
		public void reverse(long timeId) {
567
			// TODO
568
		}
569
	}
570
571
	protected class EdgeAdded extends Event {
572
		String edgeId;
573
		String source, target;
574
		boolean directed;
575
576
		public EdgeAdded(long date, String edgeId, String source,
577
				String target, boolean directed) {
578
			super(date, 9);
579
580
			this.edgeId = edgeId;
581
			this.source = source;
582
			this.target = target;
583
			this.directed = directed;
584
		}
585
586
		/*
587
		 * (non-Javadoc)
588
		 * 
589
		 * @see org.graphstream.stream.Timeline.Event#doEvent(long)
590
		 */
591
		public void doEvent(long timeId) {
592 1 1. doEvent : removed call to org/graphstream/stream/Timeline::sendEdgeAdded → NO_COVERAGE
			sendEdgeAdded(sourceId, timeId, edgeId, source, target, directed);
593
		}
594
595
		/*
596
		 * (non-Javadoc)
597
		 * 
598
		 * @see org.graphstream.stream.Timeline.Event#reverse(long)
599
		 */
600
		public void reverse(long timeId) {
601 1 1. reverse : removed call to org/graphstream/stream/Timeline::sendEdgeRemoved → NO_COVERAGE
			sendEdgeRemoved(sourceId, timeId, edgeId);
602
		}
603
	}
604
605
	protected class EdgeRemoved extends Event {
606
		String edgeId;
607
608
		public EdgeRemoved(long date, String edgeId) {
609
			super(date, 5);
610
			this.edgeId = edgeId;
611
		}
612
613
		/*
614
		 * (non-Javadoc)
615
		 * 
616
		 * @see org.graphstream.stream.Timeline.Event#doEvent(long)
617
		 */
618
		public void doEvent(long timeId) {
619 1 1. doEvent : removed call to org/graphstream/stream/Timeline::sendEdgeRemoved → NO_COVERAGE
			sendEdgeRemoved(sourceId, timeId, edgeId);
620
		}
621
622
		/*
623
		 * (non-Javadoc)
624
		 * 
625
		 * @see org.graphstream.stream.Timeline.Event#reverse(long)
626
		 */
627
		public void reverse(long timeId) {
628
			// TODO
629
		}
630
	}
631
632
	protected class StepBegins extends Event {
633
		double step;
634
635
		public StepBegins(long date, double step) {
636
			super(date, 0);
637
			this.step = step;
638
		}
639
640
		/*
641
		 * (non-Javadoc)
642
		 * 
643
		 * @see org.graphstream.stream.Timeline.Event#doEvent(long)
644
		 */
645
		public void doEvent(long timeId) {
646 1 1. doEvent : removed call to org/graphstream/stream/Timeline::sendStepBegins → NO_COVERAGE
			sendStepBegins(sourceId, timeId, step);
647
		}
648
649
		/*
650
		 * (non-Javadoc)
651
		 * 
652
		 * @see org.graphstream.stream.Timeline.Event#reverse(long)
653
		 */
654
		public void reverse(long timeId) {
655
			// TODO
656
		}
657
	}
658
659
	protected class GraphCleared extends Event {
660
		public GraphCleared(long date) {
661
			super(date, 0);
662
		}
663
664
		/*
665
		 * (non-Javadoc)
666
		 * 
667
		 * @see org.graphstream.stream.Timeline.Event#doEvent(long)
668
		 */
669
		public void doEvent(long timeId) {
670 1 1. doEvent : removed call to org/graphstream/stream/Timeline::sendGraphCleared → NO_COVERAGE
			sendGraphCleared(sourceId, timeId);
671
		}
672
673
		/*
674
		 * (non-Javadoc)
675
		 * 
676
		 * @see org.graphstream.stream.Timeline.Event#reverse(long)
677
		 */
678
		public void reverse(long timeId) {
679
			// TODO
680
		}
681
	}
682
683
	protected static enum TimeAction {
684
		FORMAT, SET
685
	}
686
}

Mutations

59

1.1
Location : reset
Killed by : none
removed call to java/util/TreeSet::clear → NO_COVERAGE

63

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

71

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

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

82

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

85

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

2.2
Location : play
Killed by : none
changed conditional boundary → NO_COVERAGE

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

4.4
Location : play
Killed by : none
negated conditional → NO_COVERAGE

86

1.1
Location : play
Killed by : none
Replaced long addition with subtraction → NO_COVERAGE

2.2
Location : play
Killed by : none
removed call to org/graphstream/stream/Timeline$Event::doEvent → NO_COVERAGE

91

1.1
Location : playAll
Killed by : none
removed call to org/graphstream/stream/Timeline::play → NO_COVERAGE

95

1.1
Location : addNodeAt
Killed by : none
removed call to org/graphstream/stream/Timeline::insert → NO_COVERAGE

99

1.1
Location : removeNodeAt
Killed by : none
removed call to org/graphstream/stream/Timeline::insert → NO_COVERAGE

104

1.1
Location : addEdgeAt
Killed by : none
removed call to org/graphstream/stream/Timeline::insert → NO_COVERAGE

108

1.1
Location : removeEdgeAt
Killed by : none
removed call to org/graphstream/stream/Timeline::insert → NO_COVERAGE

113

1.1
Location : addNodeAttributeAt
Killed by : none
removed call to org/graphstream/stream/Timeline::insert → NO_COVERAGE

119

1.1
Location : addEdgeAttributeAt
Killed by : none
removed call to org/graphstream/stream/Timeline::insert → NO_COVERAGE

124

1.1
Location : addGraphAttributeAt
Killed by : none
removed call to org/graphstream/stream/Timeline::insert → NO_COVERAGE

130

1.1
Location : changeNodeAttributeAt
Killed by : none
removed call to org/graphstream/stream/Timeline::insert → NO_COVERAGE

136

1.1
Location : changeEdgeAttributeAt
Killed by : none
removed call to org/graphstream/stream/Timeline::insert → NO_COVERAGE

142

1.1
Location : changeGraphAttributeAt
Killed by : none
removed call to org/graphstream/stream/Timeline::insert → NO_COVERAGE

148

1.1
Location : removeNodeAttributeAt
Killed by : none
removed call to org/graphstream/stream/Timeline::insert → NO_COVERAGE

153

1.1
Location : removeEdgeAttributeAt
Killed by : none
removed call to org/graphstream/stream/Timeline::insert → NO_COVERAGE

157

1.1
Location : removeGraphAttributeAt
Killed by : none
removed call to org/graphstream/stream/Timeline::insert → NO_COVERAGE

161

1.1
Location : stepBeginsAt
Killed by : none
removed call to org/graphstream/stream/Timeline::insert → NO_COVERAGE

165

1.1
Location : clearGraphAt
Killed by : none
removed call to org/graphstream/stream/Timeline::insert → NO_COVERAGE

171

1.1
Location : handleTimeAttribute
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

189

1.1
Location : edgeAttributeAdded
Killed by : none
removed call to org/graphstream/stream/Timeline::addEdgeAttributeAt → NO_COVERAGE

202

1.1
Location : edgeAttributeChanged
Killed by : none
removed call to org/graphstream/stream/Timeline::changeEdgeAttributeAt → NO_COVERAGE

215

1.1
Location : edgeAttributeRemoved
Killed by : none
removed call to org/graphstream/stream/Timeline::removeEdgeAttributeAt → NO_COVERAGE

227

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

228

1.1
Location : graphAttributeAdded
Killed by : none
removed call to org/graphstream/stream/Timeline::handleTimeAttribute → NO_COVERAGE

230

1.1
Location : graphAttributeAdded
Killed by : none
removed call to org/graphstream/stream/Timeline::addGraphAttributeAt → NO_COVERAGE

242

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

243

1.1
Location : graphAttributeChanged
Killed by : none
removed call to org/graphstream/stream/Timeline::handleTimeAttribute → NO_COVERAGE

245

1.1
Location : graphAttributeChanged
Killed by : none
removed call to org/graphstream/stream/Timeline::changeGraphAttributeAt → NO_COVERAGE

257

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

258

1.1
Location : graphAttributeRemoved
Killed by : none
removed call to org/graphstream/stream/Timeline::handleTimeAttribute → NO_COVERAGE

260

1.1
Location : graphAttributeRemoved
Killed by : none
removed call to org/graphstream/stream/Timeline::removeGraphAttributeAt → NO_COVERAGE

272

1.1
Location : nodeAttributeAdded
Killed by : none
removed call to org/graphstream/stream/Timeline::addNodeAttributeAt → NO_COVERAGE

285

1.1
Location : nodeAttributeChanged
Killed by : none
removed call to org/graphstream/stream/Timeline::changeNodeAttributeAt → NO_COVERAGE

298

1.1
Location : nodeAttributeRemoved
Killed by : none
removed call to org/graphstream/stream/Timeline::removeNodeAttributeAt → NO_COVERAGE

309

1.1
Location : edgeAdded
Killed by : none
removed call to org/graphstream/stream/Timeline::addEdgeAt → NO_COVERAGE

319

1.1
Location : edgeRemoved
Killed by : none
removed call to org/graphstream/stream/Timeline::removeEdgeAt → NO_COVERAGE

329

1.1
Location : graphCleared
Killed by : none
removed call to org/graphstream/stream/Timeline::clearGraphAt → NO_COVERAGE

339

1.1
Location : nodeAdded
Killed by : none
removed call to org/graphstream/stream/Timeline::addNodeAt → NO_COVERAGE

349

1.1
Location : nodeRemoved
Killed by : none
removed call to org/graphstream/stream/Timeline::removeNodeAt → NO_COVERAGE

359

1.1
Location : stepBegins
Killed by : none
removed call to org/graphstream/stream/Timeline::stepBeginsAt → NO_COVERAGE

379

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

380

1.1
Location : compareTo
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

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

382

1.1
Location : compareTo
Killed by : none
Replaced long subtraction with addition → NO_COVERAGE

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

400

1.1
Location : doEvent
Killed by : none
removed call to org/graphstream/stream/Timeline::sendNodeAdded → NO_COVERAGE

409

1.1
Location : reverse
Killed by : none
removed call to org/graphstream/stream/Timeline::sendNodeRemoved → NO_COVERAGE

427

1.1
Location : doEvent
Killed by : none
removed call to org/graphstream/stream/Timeline::sendNodeRemoved → NO_COVERAGE

436

1.1
Location : reverse
Killed by : none
removed call to org/graphstream/stream/Timeline::sendNodeAdded → NO_COVERAGE

462

1.1
Location : doEvent
Killed by : none
removed call to org/graphstream/stream/Timeline::sendNodeAttributeAdded → NO_COVERAGE

466

1.1
Location : doEvent
Killed by : none
removed call to org/graphstream/stream/Timeline::sendEdgeAttributeAdded → NO_COVERAGE

470

1.1
Location : doEvent
Killed by : none
removed call to org/graphstream/stream/Timeline::sendGraphAttributeAdded → NO_COVERAGE

506

1.1
Location : doEvent
Killed by : none
removed call to org/graphstream/stream/Timeline::sendNodeAttributeChanged → NO_COVERAGE

509

1.1
Location : doEvent
Killed by : none
removed call to org/graphstream/stream/Timeline::sendEdgeAttributeChanged → NO_COVERAGE

513

1.1
Location : doEvent
Killed by : none
removed call to org/graphstream/stream/Timeline::sendGraphAttributeChanged → NO_COVERAGE

550

1.1
Location : doEvent
Killed by : none
removed call to org/graphstream/stream/Timeline::sendNodeAttributeRemoved → NO_COVERAGE

553

1.1
Location : doEvent
Killed by : none
removed call to org/graphstream/stream/Timeline::sendEdgeAttributeRemoved → NO_COVERAGE

556

1.1
Location : doEvent
Killed by : none
removed call to org/graphstream/stream/Timeline::sendGraphAttributeRemoved → NO_COVERAGE

592

1.1
Location : doEvent
Killed by : none
removed call to org/graphstream/stream/Timeline::sendEdgeAdded → NO_COVERAGE

601

1.1
Location : reverse
Killed by : none
removed call to org/graphstream/stream/Timeline::sendEdgeRemoved → NO_COVERAGE

619

1.1
Location : doEvent
Killed by : none
removed call to org/graphstream/stream/Timeline::sendEdgeRemoved → NO_COVERAGE

646

1.1
Location : doEvent
Killed by : none
removed call to org/graphstream/stream/Timeline::sendStepBegins → NO_COVERAGE

670

1.1
Location : doEvent
Killed by : none
removed call to org/graphstream/stream/Timeline::sendGraphCleared → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 0.33