MtasDataItem.java.html
6.65 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
<?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="../.resources/report.css" type="text/css"/><link rel="shortcut icon" href="../.resources/report.gif" type="image/gif"/><title>MtasDataItem.java</title><link rel="stylesheet" href="../.resources/prettify.css" type="text/css"/><script type="text/javascript" src="../.resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../.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.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
/**
* 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 Constant serialVersionUID. */
private static final long serialVersionUID = 1L;
/** The sub. */
protected MtasDataCollector<?, ?> sub;
/** The stats items. */
protected Set<String> statsItems;
/** The sort direction. */
protected String sortType;
protected String sortDirection;
/** The error number. */
protected int errorNumber;
/** The error list. */
protected 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="L69"> Map<String, Integer> errorList, int sourceNumber) {</span>
<span class="fc" id="L70"> this.sub = sub;</span>
<span class="fc" id="L71"> this.statsItems = statsItems;</span>
<span class="fc" id="L72"> this.sortType = sortType;</span>
<span class="fc" id="L73"> this.sortDirection = sortDirection;</span>
<span class="fc" id="L74"> this.errorNumber = errorNumber;</span>
<span class="fc" id="L75"> this.errorList = errorList;</span>
<span class="fc" id="L76"> this.sourceNumber = sourceNumber;</span>
<span class="fc" id="L77"> this.comparableSortValue = null;</span>
<span class="fc" id="L78"> this.recomputeComparableSortValue = true;</span>
<span class="fc" id="L79"> }</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="L109"> 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;
/**
* Compute comparable value.
*/
private void computeComparableValue() {
<span class="fc" id="L125"> recomputeComparableSortValue = false;</span>
try {
<span class="fc" id="L127"> int type = getCompareValueType();</span>
<span class="pc bpc" id="L128" title="3 of 4 branches missed."> switch (type) {</span>
case 0:
<span class="nc" id="L130"> comparableSortValue = getCompareValue0();</span>
<span class="nc" id="L131"> break;</span>
case 1:
<span class="fc" id="L133"> comparableSortValue = getCompareValue1();</span>
<span class="fc" id="L134"> break;</span>
case 2:
<span class="nc" id="L136"> comparableSortValue = getCompareValue2();</span>
<span class="nc" id="L137"> break;</span>
default:
<span class="nc" id="L139"> comparableSortValue = null;</span>
break;
}
<span class="nc" id="L142"> } catch (IOException e) {</span>
<span class="nc" id="L143"> comparableSortValue = null;</span>
<span class="fc" id="L144"> }</span>
<span class="fc" id="L145"> }</span>
/**
* Gets the comparable value.
*
* @return the comparable value
*/
protected final MtasDataItemNumberComparator<?> getComparableValue() {
<span class="fc bfc" id="L153" title="All 2 branches covered."> if (recomputeComparableSortValue) {</span>
<span class="fc" id="L154"> computeComparableValue();</span>
}
<span class="fc" id="L156"> return comparableSortValue;</span>
}
/**
* Gets the compare value0.
*
* @return the compare value0
*/
protected abstract MtasDataItemNumberComparator<Long> getCompareValue0();
/**
* Gets the compare value1.
*
* @return the compare value1
*/
protected abstract MtasDataItemNumberComparator<T1> getCompareValue1();
/**
* Gets the compare value2.
*
* @return the compare value2
*/
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.eclemma.org/jacoco">JaCoCo</a> 0.7.5.201505241946</span></div></body></html>