1 package org.andromda.utils.beans.comparators;
2
3 import java.io.Serializable;
4 import java.util.Calendar;
5 import java.util.Comparator;
6
7
8
9
10
11
12 class CalendarComparator
13 implements Comparator,
14 Serializable
15 {
16 private static final long serialVersionUID = 34L;
17
18
19
20
21
22
23
24
25 public int compare(
26 Object objectA,
27 Object objectB)
28 {
29 Calendar aAsCalendar = (Calendar)objectA;
30 Calendar bAsCalendar = (Calendar)objectB;
31 int result = 0;
32
33 if (bAsCalendar.after(aAsCalendar))
34 {
35
36
37 result = -1;
38 }
39 else if (aAsCalendar.after(bAsCalendar))
40 {
41
42
43 result = 1;
44 }
45 return result;
46 }
47 }