1 package org.andromda.utils.beans.comparators;
2
3 import java.io.Serializable;
4 import java.util.Comparator;
5 import java.util.Date;
6
7
8
9
10
11
12 class DateComparator
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 final Object objectA,
27 final Object objectB)
28 {
29 final Date aAsDate = (Date)objectA;
30 final Date bAsDate = (Date)objectB;
31 int result = 0;
32
33 if (bAsDate.after(aAsDate))
34 {
35
36
37 result = -1;
38 }
39 else if (aAsDate.after(bAsDate))
40 {
41
42
43 result = 1;
44 }
45 return result;
46 }
47 }