|
|||||||||||||||||||
This license of Clover is provided to support the development of JBind only. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover. | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
RefComparator.java | 75% | 100% | 100% | 92,9% |
|
1 |
/* |
|
2 |
* JBind |
|
3 |
* |
|
4 |
* Copyright (c) by Stefan Wachter. All rights reserved. |
|
5 |
* |
|
6 |
* Usage, modification, and redistribution is subject to license terms that are |
|
7 |
* available at 'http://www.jbind.org'. The JBind license is like the |
|
8 |
* 'Apache Software License V 1.1'. |
|
9 |
*/ |
|
10 |
package org.jbind.xml.base; |
|
11 |
|
|
12 |
import java.util.Comparator; |
|
13 |
|
|
14 |
public class RefComparator implements Comparator { |
|
15 |
|
|
16 |
public static final RefComparator INSTANCE = new RefComparator(); |
|
17 |
|
|
18 | 3 |
private RefComparator() {} |
19 |
|
|
20 | 30587 |
public int compare(Object anObj1, Object anObj2) { |
21 | 30587 |
IRef ref1 = (IRef)anObj1; |
22 | 30587 |
IRef ref2 = (IRef)anObj2; |
23 | 30587 |
int res = ref1.getLocalPart().compareTo(ref2.getLocalPart()); |
24 | 30587 |
if (0 == res) { |
25 | 5204 |
res = ref1.getSymbolSpace().getString().compareTo(ref2.getSymbolSpace().getString()); |
26 | 5204 |
if (0 == res) { |
27 | 5204 |
res = ref1.getNamespace().compareTo(ref2.getNamespace()); |
28 |
} |
|
29 |
} |
|
30 |
|
|
31 | 30587 |
return res; |
32 |
} |
|
33 |
} |
|
34 |
|
|