Contribution for Bug352466: [TMF] Implement UML2 Sequence Diagram
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / uml2sd / util / TimeEventComparator.java
CommitLineData
73005152
BH
1/**********************************************************************
2 * Copyright (c) 2005, 2006, 2011 IBM Corporation and others.
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
7 * $Id: TimeEventComparator.java,v 1.2 2006/09/20 20:56:27 ewchan Exp $
8 *
9 * Contributors:
10 * IBM - Initial API and implementation
11 * Bernd Hufmann - Updated for TMF
12 **********************************************************************/
13package org.eclipse.linuxtools.tmf.ui.views.uml2sd.util;
14
15import java.io.Serializable;
16import java.util.Comparator;
17
18import org.eclipse.linuxtools.tmf.ui.views.uml2sd.core.SDTimeEvent;
19
20/**
21 * Time event comparator
22 *
23 * @author sveyrier
24 *
25 */
26public class TimeEventComparator implements Comparator<SDTimeEvent>, Serializable {
27
28 /**
29 * Serial version UID
30 */
31 private static final long serialVersionUID = 5885497718872575669L;
32
33 /**
34 * Compares two time events.
35 *
36 * @return 1 if arg0 is greater, 0 if equal, -1 otherwise
37 */
38 @Override
39 public int compare(SDTimeEvent arg0, SDTimeEvent arg1) {
40 SDTimeEvent t1 = (SDTimeEvent) arg0;
41 SDTimeEvent t2 = (SDTimeEvent) arg1;
42 if (t1.getEvent() > t2.getEvent())
43 return 1;
44 else if (t1.getEvent() == t2.getEvent())
45 return 0;
46 else
47 return -1;
48 }
49
50}
This page took 0.024785 seconds and 5 git commands to generate.