Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
PreferredComparator |
|
| 0.0;0 |
1 | /* | |
2 | * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com | |
3 | * The software in this package is published under the terms of the CPAL v1.0 | |
4 | * license, a copy of which has been included with this distribution in the | |
5 | * LICENSE.txt file. | |
6 | */ | |
7 | package org.mule.config; | |
8 | ||
9 | import java.util.Comparator; | |
10 | ||
11 | 0 | public class PreferredComparator implements Comparator<Preferred> |
12 | { | |
13 | ||
14 | public int compare(Preferred preferred1, Preferred preferred2) | |
15 | { | |
16 | 0 | if (preferred1 == null && preferred2 == null) |
17 | { | |
18 | 0 | return 0; |
19 | } | |
20 | ||
21 | 0 | if (preferred1 != null && preferred2 == null) |
22 | { | |
23 | 0 | return 1; |
24 | } | |
25 | ||
26 | 0 | if (preferred1 == null) |
27 | { | |
28 | 0 | return -1; |
29 | } | |
30 | ||
31 | 0 | return new Integer(preferred1.weight()).compareTo(preferred2.weight()); |
32 | } | |
33 | } |