Project

General

Profile

Download (951 Bytes) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.compare.name;
10

    
11
import java.io.Serializable;
12
import java.util.Comparator;
13

    
14
import eu.etaxonomy.cdm.model.name.TaxonName;
15

    
16
public class TaxonNameComparator implements Comparator<TaxonName>, Serializable {
17

    
18
    private static final long serialVersionUID = -1007495803322700031L;
19

    
20
	@Override
21
    public int compare(TaxonName arg0, TaxonName arg1) {
22
		if (arg0.equals(arg1)){
23
			return 0;
24
		}
25

    
26
		String nameCacheOfArg0 = arg0.getTitleCache();
27
		String nameCacheOfArg1 = arg1.getTitleCache();
28

    
29
		int result = nameCacheOfArg0.compareToIgnoreCase(nameCacheOfArg1);
30
		if (result != 0){
31
			return result;
32
		}else{
33
			return arg0.getUuid().compareTo(arg1.getUuid());
34
		}
35
	}
36
}
(3-3/6)