Project

General

Profile

« Previous | Next » 

Revision d825b848

Added by Andreas Müller about 5 years ago

cleanup

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/TypeComparator.java
10 10

  
11 11
import java.util.Comparator;
12 12

  
13
import eu.etaxonomy.cdm.model.common.CdmBase;
14

  
13 15
/**
14 16
 * @author k.luther
15 17
 * @since 21.03.2017
16 18
 *
17 19
 */
18
public class TypeComparator implements Comparator<TypeDesignationBase> {
20
public class TypeComparator implements Comparator<TypeDesignationBase<?>> {
19 21

  
20 22
    /**
21 23
     * {@inheritDoc}
22 24
     */
23 25
    @Override
24
    public int compare(TypeDesignationBase o1, TypeDesignationBase o2) {
26
    public int compare(TypeDesignationBase<?> o1, TypeDesignationBase<?> o2) {
25 27
        /*
26 28
         * Sortierung:
27 29
        1.  Status der Typen: a) holo, lecto, neo, syn, b) epi, paralecto, c) para (wenn überhaupt) – die jeweiligen iso immer direct mit dazu
......
44 46
            return 1;
45 47
        }
46 48

  
47
        TypeDesignationStatusBase status1 = o1.getTypeStatus();
48
        TypeDesignationStatusBase status2 = o2.getTypeStatus();
49
        TypeDesignationStatusBase<?> status1 = getStatus(o1);
50
        TypeDesignationStatusBase<?> status2 = getStatus(o2);
49 51

  
50 52
        result = compareStatus(status1, status2);
51 53
        if (result != 0){
......
67 69
        return result;
68 70
    }
69 71

  
72
    /**
73
     * @param o1
74
     * @return
75
     */
76
    private TypeDesignationStatusBase<?> getStatus(TypeDesignationBase<?> td) {
77
        if (td.isInstanceOf(TypeDesignationBase.class)){
78
            return CdmBase.deproxy(td, TypeDesignationBase.class).getTypeStatus();
79
        }else{
80
            return null;
81
        }
82
    }
83

  
70 84
    /**
71 85
     * @param status1
72 86
     * @param status2
......
187 201
             return false;
188 202
         }
189 203
    }
190

  
191

  
192 204
}

Also available in: Unified diff