Project

General

Profile

Download (944 Bytes) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2009 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.taxeditor.model;
11

    
12
import java.util.Comparator;
13

    
14
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
15
import eu.etaxonomy.taxeditor.store.CdmStore;
16

    
17
/**
18
 * @author n.hoffmann
19
 * @date Jan 18, 2012
20
 *
21
 */
22
public class DefaultTermComparator<T extends DefinedTermBase> implements Comparator<T> {
23
	@Override
24
	public int compare(T o1, T o2) {
25
		String label1 = o1.getLabel(CdmStore.getDefaultLanguage()) != null ? o1.getLabel(CdmStore.getDefaultLanguage()) : o1.getTitleCache();
26
		String label2 = o2.getLabel(CdmStore.getDefaultLanguage()) != null ? o2.getLabel(CdmStore.getDefaultLanguage()) : o2.getTitleCache();
27
		return label1.compareTo(label2);
28
	}
29
};
(9-9/32)