1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package com.xpn.xwiki.objects.classes; |
21 |
|
|
22 |
|
import java.util.Comparator; |
23 |
|
|
24 |
|
import org.apache.commons.collections4.ComparatorUtils; |
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
@version |
30 |
|
|
|
|
| 93.3% |
Uncovered Elements: 2 (30) |
Complexity: 13 |
Complexity Density: 0.76 |
|
31 |
|
public class ListItem |
32 |
|
{ |
33 |
|
|
34 |
|
private static final Comparator<String> BASE_COMPARATOR = ComparatorUtils |
35 |
|
.nullHighComparator(new Comparator<String>() |
36 |
|
{ |
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
@param |
41 |
|
@param |
42 |
|
@return |
43 |
|
|
44 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
45 |
169 |
@Override... |
46 |
|
public int compare(String o1, String o2) |
47 |
|
{ |
48 |
169 |
return o1.compareToIgnoreCase(o2); |
49 |
|
} |
50 |
|
}); |
51 |
|
|
52 |
|
|
53 |
|
protected static final Comparator<ListItem> ID_COMPARATOR = ComparatorUtils |
54 |
|
.nullHighComparator(new Comparator<ListItem>() |
55 |
|
{ |
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
@param |
61 |
|
@param |
62 |
|
@return |
63 |
|
|
64 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
65 |
3 |
@Override... |
66 |
|
public int compare(ListItem o1, ListItem o2) |
67 |
|
{ |
68 |
3 |
return BASE_COMPARATOR.compare(o1.getId(), o2.getId()); |
69 |
|
} |
70 |
|
}); |
71 |
|
|
72 |
|
|
73 |
|
protected static final Comparator<ListItem> VALUE_COMPARATOR = ComparatorUtils |
74 |
|
.nullHighComparator(new Comparator<ListItem>() |
75 |
|
{ |
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
|
80 |
|
@param |
81 |
|
@param |
82 |
|
@return |
83 |
|
|
84 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
85 |
166 |
@Override... |
86 |
|
public int compare(ListItem o1, ListItem o2) |
87 |
|
{ |
88 |
166 |
return BASE_COMPARATOR.compare(o1.getValue(), o2.getValue()); |
89 |
|
} |
90 |
|
}); |
91 |
|
|
92 |
|
|
93 |
|
private String id = ""; |
94 |
|
|
95 |
|
|
96 |
|
private String value = ""; |
97 |
|
|
98 |
|
|
99 |
|
private String parent = ""; |
100 |
|
|
101 |
|
|
102 |
|
@link@link |
103 |
|
@link |
104 |
|
|
105 |
|
@param |
106 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
107 |
21 |
public ListItem(String id)... |
108 |
|
{ |
109 |
21 |
this.setId(id); |
110 |
21 |
this.setValue(id); |
111 |
|
} |
112 |
|
|
113 |
|
|
114 |
|
@link@link |
115 |
|
@link |
116 |
|
|
117 |
|
@param |
118 |
|
@param |
119 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
120 |
6982 |
public ListItem(String id, String value)... |
121 |
|
{ |
122 |
6982 |
this.setId(id); |
123 |
6982 |
this.setValue(value); |
124 |
|
} |
125 |
|
|
126 |
|
|
127 |
|
@link@link |
128 |
|
@link |
129 |
|
|
130 |
|
@param |
131 |
|
@param |
132 |
|
@param |
133 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
134 |
6 |
public ListItem(String id, String value, String parent)... |
135 |
|
{ |
136 |
6 |
this.setId(id); |
137 |
6 |
this.setValue(value); |
138 |
6 |
this.setParent(parent); |
139 |
|
} |
140 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
141 |
524 |
public String getId()... |
142 |
|
{ |
143 |
524 |
return this.id; |
144 |
|
} |
145 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
146 |
7009 |
public void setId(String id)... |
147 |
|
{ |
148 |
7009 |
this.id = id; |
149 |
|
} |
150 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
151 |
4754 |
public String getValue()... |
152 |
|
{ |
153 |
4754 |
return this.value; |
154 |
|
} |
155 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
156 |
7009 |
public void setValue(String value)... |
157 |
|
{ |
158 |
7009 |
this.value = value; |
159 |
|
} |
160 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
161 |
12 |
public String getParent()... |
162 |
|
{ |
163 |
12 |
return this.parent; |
164 |
|
} |
165 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
166 |
6 |
public void setParent(String parent)... |
167 |
|
{ |
168 |
6 |
this.parent = parent; |
169 |
|
} |
170 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
171 |
0 |
@Override... |
172 |
|
public String toString() |
173 |
|
{ |
174 |
0 |
return "[" + getId() + ", " + getValue() + ", " + getParent() + "]"; |
175 |
|
} |
176 |
|
} |