Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
CorrelationSequenceComparator |
|
| 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.routing.correlation; | |
8 | ||
9 | import org.mule.api.MuleEvent; | |
10 | ||
11 | import java.util.Comparator; | |
12 | ||
13 | /** | |
14 | * <code>CorrelationSequenceComparator</code> is a {@link Comparator} for | |
15 | * {@link MuleEvent}s using their respective correlation sequences. | |
16 | */ | |
17 | 0 | public final class CorrelationSequenceComparator implements Comparator<MuleEvent> |
18 | { | |
19 | public int compare(MuleEvent event1, MuleEvent event2) | |
20 | { | |
21 | 0 | int val1 = event1.getMessage().getCorrelationSequence(); |
22 | 0 | int val2 = event2.getMessage().getCorrelationSequence(); |
23 | ||
24 | 0 | if (val1 == val2) |
25 | { | |
26 | 0 | return 0; |
27 | } | |
28 | 0 | else if (val1 > val2) |
29 | { | |
30 | 0 | return 1; |
31 | } | |
32 | else | |
33 | { | |
34 | 0 | return -1; |
35 | } | |
36 | } | |
37 | } |