1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2016 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
package eu.etaxonomy.cdm.model.common;
|
11
|
|
12
|
import java.util.Comparator;
|
13
|
|
14
|
import eu.etaxonomy.cdm.common.CdmUtils;
|
15
|
|
16
|
/**
|
17
|
* @author k.luther
|
18
|
* @date 08.06.2016
|
19
|
*
|
20
|
*/
|
21
|
public class TermIdInVocabularyComparator<T extends DefinedTermBase<?>> implements Comparator<T> {
|
22
|
|
23
|
/* (non-Javadoc)
|
24
|
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
|
25
|
*/
|
26
|
@Override
|
27
|
public int compare(T term1, T term2) {
|
28
|
String label1 = CdmUtils.Nz(term1.getIdInVocabulary());
|
29
|
String label2 = CdmUtils.Nz(term2.getIdInVocabulary());
|
30
|
return label1.compareTo(label2);
|
31
|
}
|
32
|
|
33
|
|
34
|
|
35
|
}
|