Project

General

Profile

Revision ba6cefb5

IDba6cefb542499e6bb7c655d9e719a8271756bbac
Parent 9b7d57ff
Child 8feb2342

Added by Katja Luther over 2 years ago

ref #7515: TypedesignationStatusComparator inherit from OrderedTermComparator

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/name/TypeDesignationStatusComparator.java
8 8
*/
9 9
package eu.etaxonomy.cdm.api.service.name;
10 10

  
11
import java.util.Comparator;
12

  
13 11
import eu.etaxonomy.cdm.api.service.name.TypeDesignationSetManager.NullTypeDesignationStatus;
14 12
import eu.etaxonomy.cdm.model.name.TypeDesignationStatusBase;
13
import eu.etaxonomy.cdm.model.term.OrderedTermComparator;
15 14

  
16 15
/**
17 16
 * @author a.kohlbecker
18 17
 *
19 18
 */
20
public class TypeDesignationStatusComparator <T extends TypeDesignationStatusBase<T>>  implements Comparator<T> {
19
public class TypeDesignationStatusComparator <T extends TypeDesignationStatusBase<T>>  extends OrderedTermComparator<T> {
21 20
    @Override
22 21
    public int compare(T o1, T o2) {
23 22
        // fix inverted order of cdm terms by -1*
23

  
24 24
        if(o1 == null && o2 == null || o1 instanceof NullTypeDesignationStatus && o2 instanceof NullTypeDesignationStatus){
25 25
            return 0;
26 26
        }
......
31 31
        if(o2 == null || o2 instanceof NullTypeDesignationStatus){
32 32
            return 1;
33 33
        }
34
        return -1 * o1.compareTo(o2);
34

  
35
        return -1 * super.compare(o1, o2);
35 36
    }
36 37
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)