Commit | Line | Data |
---|---|---|
73005152 | 1 | /********************************************************************** |
ed902a2b | 2 | * Copyright (c) 2005, 2014 IBM Corporation, Ericsson |
73005152 BH |
3 | * All rights reserved. This program and the accompanying materials |
4 | * are made available under the terms of the Eclipse Public License v1.0 | |
5 | * which accompanies this distribution, and is available at | |
6 | * http://www.eclipse.org/legal/epl-v10.html | |
013a5f1c AM |
7 | * |
8 | * Contributors: | |
c8422608 AM |
9 | * IBM - Initial API and implementation |
10 | * Bernd Hufmann - Updated for TMF | |
73005152 | 11 | **********************************************************************/ |
c8422608 | 12 | |
2bdf0193 | 13 | package org.eclipse.tracecompass.tmf.ui.views.uml2sd.util; |
73005152 BH |
14 | |
15 | import java.io.Serializable; | |
16 | import java.util.Comparator; | |
17 | ||
2bdf0193 | 18 | import org.eclipse.tracecompass.tmf.ui.views.uml2sd.core.SDTimeEvent; |
73005152 BH |
19 | |
20 | /** | |
21 | * Time event comparator | |
013a5f1c AM |
22 | * |
23 | * @version 1.0 | |
73005152 | 24 | * @author sveyrier |
73005152 BH |
25 | */ |
26 | public class TimeEventComparator implements Comparator<SDTimeEvent>, Serializable { | |
27 | ||
df0b8ff4 BH |
28 | // ------------------------------------------------------------------------ |
29 | // Constants | |
30 | // ------------------------------------------------------------------------ | |
31 | ||
73005152 BH |
32 | /** |
33 | * Serial version UID | |
34 | */ | |
35 | private static final long serialVersionUID = 5885497718872575669L; | |
36 | ||
df0b8ff4 BH |
37 | // ------------------------------------------------------------------------ |
38 | // Methods | |
39 | // ------------------------------------------------------------------------ | |
40 | ||
73005152 BH |
41 | @Override |
42 | public int compare(SDTimeEvent arg0, SDTimeEvent arg1) { | |
abbdd66a AM |
43 | SDTimeEvent t1 = arg0; |
44 | SDTimeEvent t2 = arg1; | |
df0b8ff4 | 45 | if (t1.getEvent() > t2.getEvent()) { |
73005152 | 46 | return 1; |
df0b8ff4 BH |
47 | } |
48 | else if (t1.getEvent() == t2.getEvent()) { | |
73005152 | 49 | return 0; |
df0b8ff4 BH |
50 | } |
51 | return -1; | |
73005152 | 52 | } |
73005152 | 53 | } |