1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.util; |
22 |
|
|
23 |
|
import static jalview.util.UrlConstants.DB_ACCESSION; |
24 |
|
import static jalview.util.UrlConstants.DELIM; |
25 |
|
import static jalview.util.UrlConstants.SEP; |
26 |
|
import static jalview.util.UrlConstants.SEQUENCE_ID; |
27 |
|
|
28 |
|
import jalview.datamodel.DBRefEntry; |
29 |
|
import jalview.datamodel.SequenceI; |
30 |
|
|
31 |
|
import java.util.Arrays; |
32 |
|
import java.util.Collections; |
33 |
|
import java.util.Comparator; |
34 |
|
import java.util.List; |
35 |
|
import java.util.Map; |
36 |
|
import java.util.Vector; |
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
|
|
| 0% |
Uncovered Elements: 264 (264) |
Complexity: 85 |
Complexity Density: 0.57 |
|
47 |
|
public class UrlLink |
48 |
|
{ |
49 |
|
private static final String SEQUENCEID_PLACEHOLDER = DELIM + SEQUENCE_ID |
50 |
|
+ DELIM; |
51 |
|
|
52 |
|
private static final String ACCESSION_PLACEHOLDER = DELIM + DB_ACCESSION |
53 |
|
+ DELIM; |
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
public static final Comparator<String> LINK_COMPARATOR = new Comparator<String>() |
62 |
|
{ |
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 7 |
Complexity Density: 1 |
|
63 |
0 |
@Override... |
64 |
|
public int compare(String link1, String link2) |
65 |
|
{ |
66 |
0 |
if (link1 == null || link2 == null) |
67 |
|
{ |
68 |
0 |
return 0; |
69 |
|
} |
70 |
0 |
if (link1.contains(SEQUENCEID_PLACEHOLDER) |
71 |
|
&& link2.contains(ACCESSION_PLACEHOLDER)) |
72 |
|
{ |
73 |
0 |
return -1; |
74 |
|
} |
75 |
0 |
if (link2.contains(SEQUENCEID_PLACEHOLDER) |
76 |
|
&& link1.contains(ACCESSION_PLACEHOLDER)) |
77 |
|
{ |
78 |
0 |
return 1; |
79 |
|
} |
80 |
0 |
return String.CASE_INSENSITIVE_ORDER.compare(link1, link2); |
81 |
|
} |
82 |
|
}; |
83 |
|
|
84 |
|
private static final String EQUALS = "="; |
85 |
|
|
86 |
|
private static final String SPACE = " "; |
87 |
|
|
88 |
|
private String urlSuffix; |
89 |
|
|
90 |
|
private String urlPrefix; |
91 |
|
|
92 |
|
private String target; |
93 |
|
|
94 |
|
private String label; |
95 |
|
|
96 |
|
private String dbname; |
97 |
|
|
98 |
|
private String regexReplace; |
99 |
|
|
100 |
|
private boolean dynamic = false; |
101 |
|
|
102 |
|
private boolean usesDBaccession = false; |
103 |
|
|
104 |
|
private String invalidMessage = null; |
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
@param |
112 |
|
|
|
|
| 0% |
Uncovered Elements: 31 (31) |
Complexity: 4 |
Complexity Density: 0.16 |
|
113 |
0 |
public UrlLink(String link)... |
114 |
|
{ |
115 |
0 |
int sep = link.indexOf(SEP); |
116 |
0 |
int psqid = link.indexOf(DELIM + DB_ACCESSION); |
117 |
0 |
int nsqid = link.indexOf(DELIM + SEQUENCE_ID); |
118 |
0 |
if (psqid > -1) |
119 |
|
{ |
120 |
0 |
dynamic = true; |
121 |
0 |
usesDBaccession = true; |
122 |
|
|
123 |
0 |
sep = parseLabel(sep, psqid, link); |
124 |
|
|
125 |
0 |
int endOfRegex = parseUrl(link, DB_ACCESSION, psqid, sep); |
126 |
0 |
parseTarget(link, sep, endOfRegex); |
127 |
|
} |
128 |
0 |
else if (nsqid > -1) |
129 |
|
{ |
130 |
0 |
dynamic = true; |
131 |
0 |
sep = parseLabel(sep, nsqid, link); |
132 |
|
|
133 |
0 |
int endOfRegex = parseUrl(link, SEQUENCE_ID, nsqid, sep); |
134 |
|
|
135 |
0 |
parseTarget(link, sep, endOfRegex); |
136 |
|
} |
137 |
|
else |
138 |
|
{ |
139 |
0 |
label = link.substring(0, sep).trim(); |
140 |
|
|
141 |
|
|
142 |
|
|
143 |
0 |
int lastsep = link.lastIndexOf(SEP); |
144 |
0 |
if (lastsep != sep) |
145 |
|
{ |
146 |
0 |
urlPrefix = link.substring(sep + 1, lastsep).trim(); |
147 |
0 |
target = link.substring(lastsep + 1).trim(); |
148 |
|
} |
149 |
|
else |
150 |
|
{ |
151 |
0 |
urlPrefix = link.substring(sep + 1).trim(); |
152 |
0 |
target = label; |
153 |
|
} |
154 |
|
|
155 |
0 |
regexReplace = null; |
156 |
0 |
urlSuffix = null; |
157 |
|
} |
158 |
|
|
159 |
0 |
label = label.trim(); |
160 |
0 |
target = target.trim(); |
161 |
|
} |
162 |
|
|
163 |
|
|
164 |
|
|
165 |
|
|
166 |
|
@param |
167 |
|
|
168 |
|
@param |
169 |
|
|
170 |
|
@param |
171 |
|
|
172 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
173 |
0 |
public UrlLink(String name, String url, String desc)... |
174 |
|
{ |
175 |
0 |
this(name + SEP + url + SEP + desc); |
176 |
|
} |
177 |
|
|
178 |
|
|
179 |
|
@return |
180 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
181 |
0 |
public String getUrlSuffix()... |
182 |
|
{ |
183 |
0 |
return urlSuffix; |
184 |
|
} |
185 |
|
|
186 |
|
|
187 |
|
@return |
188 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
189 |
0 |
public String getUrlPrefix()... |
190 |
|
{ |
191 |
0 |
return urlPrefix; |
192 |
|
} |
193 |
|
|
194 |
|
|
195 |
|
@return |
196 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
197 |
0 |
public String getTarget()... |
198 |
|
{ |
199 |
0 |
return target; |
200 |
|
} |
201 |
|
|
202 |
|
|
203 |
|
@return |
204 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
205 |
0 |
public String getLabel()... |
206 |
|
{ |
207 |
0 |
return label; |
208 |
|
} |
209 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 5 |
Complexity Density: 2.5 |
|
210 |
0 |
public String getUrlWithToken()... |
211 |
|
{ |
212 |
0 |
String var = (usesDBaccession ? DB_ACCESSION : SEQUENCE_ID); |
213 |
|
|
214 |
0 |
return urlPrefix |
215 |
0 |
+ (dynamic |
216 |
|
? (DELIM + var |
217 |
0 |
+ ((regexReplace != null) |
218 |
|
? EQUALS + regexReplace + EQUALS + DELIM |
219 |
|
: DELIM)) |
220 |
|
: "") |
221 |
0 |
+ ((urlSuffix == null) ? "" : urlSuffix); |
222 |
|
} |
223 |
|
|
224 |
|
|
225 |
|
@return |
226 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
227 |
0 |
public String getRegexReplace()... |
228 |
|
{ |
229 |
0 |
return regexReplace; |
230 |
|
} |
231 |
|
|
232 |
|
|
233 |
|
@return |
234 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
235 |
0 |
public String getInvalidMessage()... |
236 |
|
{ |
237 |
0 |
return invalidMessage; |
238 |
|
} |
239 |
|
|
240 |
|
|
241 |
|
|
242 |
|
|
243 |
|
@return |
244 |
|
|
245 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
246 |
0 |
public boolean isValid()... |
247 |
|
{ |
248 |
0 |
return invalidMessage == null; |
249 |
|
} |
250 |
|
|
251 |
|
|
252 |
|
|
253 |
|
@return |
254 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
255 |
0 |
public boolean isDynamic()... |
256 |
|
{ |
257 |
0 |
return dynamic; |
258 |
|
} |
259 |
|
|
260 |
|
|
261 |
|
|
262 |
|
@return |
263 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
264 |
0 |
public boolean usesDBAccession()... |
265 |
|
{ |
266 |
0 |
return usesDBaccession; |
267 |
|
} |
268 |
|
|
269 |
|
|
270 |
|
|
271 |
|
|
272 |
|
@param |
273 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
274 |
0 |
public void setLabel(String newlabel)... |
275 |
|
{ |
276 |
0 |
this.label = newlabel; |
277 |
|
} |
278 |
|
|
279 |
|
|
280 |
|
|
281 |
|
|
282 |
|
@param |
283 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
284 |
0 |
public void setTarget(String desc)... |
285 |
|
{ |
286 |
0 |
target = desc; |
287 |
|
} |
288 |
|
|
289 |
|
|
290 |
|
|
291 |
|
|
292 |
|
@param |
293 |
|
@param |
294 |
|
|
295 |
|
|
296 |
|
@return |
297 |
|
|
298 |
|
|
|
|
| 0% |
Uncovered Elements: 66 (66) |
Complexity: 19 |
Complexity Density: 0.5 |
|
299 |
0 |
public String[] makeUrls(String idstring, boolean onlyIfMatches)... |
300 |
|
{ |
301 |
0 |
if (dynamic) |
302 |
|
{ |
303 |
0 |
if (regexReplace != null) |
304 |
|
{ |
305 |
0 |
com.stevesoft.pat.Regex rg = com.stevesoft.pat.Regex |
306 |
|
.perlCode("/" + regexReplace + "/"); |
307 |
0 |
if (rg.search(idstring)) |
308 |
|
{ |
309 |
0 |
int ns = rg.numSubs(); |
310 |
0 |
if (ns == 0) |
311 |
|
{ |
312 |
|
|
313 |
0 |
return new String[] { rg.stringMatched(), |
314 |
|
urlPrefix + rg.stringMatched() + urlSuffix }; |
315 |
|
} |
316 |
|
|
317 |
|
|
318 |
|
|
319 |
|
|
320 |
|
else |
321 |
|
{ |
322 |
|
|
323 |
0 |
for (int s = 0; s <= rg.numSubs(); s++) |
324 |
|
{ |
325 |
0 |
jalview.bin.Console.errPrintln("Sub " + s + " : " |
326 |
|
+ rg.matchedFrom(s) + " : " + rg.matchedTo(s) + " : '" |
327 |
|
+ rg.stringMatched(s) + "'"); |
328 |
|
} |
329 |
|
|
330 |
0 |
Vector<String> subs = new Vector<>(); |
331 |
|
|
332 |
|
|
333 |
0 |
int s = 0; |
334 |
0 |
while (s <= ns) |
335 |
|
{ |
336 |
0 |
if (s + 1 <= ns && rg.matchedTo(s) > -1 |
337 |
|
&& rg.matchedTo(s + 1) > -1 |
338 |
|
&& rg.matchedTo(s + 1) < rg.matchedTo(s)) |
339 |
|
{ |
340 |
|
|
341 |
|
|
342 |
0 |
int r = s + 1; |
343 |
0 |
String mtch = ""; |
344 |
0 |
while (r <= ns && rg.matchedTo(r) <= rg.matchedTo(s)) |
345 |
|
{ |
346 |
0 |
if (rg.matchedFrom(r) > -1) |
347 |
|
{ |
348 |
0 |
mtch += rg.stringMatched(r); |
349 |
|
} |
350 |
0 |
r++; |
351 |
|
} |
352 |
0 |
if (mtch.length() > 0) |
353 |
|
{ |
354 |
0 |
subs.addElement(mtch); |
355 |
0 |
subs.addElement(urlPrefix + mtch + urlSuffix); |
356 |
|
} |
357 |
0 |
s = r; |
358 |
|
} |
359 |
|
else |
360 |
|
{ |
361 |
0 |
if (rg.matchedFrom(s) > -1) |
362 |
|
{ |
363 |
0 |
subs.addElement(rg.stringMatched(s)); |
364 |
0 |
subs.addElement( |
365 |
|
urlPrefix + rg.stringMatched(s) + urlSuffix); |
366 |
|
} |
367 |
0 |
s++; |
368 |
|
} |
369 |
|
} |
370 |
|
|
371 |
0 |
String[] res = new String[subs.size()]; |
372 |
0 |
for (int r = 0, rs = subs.size(); r < rs; r++) |
373 |
|
{ |
374 |
0 |
res[r] = subs.elementAt(r); |
375 |
|
} |
376 |
0 |
subs.removeAllElements(); |
377 |
0 |
return res; |
378 |
|
} |
379 |
|
} |
380 |
0 |
if (onlyIfMatches) |
381 |
|
{ |
382 |
0 |
return null; |
383 |
|
} |
384 |
|
} |
385 |
|
|
386 |
0 |
if (idstring.indexOf(SEP) > -1) |
387 |
|
{ |
388 |
0 |
idstring = idstring.substring(idstring.lastIndexOf(SEP) + 1); |
389 |
|
} |
390 |
|
|
391 |
|
|
392 |
0 |
return new String[] { idstring, urlPrefix + idstring + urlSuffix }; |
393 |
|
} |
394 |
|
else |
395 |
|
{ |
396 |
0 |
return new String[] { "", urlPrefix }; |
397 |
|
} |
398 |
|
} |
399 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
400 |
0 |
@Override... |
401 |
|
public String toString() |
402 |
|
{ |
403 |
0 |
return label + SEP + getUrlWithToken(); |
404 |
|
} |
405 |
|
|
406 |
|
|
407 |
|
@return |
408 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
409 |
0 |
public String toStringWithTarget()... |
410 |
|
{ |
411 |
0 |
return label + SEP + getUrlWithToken() + SEP + target; |
412 |
|
} |
413 |
|
|
414 |
|
|
415 |
|
|
416 |
|
|
417 |
|
@param |
418 |
|
|
419 |
|
@param |
420 |
|
|
421 |
|
@param |
422 |
|
|
423 |
|
@return |
424 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
425 |
0 |
protected int parseLabel(int firstSep, int psqid, String link)... |
426 |
|
{ |
427 |
0 |
int p = firstSep; |
428 |
0 |
int sep = firstSep; |
429 |
0 |
do |
430 |
|
{ |
431 |
0 |
sep = p; |
432 |
0 |
p = link.indexOf(SEP, sep + 1); |
433 |
0 |
} while (p > sep && p < psqid); |
434 |
|
|
435 |
|
|
436 |
0 |
label = link.substring(0, sep); |
437 |
|
|
438 |
0 |
return sep; |
439 |
|
} |
440 |
|
|
441 |
|
|
442 |
|
|
443 |
|
|
444 |
|
@param |
445 |
|
|
446 |
|
@param |
447 |
|
|
448 |
|
@param |
449 |
|
|
450 |
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 5 |
Complexity Density: 0.62 |
|
451 |
0 |
protected void parseTarget(String link, int sep, int endOfRegex)... |
452 |
|
{ |
453 |
0 |
int lastsep = link.lastIndexOf(SEP); |
454 |
|
|
455 |
0 |
if ((lastsep != sep) && (lastsep > endOfRegex)) |
456 |
|
{ |
457 |
|
|
458 |
0 |
target = link.substring(lastsep + 1).trim(); |
459 |
|
} |
460 |
|
else |
461 |
|
{ |
462 |
0 |
target = label; |
463 |
|
} |
464 |
|
|
465 |
0 |
if (target.indexOf(SEP) > -1) |
466 |
|
{ |
467 |
|
|
468 |
0 |
target = target.substring(0, target.indexOf(SEP)); |
469 |
|
} |
470 |
0 |
else if (target.indexOf(SPACE) > 2) |
471 |
|
{ |
472 |
|
|
473 |
0 |
target = target.substring(0, target.indexOf(SPACE)); |
474 |
|
} |
475 |
|
} |
476 |
|
|
477 |
|
|
478 |
|
|
479 |
|
|
480 |
|
@param |
481 |
|
|
482 |
|
@param |
483 |
|
|
484 |
|
@param |
485 |
|
|
486 |
|
@param |
487 |
|
|
488 |
|
@return |
489 |
|
|
|
|
| 0% |
Uncovered Elements: 30 (30) |
Complexity: 7 |
Complexity Density: 0.32 |
|
490 |
0 |
protected int parseUrl(String link, String varName, int sqidPos, int sep)... |
491 |
|
{ |
492 |
0 |
urlPrefix = link.substring(sep + 1, sqidPos).trim(); |
493 |
|
|
494 |
|
|
495 |
0 |
String startDelimiter = DELIM + varName + "=/"; |
496 |
|
|
497 |
|
|
498 |
0 |
String endDelimiter = "/=" + DELIM; |
499 |
|
|
500 |
0 |
int startLength = startDelimiter.length(); |
501 |
|
|
502 |
|
|
503 |
0 |
int p = link.indexOf(endDelimiter, sqidPos + startLength); |
504 |
|
|
505 |
0 |
if (link.indexOf(startDelimiter) == sqidPos |
506 |
|
&& (p > sqidPos + startLength)) |
507 |
|
{ |
508 |
|
|
509 |
0 |
urlSuffix = link.substring(p + endDelimiter.length()); |
510 |
0 |
regexReplace = link.substring(sqidPos + startLength, p); |
511 |
0 |
try |
512 |
|
{ |
513 |
0 |
com.stevesoft.pat.Regex rg = com.stevesoft.pat.Regex |
514 |
|
.perlCode("/" + regexReplace + "/"); |
515 |
0 |
if (rg == null) |
516 |
|
{ |
517 |
0 |
invalidMessage = "Invalid Regular Expression : '" + regexReplace |
518 |
|
+ "'\n"; |
519 |
|
} |
520 |
|
} catch (Exception e) |
521 |
|
{ |
522 |
0 |
invalidMessage = "Invalid Regular Expression : '" + regexReplace |
523 |
|
+ "'\n"; |
524 |
|
} |
525 |
|
} |
526 |
|
else |
527 |
|
{ |
528 |
|
|
529 |
0 |
regexReplace = null; |
530 |
|
|
531 |
0 |
if (link.indexOf(DELIM + varName + DELIM) == sqidPos) |
532 |
|
{ |
533 |
0 |
int lastsep = link.lastIndexOf(SEP); |
534 |
0 |
if (lastsep < sqidPos + startLength - 1) |
535 |
|
{ |
536 |
|
|
537 |
0 |
lastsep = link.length(); |
538 |
|
} |
539 |
0 |
urlSuffix = link.substring(sqidPos + startLength - 1, lastsep) |
540 |
|
.trim(); |
541 |
0 |
regexReplace = null; |
542 |
|
} |
543 |
|
else |
544 |
|
{ |
545 |
0 |
invalidMessage = "Warning: invalid regex structure for URL link : " |
546 |
|
+ link; |
547 |
|
} |
548 |
|
} |
549 |
|
|
550 |
0 |
return p; |
551 |
|
} |
552 |
|
|
553 |
|
|
554 |
|
|
555 |
|
|
556 |
|
@param |
557 |
|
|
558 |
|
@param |
559 |
|
|
560 |
|
|
561 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 3 |
Complexity Density: 1 |
|
562 |
0 |
public void createLinksFromSeq(final SequenceI seq,... |
563 |
|
Map<String, List<String>> linkset) |
564 |
|
{ |
565 |
0 |
if (seq != null && dynamic) |
566 |
|
{ |
567 |
0 |
createDynamicLinks(seq, linkset); |
568 |
|
} |
569 |
|
else |
570 |
|
{ |
571 |
0 |
createStaticLink(linkset); |
572 |
|
} |
573 |
|
} |
574 |
|
|
575 |
|
|
576 |
|
|
577 |
|
|
578 |
|
@param |
579 |
|
|
580 |
|
|
581 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
582 |
0 |
protected void createStaticLink(Map<String, List<String>> linkset)... |
583 |
|
{ |
584 |
0 |
if (!linkset.containsKey(label + SEP + getUrlPrefix())) |
585 |
|
{ |
586 |
|
|
587 |
0 |
linkset.put(label + SEP + getUrlPrefix(), |
588 |
|
Arrays.asList(target, label, null, getUrlPrefix())); |
589 |
|
} |
590 |
|
} |
591 |
|
|
592 |
|
|
593 |
|
|
594 |
|
|
595 |
|
@param |
596 |
|
|
597 |
|
@param |
598 |
|
|
599 |
|
|
600 |
|
|
|
|
| 0% |
Uncovered Elements: 25 (25) |
Complexity: 10 |
Complexity Density: 0.77 |
|
601 |
0 |
protected void createDynamicLinks(final SequenceI seq,... |
602 |
|
Map<String, List<String>> linkset) |
603 |
|
{ |
604 |
|
|
605 |
0 |
String id = seq.getName(); |
606 |
0 |
String descr = seq.getDescription(); |
607 |
0 |
if (descr != null && descr.length() < 1) |
608 |
|
{ |
609 |
0 |
descr = null; |
610 |
|
} |
611 |
|
|
612 |
0 |
if (usesDBAccession()) |
613 |
|
{ |
614 |
|
|
615 |
0 |
List<DBRefEntry> dbr = DBRefUtils.selectRefs(seq.getDBRefs(), |
616 |
|
new String[] |
617 |
|
{ target }); |
618 |
|
|
619 |
|
|
620 |
0 |
if (dbr != null) |
621 |
|
{ |
622 |
0 |
for (int r = 0, nd = dbr.size(); r < nd; r++) |
623 |
|
{ |
624 |
|
|
625 |
0 |
createBareURLLink(dbr.get(r).getAccessionId(), true, linkset); |
626 |
|
} |
627 |
|
} |
628 |
|
} |
629 |
0 |
else if (!usesDBAccession() && id != null) |
630 |
|
{ |
631 |
|
|
632 |
0 |
createBareURLLink(id, false, linkset); |
633 |
|
} |
634 |
|
|
635 |
|
|
636 |
|
|
637 |
0 |
if (descr != null && getRegexReplace() != null) |
638 |
|
{ |
639 |
|
|
640 |
0 |
createBareURLLink(descr, false, linkset); |
641 |
|
} |
642 |
|
} |
643 |
|
|
644 |
|
|
645 |
|
|
646 |
|
|
647 |
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 5 |
Complexity Density: 0.62 |
|
648 |
0 |
protected void createBareURLLink(String id, Boolean combineLabel,... |
649 |
|
Map<String, List<String>> linkset) |
650 |
|
{ |
651 |
0 |
String[] urls = makeUrls(id, true); |
652 |
0 |
if (urls != null) |
653 |
|
{ |
654 |
0 |
for (int u = 0; u < urls.length; u += 2) |
655 |
|
{ |
656 |
0 |
if (!linkset.containsKey(urls[u] + SEP + urls[u + 1])) |
657 |
|
{ |
658 |
0 |
String thisLabel = label; |
659 |
0 |
if (combineLabel) |
660 |
|
{ |
661 |
|
|
662 |
0 |
thisLabel = label + SEP + urls[u]; |
663 |
|
} |
664 |
|
|
665 |
0 |
linkset.put(urls[u] + SEP + urls[u + 1], |
666 |
|
Arrays.asList(target, thisLabel, urls[u], urls[u + 1])); |
667 |
|
} |
668 |
|
} |
669 |
|
} |
670 |
|
} |
671 |
|
|
672 |
|
|
673 |
|
|
674 |
|
|
675 |
|
|
676 |
|
|
677 |
|
|
678 |
|
|
679 |
|
|
680 |
|
|
681 |
|
@param |
682 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
683 |
0 |
public static void sort(List<String> nlinks)... |
684 |
|
{ |
685 |
0 |
Collections.sort(nlinks, LINK_COMPARATOR); |
686 |
|
} |
687 |
|
} |