ThreadProxyPipeOld.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.thread;
33
34
import org.graphstream.graph.Edge;
35
import org.graphstream.graph.Graph;
36
import org.graphstream.graph.Node;
37
import org.graphstream.stream.ProxyPipe;
38
import org.graphstream.stream.Sink;
39
import org.graphstream.stream.Source;
40
import org.graphstream.stream.SourceBase;
41
import org.miv.mbox.CannotPostException;
42
import org.miv.mbox.MBox;
43
import org.miv.mbox.MBoxListener;
44
import org.miv.mbox.MBoxStandalone;
45
46
/**
47
 * Filter that allows to pass graph events between two threads without explicit
48
 * synchronization.
49
 * 
50
 * <p>
51
 * This filter allows to register it as an output for some source of events in a
52
 * source thread (hereafter called the input thread) and to register listening
53
 * outputs in a destination thread (hereafter called the sink thread).
54
 * </p>
55
 * 
56
 * <pre>
57
 *                       |
58
 *   Source ---> ThreadProxyFilter ----> Sink
59
 *  Thread 1             |              Thread 2
60
 *                       |
61
 * </pre>
62
 * 
63
 * <p>
64
 * In other words, this class allows to listen in a sink thread graph events
65
 * that are produced in another source thread without any explicit
66
 * synchronization on the source of events.
67
 * </p>
68
 * 
69
 * <p>
70
 * The only restriction is that the sink thread must regularly call the
71
 * {@link #pump()} method to dispatch events coming from the source to all
72
 * sinks registered (see the explanation in {@link org.graphstream.stream.ProxyPipe}).
73
 * </p>
74
 * 
75
 * <p>
76
 * You can register any kind of input as source of event, but if the input is a
77
 * graph, then you can choose to "replay" all the content of the graph so that
78
 * at the other end of the filter, all outputs receive the complete content of
79
 * the graph. This is the default behavior if this filter is constructed with a
80
 * graph as input.
81
 * </p>
82
 * 
83
 * @deprecated This is the old version of {@link org.graphstream.stream.thread.ThreadProxyPipe}.
84
 */
85
@Deprecated
86
public class ThreadProxyPipeOld extends SourceBase implements ProxyPipe,
87
		MBoxListener {
88
89
	/**
90
	 * Proxy id.
91
	 */
92
	protected String id;
93
94
	/**
95
	 * The event sender name, usually the graph name.
96
	 */
97
	protected String from;
98
99
	/**
100
	 * The message box used to exchange messages between the two threads.
101
	 */
102
	protected MBox events;
103
104
	/**
105
	 * Used only to remove the listener. We ensure this is done in the source
106
	 * thread.
107
	 */
108
	protected Source input;
109
110
	/**
111
	 * Signals that this proxy must be removed from the source input.
112
	 */
113
	protected boolean unregisterWhenPossible = false;
114
115
	/**
116
	 * New thread proxy pipe with no input.
117
	 */
118
	public ThreadProxyPipeOld() {
119
		this((Source) null);
120
	}
121
122
	/**
123
	 * Listen at an input in a given thread and redirect all events to
124
	 * GraphListeners that may be in another thread.
125
	 * 
126
	 * @param input
127
	 *            The source of graph events we listen at.
128
	 */
129
	public ThreadProxyPipeOld(Source input) {
130
		this(input, new MBoxStandalone());
131
	}
132
133
	/**
134
	 * Like {@link #ThreadProxyPipe(Source)}, but allow to share the message box
135
	 * with another message processor. This can be needed to share the same
136
	 * message stack, when message order is important.
137
	 * 
138
	 * @param input
139
	 *            The source of events we listen at.
140
	 * @param sharedMBox
141
	 *            The message box used to send and receive graph messages across
142
	 *            the thread boundary.
143
	 */
144
	public ThreadProxyPipeOld(Source input, MBox sharedMBox) {
145
		this.events = sharedMBox;
146
		this.from = "<in>";
147
		this.input = input;
148
149 1 1. : negated conditional → NO_COVERAGE
		if (input != null)
150 1 1. : removed call to org/graphstream/stream/Source::addSink → NO_COVERAGE
			input.addSink(this);
151
152 1 1. : removed call to org/miv/mbox/MBoxStandalone::addListener → NO_COVERAGE
		((MBoxStandalone) this.events).addListener(this);
153
	}
154
155
	/**
156
	 * Listen at an input graph in a given thread and redirect all events to
157
	 * GraphListeners that may be in another thread. By default, if the graph
158
	 * already contains some elements, they are "replayed". This means that
159
	 * events are sent to mimic the fact they just appeared.
160
	 * 
161
	 * @param inputGraph
162
	 *            The graph we listen at.
163
	 */
164
	public ThreadProxyPipeOld(Graph inputGraph) {
165
		this(inputGraph, true);
166
	}
167
168
	/**
169
	 * Like {@link #ThreadProxyPipe(Graph)} but allow to avoid replaying the
170
	 * graph.
171
	 * 
172
	 * @param inputGraph
173
	 *            The graph we listen at.
174
	 * @param replayGraph
175
	 *            If false, and if the input graph already contains element they
176
	 *            are not replayed.
177
	 */
178
	public ThreadProxyPipeOld(Graph inputGraph, boolean replayGraph) {
179
		this(inputGraph, null, replayGraph);
180
	}
181
182
	/**
183
	 * Like {@link #ThreadProxyPipe(Graph,boolean)} but allows to pass an
184
	 * initial listener, therefore specifying the input and output at once.
185
	 * 
186
	 * @param inputGraph
187
	 *            The graph we listen at.
188
	 * @param firstListener
189
	 *            The initial listener to register.
190
	 * @param replayGraph
191
	 *            If false, and if the input graph already contains element they
192
	 *            are not replayed.
193
	 */
194
	public ThreadProxyPipeOld(Graph inputGraph, Sink firstListener,
195
			boolean replayGraph) {
196
		this(inputGraph, firstListener, replayGraph, new MBoxStandalone());
197
	}
198
199
	/**
200
	 * Like {@link #ThreadProxyPipe(Graph,Sink,boolean)}, but allows to share
201
	 * the message box with another message processor. This can be needed to
202
	 * share the same message stack, when message order is important.
203
	 * 
204
	 * @param inputGraph
205
	 *            The graph we listen at.
206
	 * @param replayGraph
207
	 *            If false, and if the input graph already contains element they
208
	 *            are not replayed.
209
	 * @param sharedMBox
210
	 *            The message box used to send and receive graph messages across
211
	 *            the thread boundary.
212
	 */
213
	public ThreadProxyPipeOld(Graph inputGraph, Sink firstListener,
214
			boolean replayGraph, MBox sharedMBox) {
215
		this.events = sharedMBox;
216
		this.from = inputGraph.getId();
217
		this.input = inputGraph;
218
219 1 1. : negated conditional → NO_COVERAGE
		if (firstListener != null)
220 1 1. : removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::addSink → NO_COVERAGE
			addSink(firstListener);
221
222 1 1. : negated conditional → NO_COVERAGE
		if (replayGraph)
223 1 1. : removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::replayGraph → NO_COVERAGE
			replayGraph(inputGraph);
224
225 1 1. : removed call to org/graphstream/stream/Source::addSink → NO_COVERAGE
		input.addSink(this);
226 1 1. : removed call to org/miv/mbox/MBoxStandalone::addListener → NO_COVERAGE
		((MBoxStandalone) this.events).addListener(this);
227
	}
228
229
	@Override
230
	public String toString() {
231
		String dest = "nil";
232
233 2 1. toString : changed conditional boundary → NO_COVERAGE
2. toString : negated conditional → NO_COVERAGE
		if (attrSinks.size() > 0)
234
			dest = attrSinks.get(0).toString();
235
236 1 1. toString : mutated return of Object value for org/graphstream/stream/thread/ThreadProxyPipeOld::toString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
		return String.format("thread-proxy(from %s to %s)", from, dest);
237
	}
238
239
	/**
240
	 * Ask the proxy to unregister from the event input source (stop receive
241
	 * events) as soon as possible (when the next event will occur in the
242
	 * graph).
243
	 */
244
	public void unregisterFromSource() {
245
		unregisterWhenPossible = true;
246
	}
247
248
	/**
249
	 * This method must be called regularly in the output thread to check if the
250
	 * input source sent events. If some event occurred, the listeners will be
251
	 * called.
252
	 */
253
	public void pump() {
254 1 1. pump : removed call to org/miv/mbox/MBoxStandalone::processMessages → NO_COVERAGE
		((MBoxStandalone) events).processMessages();
255
	}
256
257
	/**
258
	 * Set of events sent via the message box.
259
	 */
260
	protected static enum GraphEvents {
261
		ADD_NODE, DEL_NODE, ADD_EDGE, DEL_EDGE,
262
		STEP, CLEARED,
263
		ADD_GRAPH_ATTR, CHG_GRAPH_ATTR, DEL_GRAPH_ATTR,
264
		ADD_NODE_ATTR, CHG_NODE_ATTR, DEL_NODE_ATTR,
265
		ADD_EDGE_ATTR, CHG_EDGE_ATTR, DEL_EDGE_ATTR
266
	};
267
268
	protected void replayGraph(Graph graph) {
269
		try {
270
			String graphId = "@replay";
271
272
			// Replay all graph attributes.
273
274 1 1. replayGraph : negated conditional → NO_COVERAGE
			if (graph.getAttributeKeySet() != null)
275 1 1. replayGraph : negated conditional → NO_COVERAGE
				for (String key : graph.getAttributeKeySet())
276 1 1. replayGraph : removed call to org/miv/mbox/MBox::post → NO_COVERAGE
					events.post(from, GraphEvents.ADD_GRAPH_ATTR, graphId,
277
							sourceTime.newEvent(), key, graph.getAttribute(key));
278
279 1 1. replayGraph : removed call to java/lang/Thread::yield → NO_COVERAGE
			Thread.yield();
280
			
281
			// Replay all nodes and their attributes.
282
283 1 1. replayGraph : negated conditional → NO_COVERAGE
			for (Node node : graph) {
284 1 1. replayGraph : removed call to org/miv/mbox/MBox::post → NO_COVERAGE
				events.post(from, GraphEvents.ADD_NODE, graphId,
285
						sourceTime.newEvent(), node.getId());
286
287 1 1. replayGraph : negated conditional → NO_COVERAGE
				if (node.getAttributeKeySet() != null)
288 1 1. replayGraph : negated conditional → NO_COVERAGE
					for (String key : node.getAttributeKeySet())
289 1 1. replayGraph : removed call to org/miv/mbox/MBox::post → NO_COVERAGE
						events.post(from, GraphEvents.ADD_NODE_ATTR, graphId,
290
								sourceTime.newEvent(), node.getId(), key,
291
								node.getAttribute(key));
292 1 1. replayGraph : removed call to java/lang/Thread::yield → NO_COVERAGE
				Thread.yield();
293
			}
294
295
			// Replay all edges and their attributes.
296
297 1 1. replayGraph : negated conditional → NO_COVERAGE
			for (Edge edge : graph.getEachEdge()) {
298 1 1. replayGraph : removed call to org/miv/mbox/MBox::post → NO_COVERAGE
				events.post(from, GraphEvents.ADD_EDGE, graphId, sourceTime
299
						.newEvent(), edge.getId(),
300
						edge.getSourceNode().getId(), edge.getTargetNode()
301
								.getId(), edge.isDirected());
302
303 1 1. replayGraph : negated conditional → NO_COVERAGE
				if (edge.getAttributeKeySet() != null)
304 1 1. replayGraph : negated conditional → NO_COVERAGE
					for (String key : edge.getAttributeKeySet())
305 1 1. replayGraph : removed call to org/miv/mbox/MBox::post → NO_COVERAGE
						events.post(from, GraphEvents.ADD_EDGE_ATTR, graphId,
306
								sourceTime.newEvent(), edge.getId(), key,
307
								edge.getAttribute(key));
308 1 1. replayGraph : removed call to java/lang/Thread::yield → NO_COVERAGE
				Thread.yield();
309
			}
310
		} catch (CannotPostException e) {
311
			System.err
312
					.printf("GraphRendererRunner: cannot post message to listeners: %s%n",
313
							e.getMessage());
314
		}
315
	}
316
317
	protected boolean maybeUnregister() {
318 1 1. maybeUnregister : negated conditional → NO_COVERAGE
		if (unregisterWhenPossible) {
319 1 1. maybeUnregister : negated conditional → NO_COVERAGE
			if (input != null)
320 1 1. maybeUnregister : removed call to org/graphstream/stream/Source::removeSink → NO_COVERAGE
				input.removeSink(this);
321 1 1. maybeUnregister : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
			return true;
322
		}
323
324 1 1. maybeUnregister : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
		return false;
325
	}
326
327
	public void edgeAttributeAdded(String graphId, long timeId, String edgeId,
328
			String attribute, Object value) {
329 1 1. edgeAttributeAdded : negated conditional → NO_COVERAGE
		if (maybeUnregister())
330
			return;
331
332
		try {
333 1 1. edgeAttributeAdded : removed call to org/miv/mbox/MBox::post → NO_COVERAGE
			events.post(from, GraphEvents.ADD_EDGE_ATTR, graphId, timeId,
334
					edgeId, attribute, value);
335
		} catch (CannotPostException e) {
336 1 1. edgeAttributeAdded : removed call to org/miv/mbox/CannotPostException::printStackTrace → NO_COVERAGE
			e.printStackTrace();
337
		}
338
	}
339
340
	public void edgeAttributeChanged(String graphId, long timeId,
341
			String edgeId, String attribute, Object oldValue, Object newValue) {
342 1 1. edgeAttributeChanged : negated conditional → NO_COVERAGE
		if (maybeUnregister())
343
			return;
344
345
		try {
346 1 1. edgeAttributeChanged : removed call to org/miv/mbox/MBox::post → NO_COVERAGE
			events.post(from, GraphEvents.CHG_EDGE_ATTR, graphId, timeId,
347
					edgeId, attribute, oldValue, newValue);
348
		} catch (CannotPostException e) {
349 1 1. edgeAttributeChanged : removed call to org/miv/mbox/CannotPostException::printStackTrace → NO_COVERAGE
			e.printStackTrace();
350
		}
351
	}
352
353
	public void edgeAttributeRemoved(String graphId, long timeId,
354
			String edgeId, String attribute) {
355 1 1. edgeAttributeRemoved : negated conditional → NO_COVERAGE
		if (maybeUnregister())
356
			return;
357
358
		try {
359 1 1. edgeAttributeRemoved : removed call to org/miv/mbox/MBox::post → NO_COVERAGE
			events.post(from, GraphEvents.DEL_EDGE_ATTR, graphId, timeId,
360
					edgeId, attribute);
361
		} catch (CannotPostException e) {
362 1 1. edgeAttributeRemoved : removed call to org/miv/mbox/CannotPostException::printStackTrace → NO_COVERAGE
			e.printStackTrace();
363
		}
364
	}
365
366
	public void graphAttributeAdded(String graphId, long timeId,
367
			String attribute, Object value) {
368 1 1. graphAttributeAdded : negated conditional → NO_COVERAGE
		if (maybeUnregister())
369
			return;
370
371
		try {
372 1 1. graphAttributeAdded : removed call to org/miv/mbox/MBox::post → NO_COVERAGE
			events.post(from, GraphEvents.ADD_GRAPH_ATTR, graphId, timeId,
373
					attribute, value);
374
		} catch (CannotPostException e) {
375 1 1. graphAttributeAdded : removed call to org/miv/mbox/CannotPostException::printStackTrace → NO_COVERAGE
			e.printStackTrace();
376
		}
377
	}
378
379
	public void graphAttributeChanged(String graphId, long timeId,
380
			String attribute, Object oldValue, Object newValue) {
381 1 1. graphAttributeChanged : negated conditional → NO_COVERAGE
		if (maybeUnregister())
382
			return;
383
384
		try {
385 1 1. graphAttributeChanged : removed call to org/miv/mbox/MBox::post → NO_COVERAGE
			events.post(from, GraphEvents.CHG_GRAPH_ATTR, graphId, timeId,
386
					attribute, oldValue, newValue);
387
		} catch (CannotPostException e) {
388 1 1. graphAttributeChanged : removed call to org/miv/mbox/CannotPostException::printStackTrace → NO_COVERAGE
			e.printStackTrace();
389
		}
390
	}
391
392
	public void graphAttributeRemoved(String graphId, long timeId,
393
			String attribute) {
394 1 1. graphAttributeRemoved : negated conditional → NO_COVERAGE
		if (maybeUnregister())
395
			return;
396
397
		try {
398 1 1. graphAttributeRemoved : removed call to org/miv/mbox/MBox::post → NO_COVERAGE
			events.post(from, GraphEvents.DEL_GRAPH_ATTR, graphId, timeId,
399
					attribute);
400
		} catch (CannotPostException e) {
401 1 1. graphAttributeRemoved : removed call to org/miv/mbox/CannotPostException::printStackTrace → NO_COVERAGE
			e.printStackTrace();
402
		}
403
	}
404
405
	public void nodeAttributeAdded(String graphId, long timeId, String nodeId,
406
			String attribute, Object value) {
407 1 1. nodeAttributeAdded : negated conditional → NO_COVERAGE
		if (maybeUnregister())
408
			return;
409
410
		try {
411 1 1. nodeAttributeAdded : removed call to org/miv/mbox/MBox::post → NO_COVERAGE
			events.post(from, GraphEvents.ADD_NODE_ATTR, graphId, timeId,
412
					nodeId, attribute, value);
413
		} catch (CannotPostException e) {
414 1 1. nodeAttributeAdded : removed call to org/miv/mbox/CannotPostException::printStackTrace → NO_COVERAGE
			e.printStackTrace();
415
		}
416
	}
417
418
	public void nodeAttributeChanged(String graphId, long timeId,
419
			String nodeId, String attribute, Object oldValue, Object newValue) {
420 1 1. nodeAttributeChanged : negated conditional → NO_COVERAGE
		if (maybeUnregister())
421
			return;
422
423
		try {
424 1 1. nodeAttributeChanged : removed call to org/miv/mbox/MBox::post → NO_COVERAGE
			events.post(from, GraphEvents.CHG_NODE_ATTR, graphId, timeId,
425
					nodeId, attribute, oldValue, newValue);
426
		} catch (CannotPostException e) {
427 1 1. nodeAttributeChanged : removed call to org/miv/mbox/CannotPostException::printStackTrace → NO_COVERAGE
			e.printStackTrace();
428
		}
429
	}
430
431
	public void nodeAttributeRemoved(String graphId, long timeId,
432
			String nodeId, String attribute) {
433 1 1. nodeAttributeRemoved : negated conditional → NO_COVERAGE
		if (maybeUnregister())
434
			return;
435
436
		try {
437 1 1. nodeAttributeRemoved : removed call to org/miv/mbox/MBox::post → NO_COVERAGE
			events.post(from, GraphEvents.DEL_NODE_ATTR, graphId, timeId,
438
					nodeId, attribute);
439
		} catch (CannotPostException e) {
440 1 1. nodeAttributeRemoved : removed call to org/miv/mbox/CannotPostException::printStackTrace → NO_COVERAGE
			e.printStackTrace();
441
		}
442
	}
443
444
	public void edgeAdded(String graphId, long timeId, String edgeId,
445
			String fromNodeId, String toNodeId, boolean directed) {
446 1 1. edgeAdded : negated conditional → NO_COVERAGE
		if (maybeUnregister())
447
			return;
448
449
		try {
450 1 1. edgeAdded : removed call to org/miv/mbox/MBox::post → NO_COVERAGE
			events.post(from, GraphEvents.ADD_EDGE, graphId, timeId, edgeId,
451
					fromNodeId, toNodeId, directed);
452
		} catch (CannotPostException e) {
453 1 1. edgeAdded : removed call to org/miv/mbox/CannotPostException::printStackTrace → NO_COVERAGE
			e.printStackTrace();
454
		}
455
	}
456
457
	public void edgeRemoved(String graphId, long timeId, String edgeId) {
458 1 1. edgeRemoved : negated conditional → NO_COVERAGE
		if (maybeUnregister())
459
			return;
460
461
		try {
462 1 1. edgeRemoved : removed call to org/miv/mbox/MBox::post → NO_COVERAGE
			events.post(from, GraphEvents.DEL_EDGE, graphId, timeId, edgeId);
463
		} catch (CannotPostException e) {
464 1 1. edgeRemoved : removed call to org/miv/mbox/CannotPostException::printStackTrace → NO_COVERAGE
			e.printStackTrace();
465
		}
466
	}
467
468
	public void graphCleared(String graphId, long timeId) {
469 1 1. graphCleared : negated conditional → NO_COVERAGE
		if (maybeUnregister())
470
			return;
471
472
		try {
473 1 1. graphCleared : removed call to org/miv/mbox/MBox::post → NO_COVERAGE
			events.post(from, GraphEvents.CLEARED, graphId, timeId);
474
		} catch (CannotPostException e) {
475 1 1. graphCleared : removed call to org/miv/mbox/CannotPostException::printStackTrace → NO_COVERAGE
			e.printStackTrace();
476
		}
477
	}
478
479
	public void nodeAdded(String graphId, long timeId, String nodeId) {
480 1 1. nodeAdded : negated conditional → NO_COVERAGE
		if (maybeUnregister())
481
			return;
482
483
		try {
484 1 1. nodeAdded : removed call to org/miv/mbox/MBox::post → NO_COVERAGE
			events.post(from, GraphEvents.ADD_NODE, graphId, timeId, nodeId);
485
		} catch (CannotPostException e) {
486 1 1. nodeAdded : removed call to org/miv/mbox/CannotPostException::printStackTrace → NO_COVERAGE
			e.printStackTrace();
487
		}
488
	}
489
490
	public void nodeRemoved(String graphId, long timeId, String nodeId) {
491 1 1. nodeRemoved : negated conditional → NO_COVERAGE
		if (maybeUnregister())
492
			return;
493
494
		try {
495 1 1. nodeRemoved : removed call to org/miv/mbox/MBox::post → NO_COVERAGE
			events.post(from, GraphEvents.DEL_NODE, graphId, timeId, nodeId);
496
		} catch (CannotPostException e) {
497 1 1. nodeRemoved : removed call to org/miv/mbox/CannotPostException::printStackTrace → NO_COVERAGE
			e.printStackTrace();
498
		}
499
	}
500
501
	public void stepBegins(String graphId, long timeId, double step) {
502 1 1. stepBegins : negated conditional → NO_COVERAGE
		if (maybeUnregister())
503
			return;
504
505
		try {
506 1 1. stepBegins : removed call to org/miv/mbox/MBox::post → NO_COVERAGE
			events.post(from, GraphEvents.STEP, graphId, timeId, step);
507
		} catch (CannotPostException e) {
508 1 1. stepBegins : removed call to org/miv/mbox/CannotPostException::printStackTrace → NO_COVERAGE
			e.printStackTrace();
509
		}
510
	}
511
512
	// MBoxListener
513
514
	public void processMessage(String from, Object[] data) {
515
		// System.err.printf( "    %s.msg(%s, %s, %s, %s)%n", from, data[1],
516
		// data[2], data[0], data[3] );
517 1 1. processMessage : negated conditional → NO_COVERAGE
		if (data[0].equals(GraphEvents.ADD_NODE)) {
518
			String graphId = (String) data[1];
519
			Long timeId = (Long) data[2];
520
			String nodeId = (String) data[3];
521
522 1 1. processMessage : removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::sendNodeAdded → NO_COVERAGE
			sendNodeAdded(graphId, timeId, nodeId);
523 1 1. processMessage : negated conditional → NO_COVERAGE
		} else if (data[0].equals(GraphEvents.DEL_NODE)) {
524
			String graphId = (String) data[1];
525
			Long timeId = (Long) data[2];
526
			String nodeId = (String) data[3];
527
528 1 1. processMessage : removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::sendNodeRemoved → NO_COVERAGE
			sendNodeRemoved(graphId, timeId, nodeId);
529 1 1. processMessage : negated conditional → NO_COVERAGE
		} else if (data[0].equals(GraphEvents.ADD_EDGE)) {
530
			String graphId = (String) data[1];
531
			Long timeId = (Long) data[2];
532
			String edgeId = (String) data[3];
533
			String fromId = (String) data[4];
534
			String toId = (String) data[5];
535
			boolean directed = (Boolean) data[6];
536
537 1 1. processMessage : removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::sendEdgeAdded → NO_COVERAGE
			sendEdgeAdded(graphId, timeId, edgeId, fromId, toId, directed);
538 1 1. processMessage : negated conditional → NO_COVERAGE
		} else if (data[0].equals(GraphEvents.DEL_EDGE)) {
539
			String graphId = (String) data[1];
540
			Long timeId = (Long) data[2];
541
			String edgeId = (String) data[3];
542
543 1 1. processMessage : removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::sendEdgeRemoved → NO_COVERAGE
			sendEdgeRemoved(graphId, timeId, edgeId);
544 1 1. processMessage : negated conditional → NO_COVERAGE
		} else if (data[0].equals(GraphEvents.STEP)) {
545
			String graphId = (String) data[1];
546
			Long timeId = (Long) data[2];
547
			double step = (Double) data[3];
548
549 1 1. processMessage : removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::sendStepBegins → NO_COVERAGE
			sendStepBegins(graphId, timeId, step);
550 1 1. processMessage : negated conditional → NO_COVERAGE
		} else if (data[0].equals(GraphEvents.ADD_GRAPH_ATTR)) {
551
			String graphId = (String) data[1];
552
			Long timeId = (Long) data[2];
553
			String attribute = (String) data[3];
554
			Object value = data[4];
555
556 1 1. processMessage : removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::sendGraphAttributeAdded → NO_COVERAGE
			sendGraphAttributeAdded(graphId, timeId, attribute, value);
557 1 1. processMessage : negated conditional → NO_COVERAGE
		} else if (data[0].equals(GraphEvents.CHG_GRAPH_ATTR)) {
558
			String graphId = (String) data[1];
559
			Long timeId = (Long) data[2];
560
			String attribute = (String) data[3];
561
			Object oldValue = data[4];
562
			Object newValue = data[5];
563
564 1 1. processMessage : removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::sendGraphAttributeChanged → NO_COVERAGE
			sendGraphAttributeChanged(graphId, timeId, attribute, oldValue,
565
					newValue);
566 1 1. processMessage : negated conditional → NO_COVERAGE
		} else if (data[0].equals(GraphEvents.DEL_GRAPH_ATTR)) {
567
			String graphId = (String) data[1];
568
			Long timeId = (Long) data[2];
569
			String attribute = (String) data[3];
570
571 1 1. processMessage : removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::sendGraphAttributeRemoved → NO_COVERAGE
			sendGraphAttributeRemoved(graphId, timeId, attribute);
572 1 1. processMessage : negated conditional → NO_COVERAGE
		} else if (data[0].equals(GraphEvents.ADD_EDGE_ATTR)) {
573
			String graphId = (String) data[1];
574
			Long timeId = (Long) data[2];
575
			String edgeId = (String) data[3];
576
			String attribute = (String) data[4];
577
			Object value = data[5];
578
579 1 1. processMessage : removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::sendEdgeAttributeAdded → NO_COVERAGE
			sendEdgeAttributeAdded(graphId, timeId, edgeId, attribute, value);
580 1 1. processMessage : negated conditional → NO_COVERAGE
		} else if (data[0].equals(GraphEvents.CHG_EDGE_ATTR)) {
581
			String graphId = (String) data[1];
582
			Long timeId = (Long) data[2];
583
			String edgeId = (String) data[3];
584
			String attribute = (String) data[4];
585
			Object oldValue = data[5];
586
			Object newValue = data[6];
587
588 1 1. processMessage : removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::sendEdgeAttributeChanged → NO_COVERAGE
			sendEdgeAttributeChanged(graphId, timeId, edgeId, attribute,
589
					oldValue, newValue);
590 1 1. processMessage : negated conditional → NO_COVERAGE
		} else if (data[0].equals(GraphEvents.DEL_EDGE_ATTR)) {
591
			String graphId = (String) data[1];
592
			Long timeId = (Long) data[2];
593
			String edgeId = (String) data[3];
594
			String attribute = (String) data[4];
595
596 1 1. processMessage : removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::sendEdgeAttributeRemoved → NO_COVERAGE
			sendEdgeAttributeRemoved(graphId, timeId, edgeId, attribute);
597 1 1. processMessage : negated conditional → NO_COVERAGE
		} else if (data[0].equals(GraphEvents.ADD_NODE_ATTR)) {
598
			String graphId = (String) data[1];
599
			Long timeId = (Long) data[2];
600
			String nodeId = (String) data[3];
601
			String attribute = (String) data[4];
602
			Object value = data[5];
603
604 1 1. processMessage : removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::sendNodeAttributeAdded → NO_COVERAGE
			sendNodeAttributeAdded(graphId, timeId, nodeId, attribute, value);
605 1 1. processMessage : negated conditional → NO_COVERAGE
		} else if (data[0].equals(GraphEvents.CHG_NODE_ATTR)) {
606
			String graphId = (String) data[1];
607
			Long timeId = (Long) data[2];
608
			String nodeId = (String) data[3];
609
			String attribute = (String) data[4];
610
			Object oldValue = data[5];
611
			Object newValue = data[6];
612
613 1 1. processMessage : removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::sendNodeAttributeChanged → NO_COVERAGE
			sendNodeAttributeChanged(graphId, timeId, nodeId, attribute,
614
					oldValue, newValue);
615 1 1. processMessage : negated conditional → NO_COVERAGE
		} else if (data[0].equals(GraphEvents.DEL_NODE_ATTR)) {
616
			String graphId = (String) data[1];
617
			Long timeId = (Long) data[2];
618
			String nodeId = (String) data[3];
619
			String attribute = (String) data[4];
620
621 1 1. processMessage : removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::sendNodeAttributeRemoved → NO_COVERAGE
			sendNodeAttributeRemoved(graphId, timeId, nodeId, attribute);
622 1 1. processMessage : negated conditional → NO_COVERAGE
		} else if (data[0].equals(GraphEvents.CLEARED)) {
623
			String graphId = (String) data[1];
624
			Long timeId = (Long) data[2];
625
626 1 1. processMessage : removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::sendGraphCleared → NO_COVERAGE
			sendGraphCleared(graphId, timeId);
627
		} else {
628
			System.err.printf("ThreadProxyFilter : Unknown message %s !!%n",
629
					data[0]);
630
		}
631
	}
632
}

Mutations

149

1.1
Location :
Killed by : none
negated conditional → NO_COVERAGE

150

1.1
Location :
Killed by : none
removed call to org/graphstream/stream/Source::addSink → NO_COVERAGE

152

1.1
Location :
Killed by : none
removed call to org/miv/mbox/MBoxStandalone::addListener → NO_COVERAGE

219

1.1
Location :
Killed by : none
negated conditional → NO_COVERAGE

220

1.1
Location :
Killed by : none
removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::addSink → NO_COVERAGE

222

1.1
Location :
Killed by : none
negated conditional → NO_COVERAGE

223

1.1
Location :
Killed by : none
removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::replayGraph → NO_COVERAGE

225

1.1
Location :
Killed by : none
removed call to org/graphstream/stream/Source::addSink → NO_COVERAGE

226

1.1
Location :
Killed by : none
removed call to org/miv/mbox/MBoxStandalone::addListener → NO_COVERAGE

233

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

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

236

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

254

1.1
Location : pump
Killed by : none
removed call to org/miv/mbox/MBoxStandalone::processMessages → NO_COVERAGE

274

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

275

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

276

1.1
Location : replayGraph
Killed by : none
removed call to org/miv/mbox/MBox::post → NO_COVERAGE

279

1.1
Location : replayGraph
Killed by : none
removed call to java/lang/Thread::yield → NO_COVERAGE

283

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

284

1.1
Location : replayGraph
Killed by : none
removed call to org/miv/mbox/MBox::post → NO_COVERAGE

287

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

288

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

289

1.1
Location : replayGraph
Killed by : none
removed call to org/miv/mbox/MBox::post → NO_COVERAGE

292

1.1
Location : replayGraph
Killed by : none
removed call to java/lang/Thread::yield → NO_COVERAGE

297

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

298

1.1
Location : replayGraph
Killed by : none
removed call to org/miv/mbox/MBox::post → NO_COVERAGE

303

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

304

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

305

1.1
Location : replayGraph
Killed by : none
removed call to org/miv/mbox/MBox::post → NO_COVERAGE

308

1.1
Location : replayGraph
Killed by : none
removed call to java/lang/Thread::yield → NO_COVERAGE

318

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

319

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

320

1.1
Location : maybeUnregister
Killed by : none
removed call to org/graphstream/stream/Source::removeSink → NO_COVERAGE

321

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

324

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

329

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

333

1.1
Location : edgeAttributeAdded
Killed by : none
removed call to org/miv/mbox/MBox::post → NO_COVERAGE

336

1.1
Location : edgeAttributeAdded
Killed by : none
removed call to org/miv/mbox/CannotPostException::printStackTrace → NO_COVERAGE

342

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

346

1.1
Location : edgeAttributeChanged
Killed by : none
removed call to org/miv/mbox/MBox::post → NO_COVERAGE

349

1.1
Location : edgeAttributeChanged
Killed by : none
removed call to org/miv/mbox/CannotPostException::printStackTrace → NO_COVERAGE

355

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

359

1.1
Location : edgeAttributeRemoved
Killed by : none
removed call to org/miv/mbox/MBox::post → NO_COVERAGE

362

1.1
Location : edgeAttributeRemoved
Killed by : none
removed call to org/miv/mbox/CannotPostException::printStackTrace → NO_COVERAGE

368

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

372

1.1
Location : graphAttributeAdded
Killed by : none
removed call to org/miv/mbox/MBox::post → NO_COVERAGE

375

1.1
Location : graphAttributeAdded
Killed by : none
removed call to org/miv/mbox/CannotPostException::printStackTrace → NO_COVERAGE

381

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

385

1.1
Location : graphAttributeChanged
Killed by : none
removed call to org/miv/mbox/MBox::post → NO_COVERAGE

388

1.1
Location : graphAttributeChanged
Killed by : none
removed call to org/miv/mbox/CannotPostException::printStackTrace → NO_COVERAGE

394

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

398

1.1
Location : graphAttributeRemoved
Killed by : none
removed call to org/miv/mbox/MBox::post → NO_COVERAGE

401

1.1
Location : graphAttributeRemoved
Killed by : none
removed call to org/miv/mbox/CannotPostException::printStackTrace → NO_COVERAGE

407

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

411

1.1
Location : nodeAttributeAdded
Killed by : none
removed call to org/miv/mbox/MBox::post → NO_COVERAGE

414

1.1
Location : nodeAttributeAdded
Killed by : none
removed call to org/miv/mbox/CannotPostException::printStackTrace → NO_COVERAGE

420

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

424

1.1
Location : nodeAttributeChanged
Killed by : none
removed call to org/miv/mbox/MBox::post → NO_COVERAGE

427

1.1
Location : nodeAttributeChanged
Killed by : none
removed call to org/miv/mbox/CannotPostException::printStackTrace → NO_COVERAGE

433

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

437

1.1
Location : nodeAttributeRemoved
Killed by : none
removed call to org/miv/mbox/MBox::post → NO_COVERAGE

440

1.1
Location : nodeAttributeRemoved
Killed by : none
removed call to org/miv/mbox/CannotPostException::printStackTrace → NO_COVERAGE

446

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

450

1.1
Location : edgeAdded
Killed by : none
removed call to org/miv/mbox/MBox::post → NO_COVERAGE

453

1.1
Location : edgeAdded
Killed by : none
removed call to org/miv/mbox/CannotPostException::printStackTrace → NO_COVERAGE

458

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

462

1.1
Location : edgeRemoved
Killed by : none
removed call to org/miv/mbox/MBox::post → NO_COVERAGE

464

1.1
Location : edgeRemoved
Killed by : none
removed call to org/miv/mbox/CannotPostException::printStackTrace → NO_COVERAGE

469

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

473

1.1
Location : graphCleared
Killed by : none
removed call to org/miv/mbox/MBox::post → NO_COVERAGE

475

1.1
Location : graphCleared
Killed by : none
removed call to org/miv/mbox/CannotPostException::printStackTrace → NO_COVERAGE

480

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

484

1.1
Location : nodeAdded
Killed by : none
removed call to org/miv/mbox/MBox::post → NO_COVERAGE

486

1.1
Location : nodeAdded
Killed by : none
removed call to org/miv/mbox/CannotPostException::printStackTrace → NO_COVERAGE

491

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

495

1.1
Location : nodeRemoved
Killed by : none
removed call to org/miv/mbox/MBox::post → NO_COVERAGE

497

1.1
Location : nodeRemoved
Killed by : none
removed call to org/miv/mbox/CannotPostException::printStackTrace → NO_COVERAGE

502

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

506

1.1
Location : stepBegins
Killed by : none
removed call to org/miv/mbox/MBox::post → NO_COVERAGE

508

1.1
Location : stepBegins
Killed by : none
removed call to org/miv/mbox/CannotPostException::printStackTrace → NO_COVERAGE

517

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

522

1.1
Location : processMessage
Killed by : none
removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::sendNodeAdded → NO_COVERAGE

523

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

528

1.1
Location : processMessage
Killed by : none
removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::sendNodeRemoved → NO_COVERAGE

529

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

537

1.1
Location : processMessage
Killed by : none
removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::sendEdgeAdded → NO_COVERAGE

538

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

543

1.1
Location : processMessage
Killed by : none
removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::sendEdgeRemoved → NO_COVERAGE

544

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

549

1.1
Location : processMessage
Killed by : none
removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::sendStepBegins → NO_COVERAGE

550

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

556

1.1
Location : processMessage
Killed by : none
removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::sendGraphAttributeAdded → NO_COVERAGE

557

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

564

1.1
Location : processMessage
Killed by : none
removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::sendGraphAttributeChanged → NO_COVERAGE

566

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

571

1.1
Location : processMessage
Killed by : none
removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::sendGraphAttributeRemoved → NO_COVERAGE

572

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

579

1.1
Location : processMessage
Killed by : none
removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::sendEdgeAttributeAdded → NO_COVERAGE

580

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

588

1.1
Location : processMessage
Killed by : none
removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::sendEdgeAttributeChanged → NO_COVERAGE

590

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

596

1.1
Location : processMessage
Killed by : none
removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::sendEdgeAttributeRemoved → NO_COVERAGE

597

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

604

1.1
Location : processMessage
Killed by : none
removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::sendNodeAttributeAdded → NO_COVERAGE

605

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

613

1.1
Location : processMessage
Killed by : none
removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::sendNodeAttributeChanged → NO_COVERAGE

615

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

621

1.1
Location : processMessage
Killed by : none
removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::sendNodeAttributeRemoved → NO_COVERAGE

622

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

626

1.1
Location : processMessage
Killed by : none
removed call to org/graphstream/stream/thread/ThreadProxyPipeOld::sendGraphCleared → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 0.33