5570 |
16 Feb 11 |
nicklas |
1 |
/** |
5570 |
16 Feb 11 |
nicklas |
$Id$ |
5570 |
16 Feb 11 |
nicklas |
3 |
|
5570 |
16 Feb 11 |
nicklas |
Copyright (C) 2011 Nicklas Nordborg |
5570 |
16 Feb 11 |
nicklas |
5 |
|
5570 |
16 Feb 11 |
nicklas |
This file is part of BASE - BioArray Software Environment. |
5570 |
16 Feb 11 |
nicklas |
Available at http://base.thep.lu.se/ |
5570 |
16 Feb 11 |
nicklas |
8 |
|
5570 |
16 Feb 11 |
nicklas |
BASE is free software; you can redistribute it and/or |
5570 |
16 Feb 11 |
nicklas |
modify it under the terms of the GNU General Public License |
5570 |
16 Feb 11 |
nicklas |
as published by the Free Software Foundation; either version 3 |
5570 |
16 Feb 11 |
nicklas |
of the License, or (at your option) any later version. |
5570 |
16 Feb 11 |
nicklas |
13 |
|
5570 |
16 Feb 11 |
nicklas |
BASE is distributed in the hope that it will be useful, |
5570 |
16 Feb 11 |
nicklas |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
5570 |
16 Feb 11 |
nicklas |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5570 |
16 Feb 11 |
nicklas |
GNU General Public License for more details. |
5570 |
16 Feb 11 |
nicklas |
18 |
|
5570 |
16 Feb 11 |
nicklas |
You should have received a copy of the GNU General Public License |
5570 |
16 Feb 11 |
nicklas |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
5570 |
16 Feb 11 |
nicklas |
21 |
*/ |
5570 |
16 Feb 11 |
nicklas |
22 |
package net.sf.basedb.util; |
5570 |
16 Feb 11 |
nicklas |
23 |
|
5570 |
16 Feb 11 |
nicklas |
24 |
import java.util.Comparator; |
5570 |
16 Feb 11 |
nicklas |
25 |
|
5570 |
16 Feb 11 |
nicklas |
26 |
/** |
5570 |
16 Feb 11 |
nicklas |
27 |
|
5570 |
16 Feb 11 |
nicklas |
A comparator implemenation for any Comparable objects. |
5570 |
16 Feb 11 |
nicklas |
29 |
|
5570 |
16 Feb 11 |
nicklas |
@author Nicklas |
5570 |
16 Feb 11 |
nicklas |
@since 2.17 |
5570 |
16 Feb 11 |
nicklas |
@base.modified $Date$ |
5570 |
16 Feb 11 |
nicklas |
33 |
*/ |
5570 |
16 Feb 11 |
nicklas |
34 |
public class ComparableComparator<T extends Comparable<T>> |
5570 |
16 Feb 11 |
nicklas |
35 |
implements Comparator<T> |
5570 |
16 Feb 11 |
nicklas |
36 |
{ |
5570 |
16 Feb 11 |
nicklas |
37 |
|
5570 |
16 Feb 11 |
nicklas |
38 |
public ComparableComparator() |
5570 |
16 Feb 11 |
nicklas |
39 |
{} |
5570 |
16 Feb 11 |
nicklas |
40 |
|
5570 |
16 Feb 11 |
nicklas |
41 |
/* |
5570 |
16 Feb 11 |
nicklas |
From the Comparator interface |
5570 |
16 Feb 11 |
nicklas |
43 |
----------------------------- |
5570 |
16 Feb 11 |
nicklas |
44 |
*/ |
5570 |
16 Feb 11 |
nicklas |
45 |
@Override |
5570 |
16 Feb 11 |
nicklas |
46 |
public int compare(T o1, T o2) |
5570 |
16 Feb 11 |
nicklas |
47 |
{ |
5570 |
16 Feb 11 |
nicklas |
48 |
return o1.compareTo(o2); |
5570 |
16 Feb 11 |
nicklas |
49 |
} |
5570 |
16 Feb 11 |
nicklas |
50 |
// ----------------------------- |
5570 |
16 Feb 11 |
nicklas |
51 |
} |