1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.datamodel; |
22 |
|
|
23 |
|
import jalview.datamodel.features.FeatureAttributeType; |
24 |
|
import jalview.datamodel.features.FeatureAttributes; |
25 |
|
import jalview.datamodel.features.FeatureLocationI; |
26 |
|
import jalview.datamodel.features.FeatureSourceI; |
27 |
|
import jalview.datamodel.features.FeatureSources; |
28 |
|
import jalview.util.StringUtils; |
29 |
|
|
30 |
|
import java.util.HashMap; |
31 |
|
import java.util.Map; |
32 |
|
import java.util.Map.Entry; |
33 |
|
import java.util.SortedMap; |
34 |
|
import java.util.TreeMap; |
35 |
|
import java.util.Vector; |
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
|
|
|
| 84.8% |
Uncovered Elements: 40 (264) |
Complexity: 92 |
Complexity Density: 0.64 |
|
42 |
|
public class SequenceFeature implements FeatureLocationI |
43 |
|
{ |
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
private static final float NO_SCORE = 0f; |
49 |
|
|
50 |
|
private static final String STATUS = "status"; |
51 |
|
|
52 |
|
private static final String STRAND = "STRAND"; |
53 |
|
|
54 |
|
|
55 |
|
private static final String PHASE = "!Phase"; |
56 |
|
|
57 |
|
|
58 |
|
private static final String LOCATION = "!Location"; |
59 |
|
|
60 |
|
private static final String ROW_DATA = "<tr><td>%s</td><td>%s</td><td>%s</td></tr>"; |
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
private static final String ATTRIBUTES = "ATTRIBUTES"; |
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
public final String type; |
74 |
|
|
75 |
|
public final int begin; |
76 |
|
|
77 |
|
public final int end; |
78 |
|
|
79 |
|
public final String featureGroup; |
80 |
|
|
81 |
|
public final float score; |
82 |
|
|
83 |
|
private final boolean contactFeature; |
84 |
|
|
85 |
|
public String description; |
86 |
|
|
87 |
|
|
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
public Map<String, Object> otherDetails; |
92 |
|
|
93 |
|
public Vector<String> links; |
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
|
99 |
|
private String source; |
100 |
|
|
101 |
|
|
102 |
|
|
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
@param |
107 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
108 |
81 |
public SequenceFeature(SequenceFeature cpy)... |
109 |
|
{ |
110 |
81 |
this(cpy, cpy.getBegin(), cpy.getEnd(), cpy.getFeatureGroup(), cpy |
111 |
|
.getScore()); |
112 |
|
} |
113 |
|
|
114 |
|
|
115 |
|
|
116 |
|
|
117 |
|
@param |
118 |
|
@param |
119 |
|
@param |
120 |
|
@param |
121 |
|
@param |
122 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
123 |
41466 |
public SequenceFeature(String theType, String theDesc, int theBegin,... |
124 |
|
int theEnd, String group) |
125 |
|
{ |
126 |
41466 |
this(theType, theDesc, theBegin, theEnd, NO_SCORE, group); |
127 |
|
} |
128 |
|
|
129 |
|
|
130 |
|
|
131 |
|
|
132 |
|
@param |
133 |
|
@param |
134 |
|
@param |
135 |
|
@param |
136 |
|
@param |
137 |
|
@param |
138 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
139 |
67376 |
public SequenceFeature(String theType, String theDesc, int theBegin,... |
140 |
|
int theEnd, float theScore, String group) |
141 |
|
{ |
142 |
67376 |
this.type = theType; |
143 |
67376 |
this.description = theDesc; |
144 |
67376 |
this.begin = theBegin; |
145 |
67376 |
this.end = theEnd; |
146 |
67376 |
this.featureGroup = group; |
147 |
67376 |
this.score = theScore; |
148 |
|
|
149 |
|
|
150 |
|
|
151 |
|
|
152 |
67376 |
this.contactFeature = "disulfide bond".equalsIgnoreCase(type) |
153 |
|
|| "disulphide bond".equalsIgnoreCase(type); |
154 |
|
} |
155 |
|
|
156 |
|
|
157 |
|
|
158 |
|
|
159 |
|
@param |
160 |
|
@param |
161 |
|
@param |
162 |
|
@param |
163 |
|
@param |
164 |
|
@param |
165 |
|
|
|
|
| 62.5% |
Uncovered Elements: 6 (16) |
Complexity: 5 |
Complexity Density: 0.5 |
|
166 |
15301 |
public SequenceFeature(SequenceFeature sf, String newType, int newBegin,... |
167 |
|
int newEnd, String newGroup, float newScore) |
168 |
|
{ |
169 |
15301 |
this(newType, sf.getDescription(), newBegin, newEnd, newScore, |
170 |
|
newGroup); |
171 |
|
|
172 |
15301 |
this.source = sf.source; |
173 |
|
|
174 |
15301 |
if (sf.otherDetails != null) |
175 |
|
{ |
176 |
98 |
otherDetails = new HashMap<>(); |
177 |
98 |
for (Entry<String, Object> entry : sf.otherDetails.entrySet()) |
178 |
|
{ |
179 |
240 |
otherDetails.put(entry.getKey(), entry.getValue()); |
180 |
|
} |
181 |
|
} |
182 |
15301 |
if (sf.links != null && sf.links.size() > 0) |
183 |
|
{ |
184 |
0 |
links = new Vector<>(); |
185 |
0 |
for (int i = 0, iSize = sf.links.size(); i < iSize; i++) |
186 |
|
{ |
187 |
0 |
links.addElement(sf.links.elementAt(i)); |
188 |
|
} |
189 |
|
} |
190 |
|
} |
191 |
|
|
192 |
|
|
193 |
|
|
194 |
|
|
195 |
|
@param |
196 |
|
@param |
197 |
|
@param |
198 |
|
@param |
199 |
|
@param |
200 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
201 |
15300 |
public SequenceFeature(SequenceFeature sf, int newBegin, int newEnd,... |
202 |
|
String newGroup, float newScore) |
203 |
|
{ |
204 |
15300 |
this(sf, sf.getType(), newBegin, newEnd, newGroup, newScore); |
205 |
|
} |
206 |
|
|
207 |
|
|
208 |
|
|
209 |
|
|
210 |
|
|
211 |
|
|
212 |
|
|
213 |
|
|
214 |
|
|
215 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
216 |
69125 |
@Override... |
217 |
|
public boolean equals(Object o) |
218 |
|
{ |
219 |
69125 |
return equals(o, false); |
220 |
|
} |
221 |
|
|
222 |
|
|
223 |
|
|
224 |
|
|
225 |
|
|
226 |
|
|
227 |
|
|
228 |
|
@param |
229 |
|
@param |
230 |
|
@return |
231 |
|
|
|
|
| 97.2% |
Uncovered Elements: 1 (36) |
Complexity: 13 |
Complexity Density: 0.72 |
|
232 |
69125 |
public boolean equals(Object o, boolean ignoreParent)... |
233 |
|
{ |
234 |
69125 |
if (o == null || !(o instanceof SequenceFeature)) |
235 |
|
{ |
236 |
1 |
return false; |
237 |
|
} |
238 |
|
|
239 |
69124 |
SequenceFeature sf = (SequenceFeature) o; |
240 |
69124 |
boolean sameScore = Float.isNaN(score) ? Float.isNaN(sf.score) |
241 |
|
: score == sf.score; |
242 |
69124 |
if (begin != sf.begin || end != sf.end || !sameScore) |
243 |
|
{ |
244 |
50228 |
return false; |
245 |
|
} |
246 |
|
|
247 |
18896 |
if (getStrand() != sf.getStrand()) |
248 |
|
{ |
249 |
1 |
return false; |
250 |
|
} |
251 |
|
|
252 |
18895 |
if (!(type + description + featureGroup + getPhase()).equals( |
253 |
|
sf.type + sf.description + sf.featureGroup + sf.getPhase())) |
254 |
|
{ |
255 |
108 |
return false; |
256 |
|
} |
257 |
18787 |
if (!equalAttribute(getValue("ID"), sf.getValue("ID"))) |
258 |
|
{ |
259 |
1 |
return false; |
260 |
|
} |
261 |
18786 |
if (!equalAttribute(getValue("Name"), sf.getValue("Name"))) |
262 |
|
{ |
263 |
1 |
return false; |
264 |
|
} |
265 |
18785 |
if (!ignoreParent) |
266 |
|
{ |
267 |
18785 |
if (!equalAttribute(getValue("Parent"), sf.getValue("Parent"))) |
268 |
|
{ |
269 |
1 |
return false; |
270 |
|
} |
271 |
|
} |
272 |
18784 |
return true; |
273 |
|
} |
274 |
|
|
275 |
|
|
276 |
|
|
277 |
|
|
278 |
|
@param |
279 |
|
@param |
280 |
|
@return |
281 |
|
|
|
|
| 77.8% |
Uncovered Elements: 2 (9) |
Complexity: 4 |
Complexity Density: 0.8 |
|
282 |
56358 |
protected static boolean equalAttribute(Object att1, Object att2)... |
283 |
|
{ |
284 |
56358 |
if (att1 == null && att2 == null) |
285 |
|
{ |
286 |
56331 |
return true; |
287 |
|
} |
288 |
27 |
if (att1 != null) |
289 |
|
{ |
290 |
27 |
return att1.equals(att2); |
291 |
|
} |
292 |
0 |
return att2.equals(att1); |
293 |
|
} |
294 |
|
|
295 |
|
|
296 |
|
|
297 |
|
|
298 |
|
@return |
299 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
300 |
2274953 |
@Override... |
301 |
|
public int getBegin() |
302 |
|
{ |
303 |
2274957 |
return begin; |
304 |
|
} |
305 |
|
|
306 |
|
|
307 |
|
|
308 |
|
|
309 |
|
@return |
310 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
311 |
1188933 |
@Override... |
312 |
|
public int getEnd() |
313 |
|
{ |
314 |
1188942 |
return end; |
315 |
|
} |
316 |
|
|
317 |
|
|
318 |
|
|
319 |
|
|
320 |
|
@return |
321 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
322 |
157786 |
public String getType()... |
323 |
|
{ |
324 |
157788 |
return type; |
325 |
|
} |
326 |
|
|
327 |
|
|
328 |
|
|
329 |
|
|
330 |
|
@return |
331 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
332 |
31289 |
public String getDescription()... |
333 |
|
{ |
334 |
31289 |
return description; |
335 |
|
} |
336 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
337 |
340 |
public void setDescription(String desc)... |
338 |
|
{ |
339 |
340 |
description = desc; |
340 |
|
} |
341 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
342 |
104158 |
public String getFeatureGroup()... |
343 |
|
{ |
344 |
104158 |
return featureGroup; |
345 |
|
} |
346 |
|
|
|
|
| 75% |
Uncovered Elements: 2 (8) |
Complexity: 3 |
Complexity Density: 0.75 |
|
347 |
2452 |
public void addLink(String labelLink)... |
348 |
|
{ |
349 |
2452 |
if (links == null) |
350 |
|
{ |
351 |
2452 |
links = new Vector<>(); |
352 |
|
} |
353 |
|
|
354 |
2452 |
if (!links.contains(labelLink)) |
355 |
|
{ |
356 |
2452 |
links.insertElementAt(labelLink, 0); |
357 |
|
} |
358 |
|
} |
359 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
360 |
58181 |
public float getScore()... |
361 |
|
{ |
362 |
58181 |
return score; |
363 |
|
} |
364 |
|
|
365 |
|
|
366 |
|
|
367 |
|
|
368 |
|
|
369 |
|
@param |
370 |
|
|
371 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
372 |
164465 |
public Object getValue(String key)... |
373 |
|
{ |
374 |
164465 |
if (otherDetails == null) |
375 |
|
{ |
376 |
62922 |
return null; |
377 |
|
} |
378 |
|
else |
379 |
|
{ |
380 |
101543 |
return otherDetails.get(key); |
381 |
|
} |
382 |
|
} |
383 |
|
|
384 |
|
|
385 |
|
|
386 |
|
|
387 |
|
|
388 |
|
|
389 |
|
|
390 |
|
|
391 |
|
@param |
392 |
|
@return |
393 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 5 |
Complexity Density: 0.83 |
|
394 |
83 |
public String getValueAsString(String... key)... |
395 |
|
{ |
396 |
83 |
if (otherDetails == null) |
397 |
|
{ |
398 |
7 |
return null; |
399 |
|
} |
400 |
76 |
Object value = otherDetails.get(key[0]); |
401 |
76 |
if (key.length > 1 && value instanceof Map<?, ?>) |
402 |
|
{ |
403 |
20 |
value = ((Map) value).get(key[1]); |
404 |
|
} |
405 |
76 |
return value == null ? null : value.toString(); |
406 |
|
} |
407 |
|
|
408 |
|
|
409 |
|
|
410 |
|
|
411 |
|
|
412 |
|
@param |
413 |
|
@param |
414 |
|
@return |
415 |
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
416 |
2 |
public Object getValue(String key, Object defaultValue)... |
417 |
|
{ |
418 |
2 |
Object value = getValue(key); |
419 |
2 |
return value == null ? defaultValue : value; |
420 |
|
} |
421 |
|
|
422 |
|
|
423 |
|
|
424 |
|
|
425 |
|
|
426 |
|
@param |
427 |
|
|
428 |
|
@param |
429 |
|
|
430 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
431 |
26762 |
public void setValue(String key, Object value)... |
432 |
|
{ |
433 |
26762 |
if (value != null) |
434 |
|
{ |
435 |
16882 |
if (otherDetails == null) |
436 |
|
{ |
437 |
16516 |
otherDetails = new HashMap<>(); |
438 |
|
} |
439 |
|
|
440 |
16882 |
otherDetails.put(key, value); |
441 |
16882 |
recordAttribute(key, value); |
442 |
|
} |
443 |
|
} |
444 |
|
|
445 |
|
|
446 |
|
|
447 |
|
|
448 |
|
|
449 |
|
|
450 |
|
@param |
451 |
|
@param |
452 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
453 |
16882 |
protected void recordAttribute(String key, Object value)... |
454 |
|
{ |
455 |
16882 |
String attDesc = null; |
456 |
16882 |
if (source != null) |
457 |
|
{ |
458 |
133 |
attDesc = FeatureSources.getInstance().getSource(source) |
459 |
|
.getAttributeName(key); |
460 |
|
} |
461 |
|
|
462 |
16882 |
FeatureAttributes.getInstance().addAttribute(this.type, attDesc, value, |
463 |
|
key); |
464 |
|
} |
465 |
|
|
466 |
|
|
467 |
|
|
468 |
|
|
469 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
470 |
23472 |
public void setStatus(String status)... |
471 |
|
{ |
472 |
23472 |
setValue(STATUS, status); |
473 |
|
} |
474 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
475 |
13589 |
public String getStatus()... |
476 |
|
{ |
477 |
13589 |
return (String) getValue(STATUS); |
478 |
|
} |
479 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
480 |
30 |
public void setAttributes(String attr)... |
481 |
|
{ |
482 |
30 |
setValue(ATTRIBUTES, attr); |
483 |
|
} |
484 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
485 |
17 |
public String getAttributes()... |
486 |
|
{ |
487 |
17 |
return (String) getValue(ATTRIBUTES); |
488 |
|
} |
489 |
|
|
490 |
|
|
491 |
|
|
492 |
|
|
493 |
|
|
494 |
|
@return |
495 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 4 |
Complexity Density: 0.5 |
|
496 |
37821 |
public int getStrand()... |
497 |
|
{ |
498 |
37821 |
int strand = 0; |
499 |
37821 |
if (otherDetails != null) |
500 |
|
{ |
501 |
25388 |
Object str = otherDetails.get(STRAND); |
502 |
25388 |
if ("-".equals(str)) |
503 |
|
{ |
504 |
5 |
strand = -1; |
505 |
|
} |
506 |
25383 |
else if ("+".equals(str)) |
507 |
|
{ |
508 |
42 |
strand = 1; |
509 |
|
} |
510 |
|
} |
511 |
37821 |
return strand; |
512 |
|
} |
513 |
|
|
514 |
|
|
515 |
|
|
516 |
|
|
517 |
|
@param |
518 |
|
|
519 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
520 |
51 |
public void setStrand(String strand)... |
521 |
|
{ |
522 |
51 |
setValue(STRAND, strand); |
523 |
|
} |
524 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
525 |
35 |
public void setPhase(String phase)... |
526 |
|
{ |
527 |
35 |
setValue(PHASE, phase); |
528 |
|
} |
529 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
530 |
37821 |
public String getPhase()... |
531 |
|
{ |
532 |
37821 |
return (String) getValue(PHASE); |
533 |
|
} |
534 |
|
|
535 |
|
|
536 |
|
|
537 |
|
|
538 |
|
@param |
539 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
540 |
4 |
public void setEnaLocation(String loc)... |
541 |
|
{ |
542 |
4 |
setValue(LOCATION, loc); |
543 |
|
} |
544 |
|
|
545 |
|
|
546 |
|
|
547 |
|
|
548 |
|
@param |
549 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
550 |
0 |
public String getEnaLocation()... |
551 |
|
{ |
552 |
0 |
return (String) getValue(LOCATION); |
553 |
|
} |
554 |
|
|
555 |
|
|
556 |
|
|
557 |
|
|
558 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
559 |
4347 |
@Override... |
560 |
|
public String toString() |
561 |
|
{ |
562 |
4347 |
return String.format("%d %d %s %s", getBegin(), getEnd(), getType(), |
563 |
|
getDescription()); |
564 |
|
} |
565 |
|
|
566 |
|
|
567 |
|
|
568 |
|
|
569 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
570 |
4 |
@Override... |
571 |
|
public int hashCode() |
572 |
|
{ |
573 |
4 |
String s = getType() + getDescription() + getFeatureGroup() |
574 |
|
+ getValue("ID") + getValue("Name") + getValue("Parent") |
575 |
|
+ getPhase(); |
576 |
4 |
return s.hashCode() + getBegin() + getEnd() + (int) getScore() |
577 |
|
+ getStrand(); |
578 |
|
} |
579 |
|
|
580 |
|
|
581 |
|
|
582 |
|
|
583 |
|
|
584 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
585 |
135998 |
@Override... |
586 |
|
public boolean isContactFeature() |
587 |
|
{ |
588 |
135998 |
return contactFeature; |
589 |
|
} |
590 |
|
|
591 |
|
|
592 |
|
|
593 |
|
|
594 |
|
@return |
595 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
596 |
172765 |
public boolean isNonPositional()... |
597 |
|
{ |
598 |
172765 |
return begin == 0 && end == 0; |
599 |
|
} |
600 |
|
|
601 |
|
|
602 |
|
|
603 |
|
|
604 |
|
@return |
605 |
|
|
|
|
| 78.2% |
Uncovered Elements: 12 (55) |
Complexity: 12 |
Complexity Density: 0.34 |
|
606 |
4 |
public String getDetailsReport()... |
607 |
|
{ |
608 |
4 |
FeatureSourceI metadata = FeatureSources.getInstance() |
609 |
|
.getSource(source); |
610 |
|
|
611 |
4 |
StringBuilder sb = new StringBuilder(128); |
612 |
4 |
sb.append("<br>"); |
613 |
4 |
sb.append("<table>"); |
614 |
4 |
sb.append(String.format(ROW_DATA, "Type", type, "")); |
615 |
4 |
sb.append(String.format(ROW_DATA, "Start/end", begin == end ? begin |
616 |
3 |
: begin + (isContactFeature() ? ":" : "-") + end, "")); |
617 |
4 |
String desc = StringUtils.stripHtmlTags(description); |
618 |
4 |
sb.append(String.format(ROW_DATA, "Description", desc, "")); |
619 |
4 |
if (!Float.isNaN(score) && score != 0f) |
620 |
|
{ |
621 |
1 |
sb.append(String.format(ROW_DATA, "Score", score, "")); |
622 |
|
} |
623 |
4 |
if (featureGroup != null) |
624 |
|
{ |
625 |
2 |
sb.append(String.format(ROW_DATA, "Group", featureGroup, "")); |
626 |
|
} |
627 |
|
|
628 |
4 |
if (otherDetails != null) |
629 |
|
{ |
630 |
1 |
TreeMap<String, Object> ordered = new TreeMap<>( |
631 |
|
String.CASE_INSENSITIVE_ORDER); |
632 |
1 |
ordered.putAll(otherDetails); |
633 |
|
|
634 |
1 |
for (Entry<String, Object> entry : ordered.entrySet()) |
635 |
|
{ |
636 |
2 |
String key = entry.getKey(); |
637 |
2 |
if (ATTRIBUTES.equals(key)) |
638 |
|
{ |
639 |
0 |
continue; |
640 |
|
} |
641 |
|
|
642 |
2 |
Object value = entry.getValue(); |
643 |
2 |
if (value instanceof Map<?, ?>) |
644 |
|
{ |
645 |
|
|
646 |
|
|
647 |
|
|
648 |
|
|
649 |
0 |
Map<String, Object> values = (Map<String, Object>) value; |
650 |
0 |
SortedMap<String, Object> sm = new TreeMap<>( |
651 |
|
String.CASE_INSENSITIVE_ORDER); |
652 |
0 |
sm.putAll(values); |
653 |
0 |
for (Entry<?, ?> e : sm.entrySet()) |
654 |
|
{ |
655 |
0 |
sb.append(String.format(ROW_DATA, key, e.getKey().toString(), e |
656 |
|
.getValue().toString())); |
657 |
|
} |
658 |
|
} |
659 |
|
else |
660 |
|
{ |
661 |
|
|
662 |
2 |
String attDesc = null; |
663 |
2 |
if (metadata != null) |
664 |
|
{ |
665 |
0 |
attDesc = metadata.getAttributeName(key); |
666 |
|
} |
667 |
2 |
String s = entry.getValue().toString(); |
668 |
2 |
if (isValueInteresting(key, s, metadata)) |
669 |
|
{ |
670 |
2 |
sb.append(String.format(ROW_DATA, key, attDesc == null ? "" |
671 |
|
: attDesc, s)); |
672 |
|
} |
673 |
|
} |
674 |
|
} |
675 |
|
} |
676 |
4 |
sb.append("</table>"); |
677 |
|
|
678 |
4 |
String text = sb.toString(); |
679 |
4 |
return text; |
680 |
|
} |
681 |
|
|
682 |
|
|
683 |
|
|
684 |
|
|
685 |
|
|
686 |
|
@param |
687 |
|
@param |
688 |
|
@param |
689 |
|
@return |
690 |
|
|
|
|
| 26.3% |
Uncovered Elements: 14 (19) |
Complexity: 11 |
Complexity Density: 1 |
|
691 |
2 |
boolean isValueInteresting(String key, String value,... |
692 |
|
FeatureSourceI metadata) |
693 |
|
{ |
694 |
|
|
695 |
|
|
696 |
|
|
697 |
2 |
if (value == null || "".equals(value) || ".".equals(value) |
698 |
|
|| "0".equals(value)) |
699 |
|
{ |
700 |
0 |
return false; |
701 |
|
} |
702 |
|
|
703 |
2 |
if (metadata == null) |
704 |
|
{ |
705 |
2 |
return true; |
706 |
|
} |
707 |
|
|
708 |
0 |
FeatureAttributeType attType = metadata.getAttributeType(key); |
709 |
0 |
if (attType != null |
710 |
|
&& (attType == FeatureAttributeType.Float || attType |
711 |
|
.equals(FeatureAttributeType.Integer))) |
712 |
|
{ |
713 |
0 |
try |
714 |
|
{ |
715 |
0 |
float fval = Float.valueOf(value); |
716 |
0 |
if (fval == 0f) |
717 |
|
{ |
718 |
0 |
return false; |
719 |
|
} |
720 |
|
} catch (NumberFormatException e) |
721 |
|
{ |
722 |
|
|
723 |
|
} |
724 |
|
} |
725 |
|
|
726 |
0 |
return true; |
727 |
|
} |
728 |
|
|
729 |
|
|
730 |
|
|
731 |
|
|
732 |
|
@param |
733 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
734 |
43 |
public void setSource(String theSource)... |
735 |
|
{ |
736 |
43 |
source = theSource; |
737 |
|
} |
738 |
|
} |