MtasDataItem.java.html
7.08 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
<?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>MtasDataItem.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">MtasDataItem.java</span></div><h1>MtasDataItem.java</h1><pre class="source lang-java linenums">package mtas.codec.util.collector;
import java.io.IOException;
import java.io.Serializable;
import java.util.Map;
import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* The Class MtasDataItem.
*
* @param <T1> the generic type
* @param <T2> the generic type
*/
public abstract class MtasDataItem<T1 extends Number & Comparable<T1>, T2 extends Number & Comparable<T2>>
implements Serializable, Comparable<MtasDataItem<T1, T2>> {
/** The log. */
<span class="fc" id="L21"> private static Log log = LogFactory.getLog(MtasDataItem.class);</span>
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 1L;
/** The sub. */
protected MtasDataCollector<?, ?> sub;
/** The stats items. */
private Set<String> statsItems;
/** The sort type. */
protected String sortType;
/** The sort direction. */
protected String sortDirection;
/** The error number. */
protected int errorNumber;
/** The error list. */
private Map<String, Integer> errorList;
/** The comparable sort value. */
protected MtasDataItemNumberComparator<?> comparableSortValue;
/** The recompute comparable sort value. */
protected boolean recomputeComparableSortValue;
/** The source number. */
protected int sourceNumber;
/**
* Instantiates a new mtas data item.
*
* @param sub the sub
* @param statsItems the stats items
* @param sortType the sort type
* @param sortDirection the sort direction
* @param errorNumber the error number
* @param errorList the error list
* @param sourceNumber the source number
*/
public MtasDataItem(MtasDataCollector<?, ?> sub, Set<String> statsItems,
String sortType, String sortDirection, int errorNumber,
<span class="fc" id="L66"> Map<String, Integer> errorList, int sourceNumber) {</span>
<span class="fc" id="L67"> this.sub = sub;</span>
<span class="fc" id="L68"> this.statsItems = statsItems;</span>
<span class="fc" id="L69"> this.sortType = sortType;</span>
<span class="fc" id="L70"> this.sortDirection = sortDirection;</span>
<span class="fc" id="L71"> this.errorNumber = errorNumber;</span>
<span class="fc" id="L72"> this.errorList = errorList;</span>
<span class="fc" id="L73"> this.sourceNumber = sourceNumber;</span>
<span class="fc" id="L74"> this.comparableSortValue = null;</span>
<span class="fc" id="L75"> this.recomputeComparableSortValue = true;</span>
<span class="fc" id="L76"> }</span>
/**
* Adds the.
*
* @param newItem the new item
* @throws IOException Signals that an I/O exception has occurred.
*/
public abstract void add(MtasDataItem<T1, T2> newItem) throws IOException;
/**
* Rewrite.
*
* @param showDebugInfo the show debug info
* @return the map
* @throws IOException Signals that an I/O exception has occurred.
*/
public abstract Map<String, Object> rewrite(boolean showDebugInfo)
throws IOException;
/**
* Gets the sub.
*
* @return the sub
*/
public MtasDataCollector getSub() {
<span class="nc" id="L102"> return sub;</span>
}
/**
* Gets the compare value type.
*
* @return the compare value type
* @throws IOException Signals that an I/O exception has occurred.
*/
protected abstract int getCompareValueType() throws IOException;
/**
* Gets the stats items.
*
* @return the stats items
*/
protected final Set<String> getStatsItems() {
<span class="fc" id="L119"> return statsItems;</span>
}
/**
* Gets the error list.
*
* @return the error list
*/
protected final Map<String, Integer> getErrorList() {
<span class="nc" id="L128"> return errorList;</span>
}
/**
* Compute comparable value.
*/
private void computeComparableValue() {
<span class="fc" id="L135"> recomputeComparableSortValue = false;</span>
try {
<span class="fc" id="L137"> int type = getCompareValueType();</span>
<span class="pc bpc" id="L138" title="3 of 4 branches missed."> switch (type) {</span>
case 0:
<span class="nc" id="L140"> comparableSortValue = getCompareValue0();</span>
<span class="nc" id="L141"> break;</span>
case 1:
<span class="fc" id="L143"> comparableSortValue = getCompareValue1();</span>
<span class="fc" id="L144"> break;</span>
case 2:
<span class="nc" id="L146"> comparableSortValue = getCompareValue2();</span>
<span class="nc" id="L147"> break;</span>
default:
<span class="nc" id="L149"> comparableSortValue = null;</span>
break;
}
<span class="fc" id="L152"> } catch (IOException e) {</span>
<span class="fc" id="L153"> log.debug(e);</span>
<span class="fc" id="L154"> comparableSortValue = null;</span>
<span class="fc" id="L155"> }</span>
<span class="fc" id="L156"> }</span>
/**
* Gets the comparable value.
*
* @return the comparable value
*/
protected final MtasDataItemNumberComparator getComparableValue() {
<span class="fc bfc" id="L164" title="All 2 branches covered."> if (recomputeComparableSortValue) {</span>
<span class="fc" id="L165"> computeComparableValue();</span>
}
<span class="fc" id="L167"> return comparableSortValue;</span>
}
/**
* Gets the compare value 0.
*
* @return the compare value 0
*/
protected abstract MtasDataItemNumberComparator<Long> getCompareValue0();
/**
* Gets the compare value 1.
*
* @return the compare value 1
*/
protected abstract MtasDataItemNumberComparator<T1> getCompareValue1();
/**
* Gets the compare value 2.
*
* @return the compare value 2
*/
protected abstract MtasDataItemNumberComparator<T2> getCompareValue2();
/**
* The Class NumberComparator.
*
* @param <T>
* the generic type
*/
}
</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>