Revision e436a9ce
Added by Andreas Müller almost 3 years ago
cdmlib-ext/src/main/java/eu/etaxonomy/cdm/ext/geo/CondensedDistributionComposer.java | ||
---|---|---|
100 | 100 |
|
101 | 101 |
//4. replace the area by the abbreviated representation and add symbols |
102 | 102 |
AreaNodeComparator areaNodeComparator = new AreaNodeComparator(config, languages); |
103 |
Collections.sort(topLevelNodes, areaNodeComparator); |
|
103 |
AreaNodeComparator topLevelAreaOfScopeComparator = config.orderType == OrderType.NATURAL ? areaNodeComparator : new AreaNodeComparator(config, languages, OrderType.NATURAL); |
|
104 |
|
|
105 |
Collections.sort(topLevelNodes, topLevelAreaOfScopeComparator); |
|
104 | 106 |
|
105 | 107 |
final boolean NOT_BOLED = false; |
106 | 108 |
final boolean NOT_HANDLED_BY_PARENT = false; |
... | ... | |
134 | 136 |
|
135 | 137 |
//outOfScope areas (areas outside the endemic area) |
136 | 138 |
if (!outOfScopeNodes.isEmpty()){ |
139 |
Collections.sort(topLevelNodes, areaNodeComparator); |
|
140 |
|
|
137 | 141 |
result.addPostSeparatorTaggedText(config.outOfScopeAreasSeperator); |
138 | 142 |
List<AreaNode> outOfScopeList = new ArrayList<>(outOfScopeNodes); |
139 | 143 |
Collections.sort(outOfScopeList, areaNodeComparator); |
... | ... | |
424 | 428 |
} |
425 | 429 |
|
426 | 430 |
private class AreaNodeComparator implements Comparator<AreaNode>{ |
427 |
CondensedDistributionConfiguration config; |
|
428 |
List<Language> languages; |
|
431 |
private CondensedDistributionConfiguration config; |
|
432 |
private OrderType orderType; |
|
433 |
private List<Language> languages; |
|
434 |
|
|
429 | 435 |
private AreaNodeComparator(CondensedDistributionConfiguration config, List<Language> languages){ |
436 |
this(config, languages, null); |
|
437 |
} |
|
438 |
|
|
439 |
private AreaNodeComparator(CondensedDistributionConfiguration config, List<Language> languages, OrderType divergentOrderType){ |
|
430 | 440 |
this.config = config; |
431 | 441 |
this.languages = languages; |
442 |
this.orderType = divergentOrderType != null? divergentOrderType : config.orderType; |
|
432 | 443 |
} |
433 | 444 |
|
434 | 445 |
@Override |
... | ... | |
443 | 454 |
}else if (area2 == null){ |
444 | 455 |
return 1; |
445 | 456 |
}else{ |
446 |
if (config.orderType == OrderType.NATURAL) {
|
|
457 |
if (orderType == OrderType.NATURAL) { |
|
447 | 458 |
//- due to wrong ordering behavior in DefinedTerms |
448 | 459 |
return - area1.compareTo(area2); |
449 | 460 |
}else{ |
Also available in: Unified diff
ref #8297 improve out of scope handling for alphabetically ordered condensed distributions