1 | /** | |
2 | * | |
3 | * Copyright (c) 2013 University of Le Havre | |
4 | * | |
5 | * @file NetStreamDecoder.java | |
6 | * @date May 31, 2013 | |
7 | * | |
8 | * @author Yoann Pign�� | |
9 | * | |
10 | */ | |
11 | package org.graphstream.stream.netstream; | |
12 | ||
13 | import java.io.IOException; | |
14 | import java.io.InputStream; | |
15 | import java.nio.ByteBuffer; | |
16 | import java.nio.charset.Charset; | |
17 | import java.util.HashMap; | |
18 | ||
19 | import org.graphstream.stream.thread.ThreadProxyPipe; | |
20 | ||
21 | /** | |
22 | * | |
23 | */ | |
24 | public class DefaultNetStreamDecoder implements NetStreamDecoder { | |
25 | | |
26 | /** | |
27 | * Show debugging messages. | |
28 | */ | |
29 | protected boolean debug = true; | |
30 | ||
31 | /** | |
32 | * The current pipe commands are being written to. | |
33 | */ | |
34 | protected ThreadProxyPipe currentStream; | |
35 | ||
36 | /** | |
37 | * Pairs (key,value) where the key is the listener ID and the value the MBox | |
38 | * of the listener. This can be modified by other threads and must be | |
39 | * properly locked. | |
40 | * | |
41 | * @see #register(String,ThreadProxyPipe) | |
42 | */ | |
43 | // protected HashMap<String,MBox> boxes = new HashMap<String,MBox>(); | |
44 | protected HashMap<String, ThreadProxyPipe> streams = new HashMap<String, ThreadProxyPipe>(); | |
45 | ||
46 | /* (non-Javadoc) | |
47 | * @see org.graphstream.stream.netstream.NetStreamDecoder#getStream(java.lang.String) | |
48 | */ | |
49 | public synchronized ThreadProxyPipe getStream(String name) { | |
50 | ThreadProxyPipe s = streams.get(name); | |
51 |
1
1. getStream : negated conditional → NO_COVERAGE |
if (s == null) { |
52 | s = new ThreadProxyPipe(); | |
53 | streams.put(name, s); | |
54 | } | |
55 |
1
1. getStream : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::getStream to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return s; |
56 | } | |
57 | /* (non-Javadoc) | |
58 | * @see org.graphstream.stream.netstream.NetStreamDecoder#getDefaultStream() | |
59 | */ | |
60 | ||
61 | public synchronized ThreadProxyPipe getDefaultStream() { | |
62 | ThreadProxyPipe s = streams.get("default"); | |
63 |
1
1. getDefaultStream : negated conditional → NO_COVERAGE |
if (s == null) { |
64 | s = new ThreadProxyPipe(); | |
65 | streams.put("default", s); | |
66 | } | |
67 |
1
1. getDefaultStream : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::getDefaultStream to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return s; |
68 | ||
69 | } | |
70 | /* (non-Javadoc) | |
71 | * @see org.graphstream.stream.netstream.NetStreamDecoder#register(java.lang.String, org.graphstream.stream.thread.ThreadProxyPipe) | |
72 | */ | |
73 | public synchronized void register(String name, ThreadProxyPipe stream) | |
74 | throws Exception { | |
75 |
1
1. register : negated conditional → NO_COVERAGE |
if (streams.containsKey(name)) |
76 | throw new Exception("name " + name + " already registered"); | |
77 | ||
78 | streams.put(name, stream); | |
79 | ||
80 |
1
1. register : negated conditional → NO_COVERAGE |
if (debug) |
81 |
1
1. register : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("registered pipe %s", name); |
82 | } | |
83 | ||
84 | /* (non-Javadoc) | |
85 | * @see org.graphstream.stream.netstream.NetStreamDecoder#decodeMessage(java.io.InputStream) | |
86 | */ | |
87 | public void decodeMessage(InputStream in) throws IOException { | |
88 | ||
89 | int cmd = 0; | |
90 | ||
91 | // First read the name of the stream that will be addressed. | |
92 | String stream = readString(in); | |
93 |
1
1. decodeMessage : negated conditional → NO_COVERAGE |
if (debug) { |
94 |
1
1. decodeMessage : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("Stream \"%s\" is addressed in this message.", stream); |
95 | } | |
96 | currentStream = getStream(stream); | |
97 | ||
98 | cmd = in.read(); | |
99 |
1
1. decodeMessage : negated conditional → NO_COVERAGE |
if (cmd != -1) { |
100 |
1
1. decodeMessage : negated conditional → NO_COVERAGE |
if (cmd == NetStreamConstants.EVENT_ADD_NODE) { |
101 |
1
1. decodeMessage : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::serve_EVENT_ADD_NODE → NO_COVERAGE |
serve_EVENT_ADD_NODE(in); |
102 |
3
1. decodeMessage : Replaced bitwise AND with OR → NO_COVERAGE 2. decodeMessage : Replaced bitwise AND with OR → NO_COVERAGE 3. decodeMessage : negated conditional → NO_COVERAGE |
} else if ((cmd & 0xFF) == (NetStreamConstants.EVENT_DEL_NODE & 0xFF)) { |
103 |
1
1. decodeMessage : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::serve_DEL_NODE → NO_COVERAGE |
serve_DEL_NODE(in); |
104 |
1
1. decodeMessage : negated conditional → NO_COVERAGE |
} else if (cmd == NetStreamConstants.EVENT_ADD_EDGE) { |
105 |
1
1. decodeMessage : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::serve_EVENT_ADD_EDGE → NO_COVERAGE |
serve_EVENT_ADD_EDGE(in); |
106 |
1
1. decodeMessage : negated conditional → NO_COVERAGE |
} else if (NetStreamConstants.EVENT_DEL_EDGE == cmd) { |
107 |
1
1. decodeMessage : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::serve_EVENT_DEL_EDGE → NO_COVERAGE |
serve_EVENT_DEL_EDGE(in); |
108 |
1
1. decodeMessage : negated conditional → NO_COVERAGE |
} else if (cmd == NetStreamConstants.EVENT_STEP) { |
109 |
1
1. decodeMessage : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::serve_EVENT_STEP → NO_COVERAGE |
serve_EVENT_STEP(in); |
110 |
1
1. decodeMessage : negated conditional → NO_COVERAGE |
} else if (cmd == NetStreamConstants.EVENT_CLEARED) { |
111 |
1
1. decodeMessage : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::serve_EVENT_CLEARED → NO_COVERAGE |
serve_EVENT_CLEARED(in); |
112 |
1
1. decodeMessage : negated conditional → NO_COVERAGE |
} else if (cmd == NetStreamConstants.EVENT_ADD_GRAPH_ATTR) { |
113 |
1
1. decodeMessage : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::serve_EVENT_ADD_GRAPH_ATTR → NO_COVERAGE |
serve_EVENT_ADD_GRAPH_ATTR(in); |
114 |
1
1. decodeMessage : negated conditional → NO_COVERAGE |
} else if (cmd == NetStreamConstants.EVENT_CHG_GRAPH_ATTR) { |
115 |
1
1. decodeMessage : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::serve_EVENT_CHG_GRAPH_ATTR → NO_COVERAGE |
serve_EVENT_CHG_GRAPH_ATTR(in); |
116 |
1
1. decodeMessage : negated conditional → NO_COVERAGE |
} else if (cmd == NetStreamConstants.EVENT_DEL_GRAPH_ATTR) { |
117 |
1
1. decodeMessage : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::serve_EVENT_DEL_GRAPH_ATTR → NO_COVERAGE |
serve_EVENT_DEL_GRAPH_ATTR(in); |
118 |
1
1. decodeMessage : negated conditional → NO_COVERAGE |
} else if (cmd == NetStreamConstants.EVENT_ADD_NODE_ATTR) { |
119 |
1
1. decodeMessage : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::serve_EVENT_ADD_NODE_ATTR → NO_COVERAGE |
serve_EVENT_ADD_NODE_ATTR(in); |
120 |
1
1. decodeMessage : negated conditional → NO_COVERAGE |
} else if (cmd == NetStreamConstants.EVENT_CHG_NODE_ATTR) { |
121 |
1
1. decodeMessage : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::serve_EVENT_CHG_NODE_ATTR → NO_COVERAGE |
serve_EVENT_CHG_NODE_ATTR(in); |
122 |
1
1. decodeMessage : negated conditional → NO_COVERAGE |
} else if (cmd == NetStreamConstants.EVENT_DEL_NODE_ATTR) { |
123 |
1
1. decodeMessage : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::serve_EVENT_DEL_NODE_ATTR → NO_COVERAGE |
serve_EVENT_DEL_NODE_ATTR(in); |
124 |
1
1. decodeMessage : negated conditional → NO_COVERAGE |
} else if (cmd == NetStreamConstants.EVENT_ADD_EDGE_ATTR) { |
125 |
1
1. decodeMessage : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::serve_EVENT_ADD_EDGE_ATTR → NO_COVERAGE |
serve_EVENT_ADD_EDGE_ATTR(in); |
126 |
1
1. decodeMessage : negated conditional → NO_COVERAGE |
} else if (cmd == NetStreamConstants.EVENT_CHG_EDGE_ATTR) { |
127 |
1
1. decodeMessage : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::serve_EVENT_CHG_EDGE_ATTR → NO_COVERAGE |
serve_EVENT_CHG_EDGE_ATTR(in); |
128 |
1
1. decodeMessage : negated conditional → NO_COVERAGE |
} else if (cmd == NetStreamConstants.EVENT_DEL_EDGE_ATTR) { |
129 |
1
1. decodeMessage : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::serve_EVENT_DEL_EDGE_ATTR → NO_COVERAGE |
serve_EVENT_DEL_EDGE_ATTR(in); |
130 |
1
1. decodeMessage : negated conditional → NO_COVERAGE |
} else if (cmd == NetStreamConstants.EVENT_END) { |
131 |
1
1. decodeMessage : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("NetStreamReceiver : Client properly ended the connection."); |
132 | return; | |
133 | } else { | |
134 |
1
1. decodeMessage : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("NetStreamReceiver: Don't know this command: " + cmd); |
135 | return; | |
136 | } | |
137 | cmd = in.read(); | |
138 | } | |
139 | } | |
140 | | |
141 | | |
142 | | |
143 | /** | |
144 | * @param in | |
145 | * @see NetStreamConstants.EVENT_DEL_EDGE | |
146 | */ | |
147 | protected void serve_EVENT_DEL_EDGE_ATTR(InputStream in) { | |
148 |
1
1. serve_EVENT_DEL_EDGE_ATTR : negated conditional → NO_COVERAGE |
if (debug) { |
149 |
1
1. serve_EVENT_DEL_EDGE_ATTR : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("NetStreamServer: Received DEL_EDGE_ATTR command."); |
150 | } | |
151 | String sourceId = readString(in); | |
152 | long timeId = readUnsignedVarint(in); | |
153 | String edgeId = readString(in); | |
154 | String attrId = readString(in); | |
155 |
1
1. serve_EVENT_DEL_EDGE_ATTR : removed call to org/graphstream/stream/thread/ThreadProxyPipe::edgeAttributeRemoved → NO_COVERAGE |
currentStream.edgeAttributeRemoved(sourceId, timeId, edgeId, attrId); |
156 | } | |
157 | ||
158 | /** | |
159 | * @see NetStreamConstants.EVENT_CHG_EDGE_ATTR | |
160 | */ | |
161 | protected void serve_EVENT_CHG_EDGE_ATTR(InputStream in) { | |
162 |
1
1. serve_EVENT_CHG_EDGE_ATTR : negated conditional → NO_COVERAGE |
if (debug) { |
163 |
1
1. serve_EVENT_CHG_EDGE_ATTR : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("NetStreamServer: Received CHG_EDGE_ATTR command."); |
164 | } | |
165 | String sourceId = readString(in); | |
166 | long timeId = readUnsignedVarint(in); | |
167 | String edgeId = readString(in); | |
168 | String attrId = readString(in); | |
169 | int oldValueType = readType(in); | |
170 | Object oldValue = readValue(in, oldValueType); | |
171 | int newValueType = readType(in); | |
172 | Object newValue = readValue(in, newValueType); | |
173 | ||
174 |
1
1. serve_EVENT_CHG_EDGE_ATTR : removed call to org/graphstream/stream/thread/ThreadProxyPipe::edgeAttributeChanged → NO_COVERAGE |
currentStream.edgeAttributeChanged(sourceId, timeId, edgeId, attrId, |
175 | oldValue, newValue); | |
176 | ||
177 | } | |
178 | ||
179 | /** | |
180 | * @see NetStreamConstants.EVENT_ADD_EDGE_ATTR | |
181 | */ | |
182 | protected void serve_EVENT_ADD_EDGE_ATTR(InputStream in) { | |
183 |
1
1. serve_EVENT_ADD_EDGE_ATTR : negated conditional → NO_COVERAGE |
if (debug) { |
184 |
1
1. serve_EVENT_ADD_EDGE_ATTR : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("NetStreamServer: Received ADD_EDGE_ATTR command."); |
185 | } | |
186 | String sourceId = readString(in); | |
187 | long timeId = readUnsignedVarint(in); | |
188 | String edgeId = readString(in); | |
189 | String attrId = readString(in); | |
190 | Object value = readValue(in, readType(in)); | |
191 | ||
192 |
1
1. serve_EVENT_ADD_EDGE_ATTR : removed call to org/graphstream/stream/thread/ThreadProxyPipe::edgeAttributeAdded → NO_COVERAGE |
currentStream.edgeAttributeAdded(sourceId, timeId, edgeId, attrId, |
193 | value); | |
194 | ||
195 | } | |
196 | ||
197 | /** | |
198 | * @see NetStreamConstants.EVENT_DEL_NODE_ATTR | |
199 | */ | |
200 | protected void serve_EVENT_DEL_NODE_ATTR(InputStream in) { | |
201 |
1
1. serve_EVENT_DEL_NODE_ATTR : negated conditional → NO_COVERAGE |
if (debug) { |
202 |
1
1. serve_EVENT_DEL_NODE_ATTR : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("NetStreamServer: Received DEL_NODE_ATTR command."); |
203 | } | |
204 | String sourceId = readString(in); | |
205 | long timeId = readUnsignedVarint(in); | |
206 | String nodeId = readString(in); | |
207 | String attrId = readString(in); | |
208 | ||
209 |
1
1. serve_EVENT_DEL_NODE_ATTR : removed call to org/graphstream/stream/thread/ThreadProxyPipe::nodeAttributeRemoved → NO_COVERAGE |
currentStream.nodeAttributeRemoved(sourceId, timeId, nodeId, attrId); |
210 | ||
211 | } | |
212 | ||
213 | /** | |
214 | * @see NetStreamConstants.EVENT_CHG_NODE_ATTR | |
215 | */ | |
216 | protected void serve_EVENT_CHG_NODE_ATTR(InputStream in) { | |
217 |
1
1. serve_EVENT_CHG_NODE_ATTR : negated conditional → NO_COVERAGE |
if (debug) { |
218 |
1
1. serve_EVENT_CHG_NODE_ATTR : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("NetStreamServer: Received EVENT_CHG_NODE_ATTR command."); |
219 | } | |
220 | String sourceId = readString(in); | |
221 | long timeId = readUnsignedVarint(in); | |
222 | String nodeId = readString(in); | |
223 | String attrId = readString(in); | |
224 | int oldValueType = readType(in); | |
225 | Object oldValue = readValue(in, oldValueType); | |
226 | int newValueType = readType(in); | |
227 | Object newValue = readValue(in, newValueType); | |
228 | ||
229 |
1
1. serve_EVENT_CHG_NODE_ATTR : removed call to org/graphstream/stream/thread/ThreadProxyPipe::nodeAttributeChanged → NO_COVERAGE |
currentStream.nodeAttributeChanged(sourceId, timeId, nodeId, attrId, |
230 | oldValue, newValue); | |
231 | } | |
232 | ||
233 | /** | |
234 | * @see NetStreamConstants.EVENT_ADD_NODE_ATTR | |
235 | */ | |
236 | protected void serve_EVENT_ADD_NODE_ATTR(InputStream in) { | |
237 |
1
1. serve_EVENT_ADD_NODE_ATTR : negated conditional → NO_COVERAGE |
if (debug) { |
238 |
1
1. serve_EVENT_ADD_NODE_ATTR : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("NetStreamServer: Received EVENT_ADD_NODE_ATTR command."); |
239 | } | |
240 | String sourceId = readString(in); | |
241 | long timeId = readUnsignedVarint(in); | |
242 | String nodeId = readString(in); | |
243 | String attrId = readString(in); | |
244 | Object value = readValue(in, readType(in)); | |
245 | ||
246 |
1
1. serve_EVENT_ADD_NODE_ATTR : removed call to org/graphstream/stream/thread/ThreadProxyPipe::nodeAttributeAdded → NO_COVERAGE |
currentStream.nodeAttributeAdded(sourceId, timeId, nodeId, attrId, |
247 | value); | |
248 | } | |
249 | ||
250 | /** | |
251 | * @see NetStreamConstants.EVENT_DEL_GRAPH_ATTR | |
252 | */ | |
253 | protected void serve_EVENT_DEL_GRAPH_ATTR(InputStream in) { | |
254 |
1
1. serve_EVENT_DEL_GRAPH_ATTR : negated conditional → NO_COVERAGE |
if (debug) { |
255 |
1
1. serve_EVENT_DEL_GRAPH_ATTR : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("NetStreamServer: Received EVENT_DEL_GRAPH_ATTR command."); |
256 | } | |
257 | String sourceId = readString(in); | |
258 | long timeId = readUnsignedVarint(in); | |
259 | String attrId = readString(in); | |
260 | ||
261 |
1
1. serve_EVENT_DEL_GRAPH_ATTR : removed call to org/graphstream/stream/thread/ThreadProxyPipe::graphAttributeRemoved → NO_COVERAGE |
currentStream.graphAttributeRemoved(sourceId, timeId, attrId); |
262 | } | |
263 | ||
264 | /** | |
265 | * @see NetStreamConstants.EVENT_CHG_GRAPH_ATTR | |
266 | */ | |
267 | protected void serve_EVENT_CHG_GRAPH_ATTR(InputStream in) { | |
268 |
1
1. serve_EVENT_CHG_GRAPH_ATTR : negated conditional → NO_COVERAGE |
if (debug) { |
269 |
1
1. serve_EVENT_CHG_GRAPH_ATTR : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("NetStreamServer: Received EVENT_CHG_GRAPH_ATTR command."); |
270 | } | |
271 | String sourceId = readString(in); | |
272 | long timeId = readUnsignedVarint(in); | |
273 | String attrId = readString(in); | |
274 | int oldValueType = readType(in); | |
275 | Object oldValue = readValue(in, oldValueType); | |
276 | int newValueType = readType(in); | |
277 | Object newValue = readValue(in, newValueType); | |
278 | ||
279 |
1
1. serve_EVENT_CHG_GRAPH_ATTR : removed call to org/graphstream/stream/thread/ThreadProxyPipe::graphAttributeChanged → NO_COVERAGE |
currentStream.graphAttributeChanged(sourceId, timeId, attrId, oldValue, |
280 | newValue); | |
281 | ||
282 | } | |
283 | ||
284 | /** | |
285 | * @see NetStreamConstants.EVENT_ADD_GRAPH_ATTR | |
286 | */ | |
287 | protected void serve_EVENT_ADD_GRAPH_ATTR(InputStream in) { | |
288 |
1
1. serve_EVENT_ADD_GRAPH_ATTR : negated conditional → NO_COVERAGE |
if (debug) { |
289 |
1
1. serve_EVENT_ADD_GRAPH_ATTR : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("NetStreamServer: Received EVENT_ADD_GRAPH_ATTR command."); |
290 | } | |
291 | String sourceId = readString(in); | |
292 | long timeId = readUnsignedVarint(in); | |
293 | String attrId = readString(in); | |
294 | Object value = readValue(in, readType(in)); | |
295 |
1
1. serve_EVENT_ADD_GRAPH_ATTR : negated conditional → NO_COVERAGE |
if (debug) { |
296 |
1
1. serve_EVENT_ADD_GRAPH_ATTR : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("NetStreamServer | EVENT_ADD_GRAPH_ATTR | %s=%s", attrId, |
297 | value.toString()); | |
298 | } | |
299 |
1
1. serve_EVENT_ADD_GRAPH_ATTR : removed call to org/graphstream/stream/thread/ThreadProxyPipe::graphAttributeAdded → NO_COVERAGE |
currentStream.graphAttributeAdded(sourceId, timeId, attrId, value); |
300 | ||
301 | } | |
302 | ||
303 | /** | |
304 | * @see NetStreamConstants.EVENT_CLEARED | |
305 | */ | |
306 | protected void serve_EVENT_CLEARED(InputStream in) { | |
307 |
1
1. serve_EVENT_CLEARED : negated conditional → NO_COVERAGE |
if (debug) { |
308 |
1
1. serve_EVENT_CLEARED : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("NetStreamServer: Received EVENT_CLEARED command."); |
309 | } | |
310 | String sourceId = readString(in); | |
311 | long timeId = readUnsignedVarint(in); | |
312 |
1
1. serve_EVENT_CLEARED : removed call to org/graphstream/stream/thread/ThreadProxyPipe::graphCleared → NO_COVERAGE |
currentStream.graphCleared(sourceId, timeId); |
313 | ||
314 | } | |
315 | ||
316 | /** | |
317 | * @see NetStreamConstants.EVENT_STEP | |
318 | */ | |
319 | protected void serve_EVENT_STEP(InputStream in) { | |
320 |
1
1. serve_EVENT_STEP : negated conditional → NO_COVERAGE |
if (debug) { |
321 |
1
1. serve_EVENT_STEP : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("NetStreamServer: Received EVENT_STEP command."); |
322 | } | |
323 | String sourceId = readString(in); | |
324 | long timeId = readUnsignedVarint(in); | |
325 | double time = readDouble(in); | |
326 |
1
1. serve_EVENT_STEP : removed call to org/graphstream/stream/thread/ThreadProxyPipe::stepBegins → NO_COVERAGE |
currentStream.stepBegins(sourceId, timeId, time); |
327 | } | |
328 | ||
329 | /** | |
330 | * @see NetStreamConstants.EVENT_DEL_EDGE | |
331 | */ | |
332 | protected void serve_EVENT_DEL_EDGE(InputStream in) { | |
333 |
1
1. serve_EVENT_DEL_EDGE : negated conditional → NO_COVERAGE |
if (debug) { |
334 |
1
1. serve_EVENT_DEL_EDGE : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("NetStreamServer: Received EVENT_DEL_EDGE command."); |
335 | } | |
336 | String sourceId = readString(in); | |
337 | long timeId = readUnsignedVarint(in); | |
338 | String edgeId = readString(in); | |
339 |
1
1. serve_EVENT_DEL_EDGE : removed call to org/graphstream/stream/thread/ThreadProxyPipe::edgeRemoved → NO_COVERAGE |
currentStream.edgeRemoved(sourceId, timeId, edgeId); |
340 | } | |
341 | ||
342 | /** | |
343 | * @see NetStreamConstants.EVENT_ADD_EDGE | |
344 | */ | |
345 | protected void serve_EVENT_ADD_EDGE(InputStream in) { | |
346 |
1
1. serve_EVENT_ADD_EDGE : negated conditional → NO_COVERAGE |
if (debug) { |
347 |
1
1. serve_EVENT_ADD_EDGE : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("NetStreamServer: Received ADD_EDGE command."); |
348 | } | |
349 | String sourceId = readString(in); | |
350 | long timeId = readUnsignedVarint(in); | |
351 | String edgeId = readString(in); | |
352 | String from = readString(in); | |
353 | String to = readString(in); | |
354 | boolean directed = readBoolean(in); | |
355 |
1
1. serve_EVENT_ADD_EDGE : removed call to org/graphstream/stream/thread/ThreadProxyPipe::edgeAdded → NO_COVERAGE |
currentStream.edgeAdded(sourceId, timeId, edgeId, from, to, directed); |
356 | } | |
357 | ||
358 | /** | |
359 | * @see NetStreamConstants.DEL_NODE | |
360 | */ | |
361 | protected void serve_DEL_NODE(InputStream in) { | |
362 |
1
1. serve_DEL_NODE : negated conditional → NO_COVERAGE |
if (debug) { |
363 |
1
1. serve_DEL_NODE : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("NetStreamServer: Received DEL_NODE command."); |
364 | } | |
365 | String sourceId = readString(in); | |
366 | long timeId = readUnsignedVarint(in); | |
367 | String nodeId = readString(in); | |
368 |
1
1. serve_DEL_NODE : removed call to org/graphstream/stream/thread/ThreadProxyPipe::nodeRemoved → NO_COVERAGE |
currentStream.nodeRemoved(sourceId, timeId, nodeId); |
369 | } | |
370 | ||
371 | /** | |
372 | * @see NetStreamConstants.EVENT_ADD_NODE | |
373 | */ | |
374 | protected void serve_EVENT_ADD_NODE(InputStream in) { | |
375 |
1
1. serve_EVENT_ADD_NODE : negated conditional → NO_COVERAGE |
if (debug) { |
376 |
1
1. serve_EVENT_ADD_NODE : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("NetStreamServer: Received EVENT_ADD_NODE command"); |
377 | } | |
378 | String sourceId = readString(in); | |
379 | long timeId = readUnsignedVarint(in); | |
380 | String nodeId = readString(in); | |
381 |
1
1. serve_EVENT_ADD_NODE : removed call to org/graphstream/stream/thread/ThreadProxyPipe::nodeAdded → NO_COVERAGE |
currentStream.nodeAdded(sourceId, timeId, nodeId); |
382 | ||
383 | } | |
384 | ||
385 | /** | |
386 | * @param in | |
387 | * @return | |
388 | */ | |
389 | protected int readType(InputStream in) { | |
390 | try { | |
391 | int data = 0; | |
392 |
1
1. readType : negated conditional → NO_COVERAGE |
if ((data = in.read()) == -1) { |
393 |
1
1. readType : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("readType : could not read type"); |
394 |
1
1. readType : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return 0; |
395 | } | |
396 |
1
1. readType : negated conditional → NO_COVERAGE |
if (debug) { |
397 |
1
1. readType : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("NetStreamServer: type "+data); |
398 | } | |
399 |
1
1. readType : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return data; |
400 | } catch (IOException e) { | |
401 |
1
1. readType : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("readType: could not read type"); |
402 |
1
1. readType : removed call to java/io/IOException::printStackTrace → NO_COVERAGE |
e.printStackTrace(); |
403 | } | |
404 | ||
405 |
1
1. readType : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE |
return 0; |
406 | } | |
407 | ||
408 | protected Object readValue(InputStream in, int valueType) { | |
409 |
1
1. readValue : negated conditional → NO_COVERAGE |
if (NetStreamConstants.TYPE_BOOLEAN == valueType) { |
410 |
1
1. readValue : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return readBoolean(in); |
411 |
1
1. readValue : negated conditional → NO_COVERAGE |
} else if (NetStreamConstants.TYPE_BOOLEAN_ARRAY == valueType) { |
412 |
1
1. readValue : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return readBooleanArray(in); |
413 |
1
1. readValue : negated conditional → NO_COVERAGE |
} else if (NetStreamConstants.TYPE_BYTE == valueType) { |
414 |
1
1. readValue : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return readByte(in); |
415 |
1
1. readValue : negated conditional → NO_COVERAGE |
} else if (NetStreamConstants.TYPE_BYTE_ARRAY == valueType) { |
416 |
1
1. readValue : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return readByteArray(in); |
417 |
1
1. readValue : negated conditional → NO_COVERAGE |
} else if (NetStreamConstants.TYPE_SHORT == valueType) { |
418 |
1
1. readValue : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return readShort(in); |
419 |
1
1. readValue : negated conditional → NO_COVERAGE |
} else if (NetStreamConstants.TYPE_SHORT_ARRAY == valueType) { |
420 |
1
1. readValue : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return readShortArray(in); |
421 |
1
1. readValue : negated conditional → NO_COVERAGE |
} else if (NetStreamConstants.TYPE_INT == valueType) { |
422 |
1
1. readValue : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return readInt(in); |
423 |
1
1. readValue : negated conditional → NO_COVERAGE |
} else if (NetStreamConstants.TYPE_INT_ARRAY == valueType) { |
424 |
1
1. readValue : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return readIntArray(in); |
425 |
1
1. readValue : negated conditional → NO_COVERAGE |
} else if (NetStreamConstants.TYPE_LONG == valueType) { |
426 |
1
1. readValue : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return readLong(in); |
427 |
1
1. readValue : negated conditional → NO_COVERAGE |
} else if (NetStreamConstants.TYPE_LONG_ARRAY == valueType) { |
428 |
1
1. readValue : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return readLongArray(in); |
429 |
1
1. readValue : negated conditional → NO_COVERAGE |
} else if (NetStreamConstants.TYPE_FLOAT == valueType) { |
430 |
1
1. readValue : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return readFloat(in); |
431 |
1
1. readValue : negated conditional → NO_COVERAGE |
} else if (NetStreamConstants.TYPE_FLOAT_ARRAY == valueType) { |
432 |
1
1. readValue : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return readFloatArray(in); |
433 |
1
1. readValue : negated conditional → NO_COVERAGE |
} else if (NetStreamConstants.TYPE_DOUBLE == valueType) { |
434 |
1
1. readValue : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return readDouble(in); |
435 |
1
1. readValue : negated conditional → NO_COVERAGE |
} else if (NetStreamConstants.TYPE_DOUBLE_ARRAY == valueType) { |
436 |
1
1. readValue : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return readDoubleArray(in); |
437 |
1
1. readValue : negated conditional → NO_COVERAGE |
} else if (NetStreamConstants.TYPE_STRING == valueType) { |
438 |
1
1. readValue : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return readString(in); |
439 |
1
1. readValue : negated conditional → NO_COVERAGE |
} else if (NetStreamConstants.TYPE_ARRAY == valueType) { |
440 |
1
1. readValue : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return readArray(in); |
441 | } | |
442 |
1
1. readValue : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readValue to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return null; |
443 | } | |
444 | ||
445 | /** | |
446 | * @param in | |
447 | * @return | |
448 | */ | |
449 | protected Object[] readArray(InputStream in) { | |
450 | ||
451 | int len = (int) readUnsignedVarint(in); | |
452 | ||
453 | Object[] array = new Object[len]; | |
454 |
3
1. readArray : changed conditional boundary → NO_COVERAGE 2. readArray : Changed increment from 1 to -1 → NO_COVERAGE 3. readArray : negated conditional → NO_COVERAGE |
for (int i = 0; i < len; i++) { |
455 | array[i] = readValue(in, readType(in)); | |
456 | } | |
457 |
1
1. readArray : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readArray to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return array; |
458 | ||
459 | } | |
460 | ||
461 | protected String readString(InputStream in) { | |
462 | try { | |
463 | ||
464 | int len = (int) readUnsignedVarint(in); | |
465 | byte[] data = new byte[len]; | |
466 |
1
1. readString : negated conditional → NO_COVERAGE |
if (in.read(data, 0, len) != len) { |
467 |
1
1. readString : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return null; |
468 | } | |
469 | String s = new String(data, Charset.forName("UTF-8")); | |
470 |
1
1. readString : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return s; |
471 | } catch (IOException e) { | |
472 |
1
1. readString : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("readString: could not read string"); |
473 |
1
1. readString : removed call to java/io/IOException::printStackTrace → NO_COVERAGE |
e.printStackTrace(); |
474 | } | |
475 |
1
1. readString : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return null; |
476 | } | |
477 | ||
478 | protected Boolean readBoolean(InputStream in) { | |
479 | int data = 0; | |
480 | try { | |
481 | data = in.read(); | |
482 | } catch (IOException e) { | |
483 |
1
1. readBoolean : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("readByte: could not read"); |
484 |
1
1. readBoolean : removed call to java/io/IOException::printStackTrace → NO_COVERAGE |
e.printStackTrace(); |
485 | } | |
486 |
2
1. readBoolean : negated conditional → NO_COVERAGE 2. readBoolean : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readBoolean to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return data == 0 ? false : true; |
487 | } | |
488 | ||
489 | protected Byte readByte(InputStream in) { | |
490 | byte data = 0; | |
491 | try { | |
492 | data = (byte) in.read(); | |
493 | } catch (IOException e) { | |
494 |
1
1. readByte : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("readByte: could not read"); |
495 |
1
1. readByte : removed call to java/io/IOException::printStackTrace → NO_COVERAGE |
e.printStackTrace(); |
496 | } | |
497 |
1
1. readByte : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return data; |
498 | } | |
499 | ||
500 | protected long readUnsignedVarint(InputStream in) { | |
501 | try { | |
502 | ||
503 | int size = 0; | |
504 | long[] data = new long[9]; | |
505 | do { | |
506 | data[size] = in.read(); | |
507 | | |
508 |
1
1. readUnsignedVarint : Changed increment from 1 to -1 → NO_COVERAGE |
size++; |
509 | | |
510 | //int bt =data[size-1]; | |
511 | //if (bt < 0) bt = (bt & 127) + (bt & 128); | |
512 | //System.out.println("test "+bt+" -> "+(data[size - 1]& 128) ); | |
513 |
3
1. readUnsignedVarint : Replaced integer subtraction with addition → NO_COVERAGE 2. readUnsignedVarint : Replaced bitwise AND with OR → NO_COVERAGE 3. readUnsignedVarint : negated conditional → NO_COVERAGE |
} while ((data[size - 1] & 128) == 128); |
514 | long number = 0; | |
515 |
3
1. readUnsignedVarint : changed conditional boundary → NO_COVERAGE 2. readUnsignedVarint : Changed increment from 1 to -1 → NO_COVERAGE 3. readUnsignedVarint : negated conditional → NO_COVERAGE |
for (int i = 0; i < size; i++) { |
516 | ||
517 |
4
1. readUnsignedVarint : Replaced bitwise AND with OR → NO_COVERAGE 2. readUnsignedVarint : Replaced long multiplication with division → NO_COVERAGE 3. readUnsignedVarint : Replaced Shift Left with Shift Right → NO_COVERAGE 4. readUnsignedVarint : Replaced XOR with AND → NO_COVERAGE |
number ^= (data[i] & 127L) << (i * 7L); |
518 | | |
519 | } | |
520 | | |
521 |
1
1. readUnsignedVarint : replaced return of long value with value + 1 for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readUnsignedVarint → NO_COVERAGE |
return number; |
522 | ||
523 | } catch (IOException e) { | |
524 |
1
1. readUnsignedVarint : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("readUnsignedVarintFromInteger: could not read"); |
525 |
1
1. readUnsignedVarint : removed call to java/io/IOException::printStackTrace → NO_COVERAGE |
e.printStackTrace(); |
526 | } | |
527 |
1
1. readUnsignedVarint : replaced return of long value with value + 1 for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readUnsignedVarint → NO_COVERAGE |
return 0L; |
528 | } | |
529 | | |
530 | | |
531 | ||
532 | protected long readVarint(InputStream in) { | |
533 | long number = readUnsignedVarint(in); | |
534 |
6
1. readVarint : removed negation → NO_COVERAGE 2. readVarint : Replaced bitwise AND with OR → NO_COVERAGE 3. readVarint : Replaced Shift Right with Shift Left → NO_COVERAGE 4. readVarint : Replaced Shift Right with Shift Left → NO_COVERAGE 5. readVarint : negated conditional → NO_COVERAGE 6. readVarint : replaced return of long value with value + 1 for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readVarint → NO_COVERAGE |
return ((number & 1) == 0) ? number >> 1 : -(number >> 1); |
535 | } | |
536 | ||
537 | protected Short readShort(InputStream in) { | |
538 |
1
1. readShort : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readShort to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return (short) readVarint(in); |
539 | } | |
540 | ||
541 | protected Integer readInt(InputStream in) { | |
542 |
1
1. readInt : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readInt to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return (int) readVarint(in); |
543 | } | |
544 | ||
545 | protected Long readLong(InputStream in) { | |
546 |
1
1. readLong : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readLong to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return readVarint(in); |
547 | } | |
548 | ||
549 | protected Float readFloat(InputStream in) { | |
550 | byte[] data = new byte[4]; | |
551 | try { | |
552 |
1
1. readFloat : negated conditional → NO_COVERAGE |
if (in.read(data, 0, 4) != 4) { |
553 |
1
1. readFloat : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("readFloat: could not read"); |
554 |
1
1. readFloat : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readFloat to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return 0f; |
555 | } | |
556 | } catch (IOException e) { | |
557 |
1
1. readFloat : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("readFloat: could not read"); |
558 |
1
1. readFloat : removed call to java/io/IOException::printStackTrace → NO_COVERAGE |
e.printStackTrace(); |
559 | } | |
560 | ByteBuffer bb = ByteBuffer.allocate(4); | |
561 | bb.put(data); | |
562 | bb.flip(); | |
563 |
1
1. readFloat : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readFloat to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return bb.getFloat(); |
564 | } | |
565 | ||
566 | protected Double readDouble(InputStream in) { | |
567 | byte[] data = new byte[8]; | |
568 | try { | |
569 |
1
1. readDouble : negated conditional → NO_COVERAGE |
if (in.read(data, 0, 8) != 8) { |
570 |
1
1. readDouble : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("readDouble: could not read"); |
571 |
1
1. readDouble : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readDouble to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return 0.0; |
572 | } | |
573 | } catch (IOException e) { | |
574 |
1
1. readDouble : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("readDouble: could not read"); |
575 |
1
1. readDouble : removed call to java/io/IOException::printStackTrace → NO_COVERAGE |
e.printStackTrace(); |
576 | } | |
577 | ByteBuffer bb = ByteBuffer.allocate(8); | |
578 | bb.put(data); | |
579 | bb.flip(); | |
580 |
1
1. readDouble : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readDouble to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return bb.getDouble(); |
581 | } | |
582 | ||
583 | /** | |
584 | * @param in | |
585 | * @return | |
586 | * @throws IOException | |
587 | */ | |
588 | protected Integer[] readIntArray(InputStream in) { | |
589 | | |
590 | int len = (int) readUnsignedVarint(in); | |
591 | ||
592 | Integer[] res = new Integer[len]; | |
593 |
3
1. readIntArray : changed conditional boundary → NO_COVERAGE 2. readIntArray : Changed increment from 1 to -1 → NO_COVERAGE 3. readIntArray : negated conditional → NO_COVERAGE |
for (int i = 0; i < len; i++) { |
594 | res[i] = (int) readVarint(in); | |
595 | //System.out.printf("array[%d]=%d%n",i,res[i]); | |
596 | } | |
597 |
1
1. readIntArray : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readIntArray to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return res; |
598 | } | |
599 | ||
600 | protected Boolean[] readBooleanArray(InputStream in) { | |
601 | byte[] data = null; | |
602 | ||
603 | try { | |
604 | int len = (int) readUnsignedVarint(in); | |
605 | ||
606 | data = new byte[len]; | |
607 |
1
1. readBooleanArray : negated conditional → NO_COVERAGE |
if (in.read(data, 0, len) != len) { |
608 |
1
1. readBooleanArray : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("readBooleanArray: could not read array"); |
609 |
1
1. readBooleanArray : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readBooleanArray to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return null; |
610 | } | |
611 | ||
612 | ByteBuffer bb = ByteBuffer.allocate(len); | |
613 | bb.put(data); | |
614 | bb.flip(); | |
615 | Boolean[] res = new Boolean[len]; | |
616 |
3
1. readBooleanArray : changed conditional boundary → NO_COVERAGE 2. readBooleanArray : Changed increment from 1 to -1 → NO_COVERAGE 3. readBooleanArray : negated conditional → NO_COVERAGE |
for (int i = 0; i < len; i++) { |
617 | ||
618 | byte b = bb.get(); | |
619 | ||
620 |
1
1. readBooleanArray : negated conditional → NO_COVERAGE |
res[i] = b == 0 ? false : true; |
621 | } | |
622 |
1
1. readBooleanArray : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readBooleanArray to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return res; |
623 | } catch (IOException e) { | |
624 |
1
1. readBooleanArray : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("readBooleanArray: could not read array"); |
625 |
1
1. readBooleanArray : removed call to java/io/IOException::printStackTrace → NO_COVERAGE |
e.printStackTrace(); |
626 | } | |
627 |
1
1. readBooleanArray : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readBooleanArray to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return null; |
628 | } | |
629 | ||
630 | protected Byte[] readByteArray(InputStream in) { | |
631 | byte[] data = null; | |
632 | ||
633 | try { | |
634 | int len = (int) readUnsignedVarint(in); | |
635 | ||
636 | data = new byte[len]; | |
637 |
1
1. readByteArray : negated conditional → NO_COVERAGE |
if (in.read(data, 0, len) != len) { |
638 |
1
1. readByteArray : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("readByteArray: could not read array"); |
639 |
1
1. readByteArray : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readByteArray to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return null; |
640 | } | |
641 | ||
642 | ByteBuffer bb = ByteBuffer.allocate(len); | |
643 | bb.put(data); | |
644 | bb.flip(); | |
645 | Byte[] res = new Byte[len]; | |
646 |
3
1. readByteArray : changed conditional boundary → NO_COVERAGE 2. readByteArray : Changed increment from 1 to -1 → NO_COVERAGE 3. readByteArray : negated conditional → NO_COVERAGE |
for (int i = 0; i < len; i++) { |
647 | ||
648 | res[i] = bb.get(); | |
649 | ||
650 | } | |
651 |
1
1. readByteArray : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readByteArray to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return res; |
652 | } catch (IOException e) { | |
653 |
1
1. readByteArray : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("readBooleanArray: could not read array"); |
654 |
1
1. readByteArray : removed call to java/io/IOException::printStackTrace → NO_COVERAGE |
e.printStackTrace(); |
655 | } | |
656 |
1
1. readByteArray : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readByteArray to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return null; |
657 | } | |
658 | ||
659 | protected Double[] readDoubleArray(InputStream in) { | |
660 | byte[] data = null; | |
661 | ||
662 | try { | |
663 | int len = (int) readUnsignedVarint(in); | |
664 | ||
665 |
1
1. readDoubleArray : Replaced integer multiplication with division → NO_COVERAGE |
data = new byte[len * 8]; |
666 |
3
1. readDoubleArray : Replaced integer multiplication with division → NO_COVERAGE 2. readDoubleArray : Replaced integer multiplication with division → NO_COVERAGE 3. readDoubleArray : negated conditional → NO_COVERAGE |
if (in.read(data, 0, len * 8) != len * 8) { |
667 |
1
1. readDoubleArray : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("readDoubleArray: could not read array"); |
668 |
1
1. readDoubleArray : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readDoubleArray to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return null; |
669 | } | |
670 | ||
671 |
1
1. readDoubleArray : Replaced integer multiplication with division → NO_COVERAGE |
ByteBuffer bb = ByteBuffer.allocate(8 * len); |
672 | bb.put(data); | |
673 | bb.flip(); | |
674 | Double[] res = new Double[len]; | |
675 |
3
1. readDoubleArray : changed conditional boundary → NO_COVERAGE 2. readDoubleArray : Changed increment from 1 to -1 → NO_COVERAGE 3. readDoubleArray : negated conditional → NO_COVERAGE |
for (int i = 0; i < len; i++) { |
676 | ||
677 | res[i] = bb.getDouble(); | |
678 | } | |
679 |
1
1. readDoubleArray : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readDoubleArray to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return res; |
680 | } catch (IOException e) { | |
681 |
1
1. readDoubleArray : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("readDoubleArray: could not read array"); |
682 |
1
1. readDoubleArray : removed call to java/io/IOException::printStackTrace → NO_COVERAGE |
e.printStackTrace(); |
683 | } | |
684 |
1
1. readDoubleArray : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readDoubleArray to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return null; |
685 | } | |
686 | ||
687 | protected Float[] readFloatArray(InputStream in) { | |
688 | byte[] data = null; | |
689 | ||
690 | try { | |
691 | int len = (int) readUnsignedVarint(in); | |
692 | ||
693 |
1
1. readFloatArray : Replaced integer multiplication with division → NO_COVERAGE |
data = new byte[len * 4]; |
694 |
3
1. readFloatArray : Replaced integer multiplication with division → NO_COVERAGE 2. readFloatArray : Replaced integer multiplication with division → NO_COVERAGE 3. readFloatArray : negated conditional → NO_COVERAGE |
if (in.read(data, 0, len * 4) != len * 4) { |
695 |
1
1. readFloatArray : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("readFloatArray: could not read array"); |
696 |
1
1. readFloatArray : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readFloatArray to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return null; |
697 | } | |
698 | ||
699 |
1
1. readFloatArray : Replaced integer multiplication with division → NO_COVERAGE |
ByteBuffer bb = ByteBuffer.allocate(4 * len); |
700 | bb.put(data); | |
701 | bb.flip(); | |
702 | Float[] res = new Float[len]; | |
703 |
3
1. readFloatArray : changed conditional boundary → NO_COVERAGE 2. readFloatArray : Changed increment from 1 to -1 → NO_COVERAGE 3. readFloatArray : negated conditional → NO_COVERAGE |
for (int i = 0; i < len; i++) { |
704 | ||
705 | res[i] = bb.getFloat(); | |
706 | } | |
707 |
1
1. readFloatArray : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readFloatArray to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return res; |
708 | } catch (IOException e) { | |
709 |
1
1. readFloatArray : removed call to org/graphstream/stream/netstream/DefaultNetStreamDecoder::debug → NO_COVERAGE |
debug("readFloatArray: could not read array"); |
710 |
1
1. readFloatArray : removed call to java/io/IOException::printStackTrace → NO_COVERAGE |
e.printStackTrace(); |
711 | } | |
712 |
1
1. readFloatArray : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readFloatArray to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return null; |
713 | } | |
714 | ||
715 | protected Long[] readLongArray(InputStream in) { | |
716 | int len = (int) readUnsignedVarint(in); | |
717 | ||
718 | Long[] res = new Long[len]; | |
719 |
3
1. readLongArray : changed conditional boundary → NO_COVERAGE 2. readLongArray : Changed increment from 1 to -1 → NO_COVERAGE 3. readLongArray : negated conditional → NO_COVERAGE |
for (int i = 0; i < len; i++) { |
720 | res[i] = readVarint(in); | |
721 | } | |
722 |
1
1. readLongArray : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readLongArray to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return res; |
723 | } | |
724 | ||
725 | protected Short[] readShortArray(InputStream in) { | |
726 | int len = (int) readUnsignedVarint(in); | |
727 | ||
728 | Short[] res = new Short[len]; | |
729 |
3
1. readShortArray : changed conditional boundary → NO_COVERAGE 2. readShortArray : Changed increment from 1 to -1 → NO_COVERAGE 3. readShortArray : negated conditional → NO_COVERAGE |
for (int i = 0; i < len; i++) { |
730 | res[i] = (short) readVarint(in); | |
731 | //System.out.printf("array[%d]=%d%n",i,res[i]); | |
732 | } | |
733 |
1
1. readShortArray : mutated return of Object value for org/graphstream/stream/netstream/DefaultNetStreamDecoder::readShortArray to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE |
return res; |
734 | } | |
735 | | |
736 | | |
737 | | |
738 | | |
739 | protected void debug(String message, Object... data) { | |
740 | // System.err.print( LIGHT_YELLOW ); | |
741 | System.err.printf("[//NetStreamDecoder | "); | |
742 | // System.err.print( RESET ); | |
743 | System.err.printf(message, data); | |
744 | // System.err.print( LIGHT_YELLOW ); | |
745 | System.err.printf("]%n"); | |
746 | // System.err.println( RESET ); | |
747 | } | |
748 | ||
749 | /* (non-Javadoc) | |
750 | * @see org.graphstream.stream.netstream.NetStreamDecoder#setDebugOn(boolean) | |
751 | */ | |
752 | public void setDebugOn(boolean on) { | |
753 | debug = on; | |
754 | } | |
755 | ||
756 | } | |
Mutations | ||
51 |
1.1 |
|
55 |
1.1 |
|
63 |
1.1 |
|
67 |
1.1 |
|
75 |
1.1 |
|
80 |
1.1 |
|
81 |
1.1 |
|
93 |
1.1 |
|
94 |
1.1 |
|
99 |
1.1 |
|
100 |
1.1 |
|
101 |
1.1 |
|
102 |
1.1 2.2 3.3 |
|
103 |
1.1 |
|
104 |
1.1 |
|
105 |
1.1 |
|
106 |
1.1 |
|
107 |
1.1 |
|
108 |
1.1 |
|
109 |
1.1 |
|
110 |
1.1 |
|
111 |
1.1 |
|
112 |
1.1 |
|
113 |
1.1 |
|
114 |
1.1 |
|
115 |
1.1 |
|
116 |
1.1 |
|
117 |
1.1 |
|
118 |
1.1 |
|
119 |
1.1 |
|
120 |
1.1 |
|
121 |
1.1 |
|
122 |
1.1 |
|
123 |
1.1 |
|
124 |
1.1 |
|
125 |
1.1 |
|
126 |
1.1 |
|
127 |
1.1 |
|
128 |
1.1 |
|
129 |
1.1 |
|
130 |
1.1 |
|
131 |
1.1 |
|
134 |
1.1 |
|
148 |
1.1 |
|
149 |
1.1 |
|
155 |
1.1 |
|
162 |
1.1 |
|
163 |
1.1 |
|
174 |
1.1 |
|
183 |
1.1 |
|
184 |
1.1 |
|
192 |
1.1 |
|
201 |
1.1 |
|
202 |
1.1 |
|
209 |
1.1 |
|
217 |
1.1 |
|
218 |
1.1 |
|
229 |
1.1 |
|
237 |
1.1 |
|
238 |
1.1 |
|
246 |
1.1 |
|
254 |
1.1 |
|
255 |
1.1 |
|
261 |
1.1 |
|
268 |
1.1 |
|
269 |
1.1 |
|
279 |
1.1 |
|
288 |
1.1 |
|
289 |
1.1 |
|
295 |
1.1 |
|
296 |
1.1 |
|
299 |
1.1 |
|
307 |
1.1 |
|
308 |
1.1 |
|
312 |
1.1 |
|
320 |
1.1 |
|
321 |
1.1 |
|
326 |
1.1 |
|
333 |
1.1 |
|
334 |
1.1 |
|
339 |
1.1 |
|
346 |
1.1 |
|
347 |
1.1 |
|
355 |
1.1 |
|
362 |
1.1 |
|
363 |
1.1 |
|
368 |
1.1 |
|
375 |
1.1 |
|
376 |
1.1 |
|
381 |
1.1 |
|
392 |
1.1 |
|
393 |
1.1 |
|
394 |
1.1 |
|
396 |
1.1 |
|
397 |
1.1 |
|
399 |
1.1 |
|
401 |
1.1 |
|
402 |
1.1 |
|
405 |
1.1 |
|
409 |
1.1 |
|
410 |
1.1 |
|
411 |
1.1 |
|
412 |
1.1 |
|
413 |
1.1 |
|
414 |
1.1 |
|
415 |
1.1 |
|
416 |
1.1 |
|
417 |
1.1 |
|
418 |
1.1 |
|
419 |
1.1 |
|
420 |
1.1 |
|
421 |
1.1 |
|
422 |
1.1 |
|
423 |
1.1 |
|
424 |
1.1 |
|
425 |
1.1 |
|
426 |
1.1 |
|
427 |
1.1 |
|
428 |
1.1 |
|
429 |
1.1 |
|
430 |
1.1 |
|
431 |
1.1 |
|
432 |
1.1 |
|
433 |
1.1 |
|
434 |
1.1 |
|
435 |
1.1 |
|
436 |
1.1 |
|
437 |
1.1 |
|
438 |
1.1 |
|
439 |
1.1 |
|
440 |
1.1 |
|
442 |
1.1 |
|
454 |
1.1 2.2 3.3 |
|
457 |
1.1 |
|
466 |
1.1 |
|
467 |
1.1 |
|
470 |
1.1 |
|
472 |
1.1 |
|
473 |
1.1 |
|
475 |
1.1 |
|
483 |
1.1 |
|
484 |
1.1 |
|
486 |
1.1 2.2 |
|
494 |
1.1 |
|
495 |
1.1 |
|
497 |
1.1 |
|
508 |
1.1 |
|
513 |
1.1 2.2 3.3 |
|
515 |
1.1 2.2 3.3 |
|
517 |
1.1 2.2 3.3 4.4 |
|
521 |
1.1 |
|
524 |
1.1 |
|
525 |
1.1 |
|
527 |
1.1 |
|
534 |
1.1 2.2 3.3 4.4 5.5 6.6 |
|
538 |
1.1 |
|
542 |
1.1 |
|
546 |
1.1 |
|
552 |
1.1 |
|
553 |
1.1 |
|
554 |
1.1 |
|
557 |
1.1 |
|
558 |
1.1 |
|
563 |
1.1 |
|
569 |
1.1 |
|
570 |
1.1 |
|
571 |
1.1 |
|
574 |
1.1 |
|
575 |
1.1 |
|
580 |
1.1 |
|
593 |
1.1 2.2 3.3 |
|
597 |
1.1 |
|
607 |
1.1 |
|
608 |
1.1 |
|
609 |
1.1 |
|
616 |
1.1 2.2 3.3 |
|
620 |
1.1 |
|
622 |
1.1 |
|
624 |
1.1 |
|
625 |
1.1 |
|
627 |
1.1 |
|
637 |
1.1 |
|
638 |
1.1 |
|
639 |
1.1 |
|
646 |
1.1 2.2 3.3 |
|
651 |
1.1 |
|
653 |
1.1 |
|
654 |
1.1 |
|
656 |
1.1 |
|
665 |
1.1 |
|
666 |
1.1 2.2 3.3 |
|
667 |
1.1 |
|
668 |
1.1 |
|
671 |
1.1 |
|
675 |
1.1 2.2 3.3 |
|
679 |
1.1 |
|
681 |
1.1 |
|
682 |
1.1 |
|
684 |
1.1 |
|
693 |
1.1 |
|
694 |
1.1 2.2 3.3 |
|
695 |
1.1 |
|
696 |
1.1 |
|
699 |
1.1 |
|
703 |
1.1 2.2 3.3 |
|
707 |
1.1 |
|
709 |
1.1 |
|
710 |
1.1 |
|
712 |
1.1 |
|
719 |
1.1 2.2 3.3 |
|
722 |
1.1 |
|
729 |
1.1 2.2 3.3 |
|
733 |
1.1 |