Revision 82ca4447
Added by Andreas Müller about 8 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/taxon/HomotypicGroupTaxonComparator.java | ||
---|---|---|
31 | 31 |
* basionyms (according to the following ordering)</li> |
32 | 32 |
* <li>If a name is illegitimate or not does play a role for ordering</li> |
33 | 33 |
* <li>Names with publication year should always come first</li> |
34 |
* <li>Names with no publication year are sorted alphabetically</li> |
|
34 |
* <li>Names with no publication year are sorted by rank</li> |
|
35 |
* <li>Names with no publication year and equal rank are sorted alphabetically</li> |
|
35 | 36 |
* <li>If 2 names have a replaced synonym relationship the replaced synonym comes first, |
36 | 37 |
* the replacement name comes later as this reflects the order of publication</li> |
37 | 38 |
* </ul> |
... | ... | |
54 | 55 |
* @param firstNameInGroup |
55 | 56 |
*/ |
56 | 57 |
public HomotypicGroupTaxonComparator(@SuppressWarnings("rawtypes") TaxonBase firstTaxonInGroup) { |
58 |
super(true); |
|
59 |
this.firstTaxonInGroup = firstTaxonInGroup; |
|
60 |
this.firstNameInGroup = firstTaxonInGroup == null ? null: firstTaxonInGroup.getName(); |
|
61 |
} |
|
62 |
|
|
63 |
/** |
|
64 |
* @param firstNameInGroup |
|
65 |
*/ |
|
66 |
public HomotypicGroupTaxonComparator(@SuppressWarnings("rawtypes") TaxonBase firstTaxonInGroup, boolean includeRanks) { |
|
67 |
super(includeRanks); |
|
57 | 68 |
this.firstTaxonInGroup = firstTaxonInGroup; |
58 | 69 |
this.firstNameInGroup = firstTaxonInGroup == null ? null: firstTaxonInGroup.getName(); |
59 | 70 |
} |
... | ... | |
81 | 92 |
|
82 | 93 |
//not same homotypical group - |
83 | 94 |
//NOTE: this comparator should usually not be used |
84 |
// for comparing names of different homotypcial groups.
|
|
95 |
// for comparing names of different homotypical groups.
|
|
85 | 96 |
// The following is only to have a defined compare behavior |
86 | 97 |
// which follows the contract of Comparator#compare. |
87 | 98 |
if (name1 == null || |
88 | 99 |
name2 == null || |
89 | 100 |
! name1.getHomotypicalGroup().equals(name2.getHomotypicalGroup())){ |
90 | 101 |
|
91 |
// |
|
92 |
// HomotypicalGroup hg1 = name1.getHomotypicalGroup(); |
|
93 |
// HomotypicalGroup hg2 = name2.getHomotypicalGroup(); |
|
94 |
|
|
95 |
|
|
96 | 102 |
String compareString1 = name1 != null ? |
97 |
// getFirstNameInHomotypicalGroup(name1) |
|
98 | 103 |
name1.getHomotypicalGroup().getUuid().toString() : |
99 | 104 |
taxonBase1.getUuid().toString(); |
100 | 105 |
String compareString2 = name2 != null ? |
Also available in: Unified diff
Include rank comparison in HomotypicGroupTaxonComparator #3338