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