1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.taxeditor.bulkeditor.input.sortprovider;
|
11
|
|
12
|
import java.util.Comparator;
|
13
|
|
14
|
import org.joda.time.DateTime;
|
15
|
|
16
|
import eu.etaxonomy.cdm.model.common.ICdmBase;
|
17
|
|
18
|
/**
|
19
|
* @author n.hoffmann
|
20
|
* @created Dec 14, 2010
|
21
|
* @version 1.0
|
22
|
*/
|
23
|
public abstract class AbstractDateComparator<T extends ICdmBase> implements Comparator<T>{
|
24
|
|
25
|
@Override
|
26
|
public int compare(T o1, T o2) {
|
27
|
if (o1.equals(o2)){
|
28
|
return 0;
|
29
|
}
|
30
|
|
31
|
return getDate(o1).compareTo(getDate(o2));
|
32
|
};
|
33
|
|
34
|
protected abstract DateTime getDate(T object);
|
35
|
}
|