1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.qedeq.kernel.bo.common; |
17 |
|
|
18 |
|
import java.util.Arrays; |
19 |
|
import java.util.HashSet; |
20 |
|
import java.util.Iterator; |
21 |
|
import java.util.Set; |
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
@link |
26 |
|
|
27 |
|
@author |
28 |
|
|
|
|
| 77.2% |
Uncovered Elements: 26 (114) |
Complexity: 34 |
Complexity Density: 0.53 |
|
29 |
|
public class QedeqBoSet { |
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
private final Set elements; |
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
39 |
49
|
public QedeqBoSet() {... |
40 |
49
|
this.elements = new HashSet(); |
41 |
|
} |
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
@param |
48 |
|
@throws |
49 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
50 |
32
|
public QedeqBoSet(final QedeqBo[] elements) {... |
51 |
32
|
if (elements == null) { |
52 |
0
|
throw new IllegalArgumentException( |
53 |
|
"NullPointer as element array is not allowed"); |
54 |
|
} |
55 |
32
|
this.elements = new HashSet(Arrays.asList(elements)); |
56 |
|
} |
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
@param |
62 |
|
@throws |
63 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
64 |
9
|
public QedeqBoSet(final QedeqBo element) {... |
65 |
9
|
if (element == null) { |
66 |
2
|
throw new IllegalArgumentException( |
67 |
|
"NullPointer as element array is not allowed"); |
68 |
|
} |
69 |
7
|
this.elements = new HashSet(); |
70 |
7
|
elements.add(element); |
71 |
|
} |
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
|
76 |
|
@param |
77 |
|
@throws |
78 |
|
|
79 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
80 |
3
|
public QedeqBoSet(final QedeqBoSet set) {... |
81 |
3
|
if (set == null) { |
82 |
1
|
throw new IllegalArgumentException( |
83 |
|
"NullPointer as set is not allowed"); |
84 |
|
} |
85 |
2
|
this.elements = new HashSet(set.elements); |
86 |
|
} |
87 |
|
|
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
|
92 |
|
@param |
93 |
|
@return |
94 |
|
@throws |
95 |
|
|
96 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
97 |
14
|
public final boolean contains(final QedeqBo element) {... |
98 |
14
|
if (element == null) { |
99 |
1
|
throw new IllegalArgumentException("NullPointer as element is not allowed"); |
100 |
|
} |
101 |
13
|
return this.elements.contains(element); |
102 |
|
} |
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
@return |
108 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
109 |
4
|
public final boolean isEmpty() {... |
110 |
4
|
return elements.isEmpty(); |
111 |
|
} |
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|
|
116 |
|
|
117 |
|
|
118 |
|
@param |
119 |
|
@return |
120 |
|
@throws |
121 |
|
|
122 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
123 |
54
|
public final QedeqBoSet add(final QedeqBo element) {... |
124 |
54
|
if (element == null) { |
125 |
2
|
throw new IllegalArgumentException("NullPointer as element is not allowed"); |
126 |
|
} |
127 |
52
|
elements.add(element); |
128 |
52
|
return this; |
129 |
|
} |
130 |
|
|
131 |
|
|
132 |
|
|
133 |
|
@link |
134 |
|
|
135 |
|
|
136 |
|
@param |
137 |
|
@return |
138 |
|
@throws |
139 |
|
|
140 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
141 |
5
|
public final QedeqBoSet add(final QedeqBoSet set) {... |
142 |
5
|
if (set == null) { |
143 |
2
|
throw new IllegalArgumentException( |
144 |
|
"NullPointer as set is not allowed"); |
145 |
|
} |
146 |
3
|
elements.addAll(set.elements); |
147 |
3
|
return this; |
148 |
|
} |
149 |
|
|
150 |
|
|
151 |
|
|
152 |
|
|
153 |
|
|
154 |
|
@param |
155 |
|
@return |
156 |
|
@throws |
157 |
|
|
158 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
159 |
7
|
public final QedeqBoSet remove(final QedeqBo element) {... |
160 |
7
|
if (element == null) { |
161 |
1
|
throw new IllegalArgumentException( |
162 |
|
"NullPointer as element is not allowed"); |
163 |
|
} |
164 |
6
|
elements.remove(element); |
165 |
6
|
return this; |
166 |
|
} |
167 |
|
|
168 |
|
|
169 |
|
@link |
170 |
|
|
171 |
|
|
172 |
|
|
173 |
|
@param |
174 |
|
|
175 |
|
@return |
176 |
|
@throws |
177 |
|
|
178 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
179 |
5
|
public final QedeqBoSet remove(final QedeqBoSet set) {... |
180 |
5
|
if (set == null) { |
181 |
1
|
throw new IllegalArgumentException( |
182 |
|
"NullPointer as set is not allowed"); |
183 |
|
} |
184 |
4
|
this.elements.removeAll(set.elements); |
185 |
4
|
return this; |
186 |
|
} |
187 |
|
|
188 |
|
|
189 |
|
|
190 |
|
|
191 |
|
@param |
192 |
|
@return |
193 |
|
@throws |
194 |
|
|
195 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
196 |
2
|
public final QedeqBoSet intersection(final QedeqBoSet set) {... |
197 |
2
|
if (set == null) { |
198 |
1
|
throw new IllegalArgumentException( |
199 |
|
"NullPointer as set is not allowed"); |
200 |
|
} |
201 |
1
|
this.elements.retainAll(set.elements); |
202 |
1
|
return this; |
203 |
|
} |
204 |
|
|
205 |
|
|
206 |
|
|
207 |
|
|
208 |
|
|
209 |
|
@return |
210 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
211 |
11
|
public final int size() {... |
212 |
11
|
return this.elements.size(); |
213 |
|
} |
214 |
|
|
215 |
|
|
216 |
|
|
217 |
|
|
218 |
|
|
219 |
|
|
220 |
|
@return |
221 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
222 |
2
|
public Iterator iterator() {... |
223 |
2
|
return this.elements.iterator(); |
224 |
|
} |
225 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
226 |
41
|
public final boolean equals(final Object obj) {... |
227 |
41
|
if (obj instanceof QedeqBoSet) { |
228 |
37
|
return this.elements.equals(((QedeqBoSet) obj).elements); |
229 |
|
} |
230 |
4
|
return false; |
231 |
|
} |
232 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
233 |
8
|
public final int hashCode() {... |
234 |
8
|
return elements.hashCode(); |
235 |
|
} |
236 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 3 |
Complexity Density: 0.33 |
|
237 |
6
|
public final String toString() {... |
238 |
6
|
final StringBuffer result = new StringBuffer(); |
239 |
6
|
result.append("{"); |
240 |
6
|
final Iterator iterator = elements.iterator(); |
241 |
12
|
while (iterator.hasNext()) { |
242 |
6
|
result.append(iterator.next()); |
243 |
6
|
if (iterator.hasNext()) { |
244 |
1
|
result.append(", "); |
245 |
|
} |
246 |
|
} |
247 |
6
|
result.append("}"); |
248 |
6
|
return result.toString(); |
249 |
|
} |
250 |
|
|
251 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 3 |
Complexity Density: 0.43 |
|
252 |
0
|
public String asLongList() {... |
253 |
0
|
final StringBuffer result = new StringBuffer(); |
254 |
0
|
final Iterator iterator = elements.iterator(); |
255 |
0
|
while (iterator.hasNext()) { |
256 |
0
|
result.append(((QedeqBo) iterator.next()).getUrl()); |
257 |
0
|
if (iterator.hasNext()) { |
258 |
0
|
result.append(", "); |
259 |
|
} |
260 |
|
} |
261 |
0
|
return result.toString(); |
262 |
|
} |
263 |
|
|
264 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 3 |
Complexity Density: 0.43 |
|
265 |
0
|
public String asShortList() {... |
266 |
0
|
final StringBuffer result = new StringBuffer(); |
267 |
0
|
final Iterator iterator = elements.iterator(); |
268 |
0
|
while (iterator.hasNext()) { |
269 |
0
|
result.append(((QedeqBo) iterator.next()).getName()); |
270 |
0
|
if (iterator.hasNext()) { |
271 |
0
|
result.append(", "); |
272 |
|
} |
273 |
|
} |
274 |
0
|
return result.toString(); |
275 |
|
} |
276 |
|
|
277 |
|
|
278 |
|
} |