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