01: package org.zkforge.timeline.util;
02:
03: import java.util.Comparator;
04:
05: import org.zkforge.timeline.data.OccurEvent;
06:
07: public class OccurEventComparator implements Comparator {
08:
09: public int compare(Object o1, Object o2) {
10: // TODO Auto-generated method stub
11: OccurEvent evt1 = (OccurEvent) o1;
12: OccurEvent evt2 = (OccurEvent) o2;
13: if (evt1 == null && evt2 != null)
14: return -1;
15: else if (evt1 == null && evt2 != null)
16: return 1;
17: else if (evt1 == null && evt2 == null)
18: return 0;
19:
20: if (evt1.getStart().compareTo(evt2.getStart()) <= 0)
21: return 0;
22: else if (evt1.getEnd().compareTo(evt2.getEnd()) <= 0)
23: return 0;
24: return 1;
25: }
26:
27: }
|