MtasDataAdvanced.java.html
31.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>MtasDataAdvanced.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">MTAS</a> > <a href="index.source.html" class="el_package">mtas.codec.util.collector</a> > <span class="el_source">MtasDataAdvanced.java</span></div><h1>MtasDataAdvanced.java</h1><pre class="source lang-java linenums">package mtas.codec.util.collector;
import java.io.IOException;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.SortedSet;
import mtas.codec.util.CodecUtil;
import mtas.codec.util.DataCollector;
/**
* The Class MtasDataAdvanced.
*
* @param <T1> the generic type
* @param <T2> the generic type
*/
abstract class MtasDataAdvanced<T1 extends Number & Comparable<T1>, T2 extends Number & Comparable<T2>>
extends MtasDataCollector<T1, T2> implements Serializable {
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 1L;
/** The advanced value sum list. */
<span class="fc" id="L26"> protected T1[] advancedValueSumList = null;</span>
/** The new advanced value sum list. */
<span class="fc" id="L29"> protected T1[] newAdvancedValueSumList = null;</span>
/** The advanced value max list. */
<span class="fc" id="L32"> protected T1[] advancedValueMaxList = null;</span>
/** The new advanced value max list. */
<span class="fc" id="L35"> protected T1[] newAdvancedValueMaxList = null;</span>
/** The advanced value min list. */
<span class="fc" id="L38"> protected T1[] advancedValueMinList = null;</span>
/** The new advanced value min list. */
<span class="fc" id="L41"> protected T1[] newAdvancedValueMinList = null;</span>
/** The advanced value sum of squares list. */
<span class="fc" id="L44"> protected T1[] advancedValueSumOfSquaresList = null;</span>
/** The new advanced value sum of squares list. */
<span class="fc" id="L47"> protected T1[] newAdvancedValueSumOfSquaresList = null;</span>
/** The advanced value sum of logs list. */
<span class="fc" id="L50"> protected T2[] advancedValueSumOfLogsList = null;</span>
/** The new advanced value sum of logs list. */
<span class="fc" id="L53"> protected T2[] newAdvancedValueSumOfLogsList = null;</span>
/** The advanced value N list. */
<span class="fc" id="L56"> protected long[] advancedValueNList = null;</span>
/** The new advanced value N list. */
<span class="fc" id="L59"> protected long[] newAdvancedValueNList = null;</span>
/** The operations. */
protected MtasDataOperations<T1, T2> operations;
/**
* Instantiates a new mtas data advanced.
*
* @param collectorType the collector type
* @param dataType the data type
* @param statsItems the stats items
* @param sortType the sort type
* @param sortDirection the sort direction
* @param start the start
* @param number the number
* @param subCollectorTypes the sub collector types
* @param subDataTypes the sub data types
* @param subStatsTypes the sub stats types
* @param subStatsItems the sub stats items
* @param subSortTypes the sub sort types
* @param subSortDirections the sub sort directions
* @param subStart the sub start
* @param subNumber the sub number
* @param operations the operations
* @param segmentRegistration the segment registration
* @param boundary the boundary
* @throws IOException Signals that an I/O exception has occurred.
*/
public MtasDataAdvanced(String collectorType, String dataType,
SortedSet<String> statsItems, String sortType, String sortDirection,
Integer start, Integer number, String[] subCollectorTypes,
String[] subDataTypes, String[] subStatsTypes,
SortedSet<String>[] subStatsItems, String[] subSortTypes,
String[] subSortDirections, Integer[] subStart, Integer[] subNumber,
MtasDataOperations<T1, T2> operations, String segmentRegistration,
String boundary) throws IOException {
<span class="fc" id="L95"> super(collectorType, dataType, CodecUtil.STATS_ADVANCED, statsItems,</span>
sortType, sortDirection, start, number, subCollectorTypes, subDataTypes,
subStatsTypes, subStatsItems, subSortTypes, subSortDirections, subStart,
subNumber, segmentRegistration, boundary);
<span class="fc" id="L99"> this.operations = operations;</span>
<span class="fc" id="L100"> }</span>
/*
* (non-Javadoc)
*
* @see
* mtas.codec.util.DataCollector.MtasDataCollector#error(java.lang.String)
*/
@Override
public final void error(String error) throws IOException {
<span class="nc" id="L110"> add(false);</span>
<span class="nc" id="L111"> setError(newCurrentPosition, error, newCurrentExisting);</span>
<span class="nc" id="L112"> }</span>
/*
* (non-Javadoc)
*
* @see
* mtas.codec.util.DataCollector.MtasDataCollector#error(java.lang.String[],
* java.lang.String)
*/
@Override
public final void error(String key, String error) throws IOException {
<span class="nc bnc" id="L123" title="All 2 branches missed."> if (key != null) {</span>
<span class="nc" id="L124"> add(key, false);</span>
<span class="nc" id="L125"> setError(newCurrentPosition, error, newCurrentExisting);</span>
}
<span class="nc" id="L127"> }</span>
/**
* Sets the error.
*
* @param newPosition the new position
* @param error the error
* @param currentExisting the current existing
*/
protected void setError(int newPosition, String error,
boolean currentExisting) {
<span class="nc bnc" id="L138" title="All 2 branches missed."> if (!currentExisting) {</span>
<span class="nc" id="L139"> newAdvancedValueSumList[newPosition] = operations.getZero1();</span>
<span class="nc" id="L140"> newAdvancedValueSumOfLogsList[newPosition] = operations.getZero2();</span>
<span class="nc" id="L141"> newAdvancedValueSumOfSquaresList[newPosition] = operations.getZero1();</span>
<span class="nc" id="L142"> newAdvancedValueMinList[newPosition] = operations.getZero1();</span>
<span class="nc" id="L143"> newAdvancedValueMaxList[newPosition] = operations.getZero1();</span>
<span class="nc" id="L144"> newAdvancedValueNList[newPosition] = 0;</span>
}
<span class="nc" id="L146"> newErrorNumber[newPosition]++;</span>
<span class="nc bnc" id="L147" title="All 2 branches missed."> if (newErrorList[newPosition].containsKey(error)) {</span>
<span class="nc" id="L148"> newErrorList[newPosition].put(error,</span>
<span class="nc" id="L149"> newErrorList[newPosition].get(error) + 1);</span>
} else {
<span class="nc" id="L151"> newErrorList[newPosition].put(error, 1);</span>
}
<span class="nc" id="L153"> }</span>
/*
* (non-Javadoc)
*
* @see mtas.codec.util.DataCollector.MtasDataCollector#increaseNewListSize()
*/
@Override
protected final void increaseNewListSize() throws IOException {
// register old situation
<span class="fc" id="L163"> int tmpOldSize = newKeyList.length;</span>
<span class="fc" id="L164"> int tmpNewPosition = newPosition;</span>
// increase
<span class="fc" id="L166"> super.increaseNewListSize();</span>
// reconstruct
<span class="fc" id="L168"> T1[] tmpNewAdvancedValueSumList = newAdvancedValueSumList;</span>
<span class="fc" id="L169"> T2[] tmpNewAdvancedValueSumOfLogsList = newAdvancedValueSumOfLogsList;</span>
<span class="fc" id="L170"> T1[] tmpNewAdvancedValueSumOfSquaresList = newAdvancedValueSumOfSquaresList;</span>
<span class="fc" id="L171"> T1[] tmpNewAdvancedValueMinList = newAdvancedValueMinList;</span>
<span class="fc" id="L172"> T1[] tmpNewAdvancedValueMaxList = newAdvancedValueMaxList;</span>
<span class="fc" id="L173"> long[] tmpNewAdvancedValueNList = newAdvancedValueNList;</span>
<span class="fc" id="L174"> newAdvancedValueSumList = operations.createVector1(newSize);</span>
<span class="fc" id="L175"> newAdvancedValueSumOfLogsList = operations.createVector2(newSize);</span>
<span class="fc" id="L176"> newAdvancedValueSumOfSquaresList = operations.createVector1(newSize);</span>
<span class="fc" id="L177"> newAdvancedValueMinList = operations.createVector1(newSize);</span>
<span class="fc" id="L178"> newAdvancedValueMaxList = operations.createVector1(newSize);</span>
<span class="fc" id="L179"> newAdvancedValueNList = new long[newSize];</span>
<span class="fc" id="L180"> newPosition = tmpNewPosition;</span>
<span class="fc" id="L181"> System.arraycopy(tmpNewAdvancedValueSumList, 0, newAdvancedValueSumList, 0,</span>
tmpOldSize);
<span class="fc" id="L183"> System.arraycopy(tmpNewAdvancedValueSumOfLogsList, 0,</span>
newAdvancedValueSumOfLogsList, 0, tmpOldSize);
<span class="fc" id="L185"> System.arraycopy(tmpNewAdvancedValueSumOfSquaresList, 0,</span>
newAdvancedValueSumOfSquaresList, 0, tmpOldSize);
<span class="fc" id="L187"> System.arraycopy(tmpNewAdvancedValueMinList, 0, newAdvancedValueMinList, 0,</span>
tmpOldSize);
<span class="fc" id="L189"> System.arraycopy(tmpNewAdvancedValueMaxList, 0, newAdvancedValueMaxList, 0,</span>
tmpOldSize);
<span class="fc" id="L191"> System.arraycopy(tmpNewAdvancedValueNList, 0, newAdvancedValueNList, 0,</span>
tmpOldSize);
<span class="fc" id="L193"> }</span>
/*
* (non-Javadoc)
*
* @see mtas.codec.util.collector.MtasDataCollector#reduceToSegmentKeys()
*/
@Override
public void reduceToSegmentKeys() {
<span class="pc bpc" id="L202" title="2 of 4 branches missed."> if (segmentRegistration != null && size > 0) {</span>
<span class="fc" id="L203"> int sizeCopy = size;</span>
<span class="fc" id="L204"> String[] keyListCopy = keyList.clone();</span>
<span class="fc" id="L205"> T1[] advancedValueSumListCopy = advancedValueSumList.clone();</span>
<span class="fc" id="L206"> T1[] advancedValueMaxListCopy = advancedValueMaxList.clone();</span>
<span class="fc" id="L207"> T1[] advancedValueMinListCopy = advancedValueMinList.clone();</span>
<span class="fc" id="L208"> T1[] advancedValueSumOfSquaresListCopy = advancedValueSumOfSquaresList</span>
<span class="fc" id="L209"> .clone();</span>
<span class="fc" id="L210"> T2[] advancedValueSumOfLogsListCopy = advancedValueSumOfLogsList.clone();</span>
<span class="fc" id="L211"> long[] advancedValueNListCopy = advancedValueNList.clone();</span>
<span class="fc" id="L212"> size = 0;</span>
<span class="fc bfc" id="L213" title="All 2 branches covered."> for (int i = 0; i < sizeCopy; i++) {</span>
<span class="fc bfc" id="L214" title="All 2 branches covered."> if (segmentKeys.contains(keyListCopy[i])) {</span>
<span class="fc" id="L215"> keyList[size] = keyListCopy[i];</span>
<span class="fc" id="L216"> advancedValueSumList[size] = advancedValueSumListCopy[i];</span>
<span class="fc" id="L217"> advancedValueMaxList[size] = advancedValueMaxListCopy[i];</span>
<span class="fc" id="L218"> advancedValueMinList[size] = advancedValueMinListCopy[i];</span>
<span class="fc" id="L219"> advancedValueSumOfSquaresList[size] = advancedValueSumOfSquaresListCopy[i];</span>
<span class="fc" id="L220"> advancedValueSumOfLogsList[size] = advancedValueSumOfLogsListCopy[i];</span>
<span class="fc" id="L221"> advancedValueNList[size] = advancedValueNListCopy[i];</span>
<span class="fc" id="L222"> size++;</span>
}
}
}
<span class="fc" id="L226"> }</span>
/*
* (non-Javadoc)
*
* @see
* mtas.codec.util.collector.MtasDataCollector#reduceToKeys(java.util.Set)
*/
@SuppressWarnings("unchecked")
public void reduceToKeys(Set<String> keys) {
<span class="pc bpc" id="L236" title="1 of 2 branches missed."> if (size > 0) {</span>
<span class="fc" id="L237"> int sizeCopy = size;</span>
<span class="fc" id="L238"> String[] keyListCopy = keyList.clone();</span>
<span class="fc" id="L239"> int[] errorNumberCopy = errorNumber.clone();</span>
<span class="fc" id="L240"> HashMap<String, Integer>[] errorListCopy = errorList.clone();</span>
<span class="fc" id="L241"> int[] sourceNumberListCopy = sourceNumberList.clone();</span>
<span class="fc" id="L242"> T1[] advancedValueSumListCopy = advancedValueSumList.clone();</span>
<span class="fc" id="L243"> T1[] advancedValueMaxListCopy = advancedValueMaxList.clone();</span>
<span class="fc" id="L244"> T1[] advancedValueMinListCopy = advancedValueMinList.clone();</span>
<span class="fc" id="L245"> T1[] advancedValueSumOfSquaresListCopy = advancedValueSumOfSquaresList</span>
<span class="fc" id="L246"> .clone();</span>
<span class="fc" id="L247"> T2[] advancedValueSumOfLogsListCopy = advancedValueSumOfLogsList.clone();</span>
<span class="fc" id="L248"> long[] advancedValueNListCopy = advancedValueNList.clone();</span>
<span class="fc" id="L249"> keyList = new String[keys.size()];</span>
<span class="fc" id="L250"> errorNumber = new int[keys.size()];</span>
<span class="fc" id="L251"> errorList = new HashMap[keys.size()];</span>
<span class="fc" id="L252"> sourceNumberList = new int[keys.size()];</span>
<span class="fc" id="L253"> advancedValueSumList = operations.createVector1(keys.size());</span>
<span class="fc" id="L254"> advancedValueMaxList = operations.createVector1(keys.size());</span>
<span class="fc" id="L255"> advancedValueMinList = operations.createVector1(keys.size());</span>
<span class="fc" id="L256"> advancedValueSumOfSquaresList = operations.createVector1(keys.size());</span>
<span class="fc" id="L257"> advancedValueSumOfLogsList = operations.createVector2(keys.size());</span>
<span class="fc" id="L258"> advancedValueNList = new long[keys.size()];</span>
<span class="fc" id="L259"> size = 0;</span>
<span class="fc bfc" id="L260" title="All 2 branches covered."> for (int i = 0; i < sizeCopy; i++) {</span>
<span class="fc bfc" id="L261" title="All 2 branches covered."> if (keys.contains(keyListCopy[i])) {</span>
<span class="fc" id="L262"> keyList[size] = keyListCopy[i];</span>
<span class="fc" id="L263"> errorNumber[size] = errorNumberCopy[i];</span>
<span class="fc" id="L264"> errorList[size] = errorListCopy[i];</span>
<span class="fc" id="L265"> sourceNumberList[size] = sourceNumberListCopy[i];</span>
<span class="fc" id="L266"> advancedValueSumList[size] = advancedValueSumListCopy[i];</span>
<span class="fc" id="L267"> advancedValueMaxList[size] = advancedValueMaxListCopy[i];</span>
<span class="fc" id="L268"> advancedValueMinList[size] = advancedValueMinListCopy[i];</span>
<span class="fc" id="L269"> advancedValueSumOfSquaresList[size] = advancedValueSumOfSquaresListCopy[i];</span>
<span class="fc" id="L270"> advancedValueSumOfLogsList[size] = advancedValueSumOfLogsListCopy[i];</span>
<span class="fc" id="L271"> advancedValueNList[size] = advancedValueNListCopy[i];</span>
<span class="fc" id="L272"> size++;</span>
}
}
}
<span class="fc" id="L276"> }</span>
/*
* (non-Javadoc)
*
* @see mtas.codec.util.DataCollector.MtasDataCollector#copyToNew(int, int)
*/
@Override
protected void copyToNew(int position, int newPosition) {
<span class="fc" id="L285"> newAdvancedValueSumList[newPosition] = advancedValueSumList[position];</span>
<span class="fc" id="L286"> newAdvancedValueSumOfLogsList[newPosition] = advancedValueSumOfLogsList[position];</span>
<span class="fc" id="L287"> newAdvancedValueSumOfSquaresList[newPosition] = advancedValueSumOfSquaresList[position];</span>
<span class="fc" id="L288"> newAdvancedValueMinList[newPosition] = advancedValueMinList[position];</span>
<span class="fc" id="L289"> newAdvancedValueMaxList[newPosition] = advancedValueMaxList[position];</span>
<span class="fc" id="L290"> newAdvancedValueNList[newPosition] = advancedValueNList[position];</span>
<span class="fc" id="L291"> }</span>
/*
* (non-Javadoc)
*
* @see mtas.codec.util.DataCollector.MtasDataCollector#copyFromNew()
*/
@Override
protected void copyFromNew() {
<span class="fc" id="L300"> advancedValueSumList = newAdvancedValueSumList;</span>
<span class="fc" id="L301"> advancedValueSumOfLogsList = newAdvancedValueSumOfLogsList;</span>
<span class="fc" id="L302"> advancedValueSumOfSquaresList = newAdvancedValueSumOfSquaresList;</span>
<span class="fc" id="L303"> advancedValueMinList = newAdvancedValueMinList;</span>
<span class="fc" id="L304"> advancedValueMaxList = newAdvancedValueMaxList;</span>
<span class="fc" id="L305"> advancedValueNList = newAdvancedValueNList;</span>
<span class="fc" id="L306"> }</span>
/**
* Sets the value.
*
* @param newPosition the new position
* @param values the values
* @param number the number
* @param currentExisting the current existing
*/
protected void setValue(int newPosition, T1[] values, int number,
boolean currentExisting) {
<span class="pc bpc" id="L318" title="1 of 2 branches missed."> if (number > 0) {</span>
<span class="fc" id="L319"> T1 valueSum = null;</span>
<span class="fc" id="L320"> T2 valueSumOfLogs = null;</span>
<span class="fc" id="L321"> T1 valueSumOfSquares = null;</span>
<span class="fc" id="L322"> T1 valueMin = null;</span>
<span class="fc" id="L323"> T1 valueMax = null;</span>
<span class="fc bfc" id="L324" title="All 2 branches covered."> for (int i = 0; i < number; i++) {</span>
<span class="fc bfc" id="L325" title="All 2 branches covered."> valueSum = (i == 0) ? values[i] : operations.add11(valueSum, values[i]);</span>
<span class="fc bfc" id="L326" title="All 2 branches covered."> valueSumOfLogs = (i == 0) ? operations.log1(values[i])</span>
<span class="fc" id="L327"> : operations.add22(valueSumOfLogs, operations.log1(values[i]));</span>
<span class="fc bfc" id="L328" title="All 2 branches covered."> valueSumOfSquares = (i == 0)</span>
<span class="fc" id="L329"> ? operations.product11(values[i], values[i])</span>
<span class="fc" id="L330"> : operations.add11(valueSumOfSquares,</span>
<span class="fc" id="L331"> operations.product11(values[i], values[i]));</span>
<span class="fc bfc" id="L332" title="All 2 branches covered."> valueMin = (i == 0) ? values[i] : operations.min11(valueMin, values[i]);</span>
<span class="fc bfc" id="L333" title="All 2 branches covered."> valueMax = (i == 0) ? values[i] : operations.max11(valueMax, values[i]);</span>
}
<span class="fc" id="L335"> setValue(newPosition, valueSum, valueSumOfLogs, valueSumOfSquares,</span>
valueMin, valueMax, number, currentExisting);
}
<span class="fc" id="L338"> }</span>
/**
* Sets the value.
*
* @param newPosition the new position
* @param valueSum the value sum
* @param valueSumOfLogs the value sum of logs
* @param valueSumOfSquares the value sum of squares
* @param valueMin the value min
* @param valueMax the value max
* @param valueN the value N
* @param currentExisting the current existing
*/
private void setValue(int newPosition, T1 valueSum, T2 valueSumOfLogs,
T1 valueSumOfSquares, T1 valueMin, T1 valueMax, long valueN,
boolean currentExisting) {
<span class="pc bpc" id="L355" title="1 of 2 branches missed."> if (valueN > 0) {</span>
<span class="fc bfc" id="L356" title="All 2 branches covered."> if (currentExisting) {</span>
<span class="fc" id="L357"> newAdvancedValueSumList[newPosition] = operations</span>
<span class="fc" id="L358"> .add11(newAdvancedValueSumList[newPosition], valueSum);</span>
<span class="fc" id="L359"> newAdvancedValueSumOfLogsList[newPosition] = operations</span>
<span class="fc" id="L360"> .add22(newAdvancedValueSumOfLogsList[newPosition], valueSumOfLogs);</span>
<span class="fc" id="L361"> newAdvancedValueSumOfSquaresList[newPosition] = operations.add11(</span>
newAdvancedValueSumOfSquaresList[newPosition], valueSumOfSquares);
<span class="fc" id="L363"> newAdvancedValueMinList[newPosition] = operations</span>
<span class="fc" id="L364"> .min11(newAdvancedValueMinList[newPosition], valueMin);</span>
<span class="fc" id="L365"> newAdvancedValueMaxList[newPosition] = operations</span>
<span class="fc" id="L366"> .max11(newAdvancedValueMaxList[newPosition], valueMax);</span>
<span class="fc" id="L367"> newAdvancedValueNList[newPosition] += valueN;</span>
} else {
<span class="fc" id="L369"> newAdvancedValueSumList[newPosition] = valueSum;</span>
<span class="fc" id="L370"> newAdvancedValueSumOfLogsList[newPosition] = valueSumOfLogs;</span>
<span class="fc" id="L371"> newAdvancedValueSumOfSquaresList[newPosition] = valueSumOfSquares;</span>
<span class="fc" id="L372"> newAdvancedValueMinList[newPosition] = valueMin;</span>
<span class="fc" id="L373"> newAdvancedValueMaxList[newPosition] = valueMax;</span>
<span class="fc" id="L374"> newAdvancedValueNList[newPosition] = valueN;</span>
}
}
<span class="fc" id="L377"> }</span>
/*
* (non-Javadoc)
*
* @see mtas.codec.util.DataCollector.MtasDataCollector#remapData(int[][])
*/
@Override
protected void remapData(int[][] mapping) throws IOException {
<span class="nc" id="L386"> super.remapData(mapping);</span>
<span class="nc" id="L387"> T1[] originalAdvancedValueSumList = advancedValueSumList.clone();</span>
<span class="nc" id="L388"> T2[] originalAdvancedValueSumOfLogsList = advancedValueSumOfLogsList</span>
<span class="nc" id="L389"> .clone();</span>
<span class="nc" id="L390"> T1[] originalAdvancedValueSumOfSquaresList = advancedValueSumOfSquaresList</span>
<span class="nc" id="L391"> .clone();</span>
<span class="nc" id="L392"> T1[] originalAdvancedValueMinList = advancedValueMinList.clone();</span>
<span class="nc" id="L393"> T1[] originalAdvancedValueMaxList = advancedValueMaxList.clone();</span>
<span class="nc" id="L394"> long[] originalAdvancedValueNList = advancedValueNList.clone();</span>
<span class="nc" id="L395"> advancedValueSumList = operations.createVector1(mapping.length);</span>
<span class="nc" id="L396"> advancedValueSumOfLogsList = operations.createVector2(mapping.length);</span>
<span class="nc" id="L397"> advancedValueSumOfSquaresList = operations.createVector1(mapping.length);</span>
<span class="nc" id="L398"> advancedValueMinList = operations.createVector1(mapping.length);</span>
<span class="nc" id="L399"> advancedValueMaxList = operations.createVector1(mapping.length);</span>
<span class="nc" id="L400"> advancedValueNList = new long[mapping.length];</span>
<span class="nc bnc" id="L401" title="All 2 branches missed."> for (int i = 0; i < mapping.length; i++) {</span>
<span class="nc bnc" id="L402" title="All 2 branches missed."> for (int j = 0; j < mapping[i].length; j++) {</span>
<span class="nc bnc" id="L403" title="All 2 branches missed."> if (j == 0) {</span>
<span class="nc" id="L404"> setValue(i, originalAdvancedValueSumList[mapping[i][j]],</span>
originalAdvancedValueSumOfLogsList[mapping[i][j]],
originalAdvancedValueSumOfSquaresList[mapping[i][j]],
originalAdvancedValueMinList[mapping[i][j]],
originalAdvancedValueMaxList[mapping[i][j]],
originalAdvancedValueNList[mapping[i][j]], false);
} else {
<span class="nc" id="L411"> setValue(i, originalAdvancedValueSumList[mapping[i][j]],</span>
originalAdvancedValueSumOfLogsList[mapping[i][j]],
originalAdvancedValueSumOfSquaresList[mapping[i][j]],
originalAdvancedValueMinList[mapping[i][j]],
originalAdvancedValueMaxList[mapping[i][j]],
originalAdvancedValueNList[mapping[i][j]], true);
}
}
}
<span class="nc" id="L420"> advancedValueSumList = newAdvancedValueSumList;</span>
<span class="nc" id="L421"> advancedValueSumOfLogsList = newAdvancedValueSumOfLogsList;</span>
<span class="nc" id="L422"> advancedValueSumOfSquaresList = newAdvancedValueSumOfSquaresList;</span>
<span class="nc" id="L423"> advancedValueMinList = newAdvancedValueMinList;</span>
<span class="nc" id="L424"> advancedValueMaxList = newAdvancedValueMaxList;</span>
<span class="nc" id="L425"> advancedValueNList = newAdvancedValueNList;</span>
<span class="nc" id="L426"> }</span>
/*
* (non-Javadoc)
*
* @see mtas.codec.util.DataCollector.MtasDataCollector#merge(mtas.codec.util.
* DataCollector.MtasDataCollector)
*/
@Override
public void merge(MtasDataCollector<?, ?> newDataCollector,
Map<MtasDataCollector<?, ?>, MtasDataCollector<?, ?>> map,
boolean increaseSourceNumber) throws IOException {
<span class="fc" id="L438"> closeNewList();</span>
<span class="pc bpc" id="L439" title="1 of 2 branches missed."> if (!collectorType.equals(newDataCollector.getCollectorType())</span>
<span class="pc bpc" id="L440" title="1 of 2 branches missed."> || !dataType.equals(newDataCollector.getDataType())</span>
<span class="pc bpc" id="L441" title="2 of 4 branches missed."> || !statsType.equals(newDataCollector.getStatsType())</span>
|| !(newDataCollector instanceof MtasDataAdvanced)) {
<span class="nc" id="L443"> throw new IOException("cannot merge different dataCollectors");</span>
} else {
<span class="fc" id="L445"> segmentRegistration = null;</span>
@SuppressWarnings("unchecked")
<span class="fc" id="L447"> MtasDataAdvanced<T1, T2> newMtasDataAdvanced = (MtasDataAdvanced<T1, T2>) newDataCollector;</span>
<span class="fc" id="L448"> newMtasDataAdvanced.closeNewList();</span>
<span class="fc" id="L449"> initNewList(newMtasDataAdvanced.getSize());</span>
<span class="fc bfc" id="L450" title="All 2 branches covered."> if (collectorType.equals(DataCollector.COLLECTOR_TYPE_LIST)) {</span>
<span class="fc" id="L451"> map.put(newDataCollector, this);</span>
<span class="fc bfc" id="L452" title="All 2 branches covered."> for (int i = 0; i < newMtasDataAdvanced.getSize(); i++) {</span>
<span class="fc" id="L453"> MtasDataCollector<?, ?>[] subCollectors = new MtasDataCollector[1];</span>
<span class="fc" id="L454"> subCollectors[0] = add(newMtasDataAdvanced.keyList[i],</span>
increaseSourceNumber);
<span class="fc" id="L456"> setError(newCurrentPosition, newMtasDataAdvanced.errorNumber[i],</span>
newMtasDataAdvanced.errorList[i], newCurrentExisting);
<span class="fc" id="L458"> setValue(newCurrentPosition,</span>
newMtasDataAdvanced.advancedValueSumList[i],
newMtasDataAdvanced.advancedValueSumOfLogsList[i],
newMtasDataAdvanced.advancedValueSumOfSquaresList[i],
newMtasDataAdvanced.advancedValueMinList[i],
newMtasDataAdvanced.advancedValueMaxList[i],
newMtasDataAdvanced.advancedValueNList[i], newCurrentExisting);
<span class="pc bpc" id="L465" title="3 of 4 branches missed."> if (hasSub() && newMtasDataAdvanced.hasSub()) {</span>
<span class="nc" id="L466"> subCollectors[0].merge(</span>
newMtasDataAdvanced.subCollectorListNextLevel[i], map,
increaseSourceNumber);
}
}
<span class="fc" id="L471"> closeNewList();</span>
<span class="pc bpc" id="L472" title="1 of 2 branches missed."> } else if (collectorType.equals(DataCollector.COLLECTOR_TYPE_DATA)) {</span>
<span class="fc" id="L473"> map.put(newDataCollector, this);</span>
<span class="fc bfc" id="L474" title="All 2 branches covered."> if (newMtasDataAdvanced.getSize() > 0) {</span>
<span class="fc" id="L475"> MtasDataCollector<?, ?> subCollector = add(increaseSourceNumber);</span>
<span class="fc" id="L476"> setError(newCurrentPosition, newMtasDataAdvanced.errorNumber[0],</span>
newMtasDataAdvanced.errorList[0], newCurrentExisting);
<span class="fc" id="L478"> setValue(newCurrentPosition,</span>
newMtasDataAdvanced.advancedValueSumList[0],
newMtasDataAdvanced.advancedValueSumOfLogsList[0],
newMtasDataAdvanced.advancedValueSumOfSquaresList[0],
newMtasDataAdvanced.advancedValueMinList[0],
newMtasDataAdvanced.advancedValueMaxList[0],
newMtasDataAdvanced.advancedValueNList[0], newCurrentExisting);
<span class="pc bpc" id="L485" title="3 of 4 branches missed."> if (hasSub() && newMtasDataAdvanced.hasSub()) {</span>
<span class="nc" id="L486"> subCollector.merge(newMtasDataAdvanced.subCollectorNextLevel, map,</span>
increaseSourceNumber);
}
}
<span class="fc" id="L490"> closeNewList();</span>
} else {
<span class="nc" id="L492"> throw new IOException("cannot merge " + collectorType);</span>
}
}
<span class="fc" id="L495"> }</span>
/*
* (non-Javadoc)
*
* @see mtas.codec.util.DataCollector.MtasDataCollector#initNewList(int)
*/
@Override
public final void initNewList(int maxNumberOfTerms) throws IOException {
<span class="fc" id="L504"> super.initNewList(maxNumberOfTerms);</span>
<span class="fc" id="L505"> initNewListBasic();</span>
<span class="fc" id="L506"> }</span>
/*
* (non-Javadoc)
*
* @see mtas.codec.util.DataCollector.MtasDataCollector#initNewList(int,
* java.lang.String)
*/
@Override
public final void initNewList(int maxNumberOfTerms, String segmentName,
int segmentNumber, String boundary) throws IOException {
<span class="fc" id="L517"> super.initNewList(maxNumberOfTerms, segmentName, segmentNumber, boundary);</span>
<span class="fc" id="L518"> initNewListBasic();</span>
<span class="fc" id="L519"> }</span>
/**
* Inits the new list basic.
*
* @param maxNumberOfTerms the max number of terms
*/
private void initNewListBasic() {
<span class="fc" id="L527"> newAdvancedValueSumList = operations.createVector1(newSize);</span>
<span class="fc" id="L528"> newAdvancedValueSumOfLogsList = operations.createVector2(newSize);</span>
<span class="fc" id="L529"> newAdvancedValueSumOfSquaresList = operations.createVector1(newSize);</span>
<span class="fc" id="L530"> newAdvancedValueMinList = operations.createVector1(newSize);</span>
<span class="fc" id="L531"> newAdvancedValueMaxList = operations.createVector1(newSize);</span>
<span class="fc" id="L532"> newAdvancedValueNList = new long[newSize];</span>
<span class="fc" id="L533"> }</span>
}
</pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.7.9.201702052155</span></div></body></html>