Classes in this File | Line Coverage | Branch Coverage | Complexity | |||||||
NSComparator |
|
| 1.625;1.625 |
1 | /* |
|
2 | Wotonomy: OpenStep design patterns for pure Java applications. |
|
3 | Copyright (C) 2002 Israfil consulting Services Corporation |
|
4 | ||
5 | This library is free software; you can redistribute it and/or |
|
6 | modify it under the terms of the GNU Lesser General Public |
|
7 | License as published by the Free Software Foundation; either |
|
8 | version 2.1 of the License, or (at your option) any later version. |
|
9 | ||
10 | This library is distributed in the hope that it will be useful, |
|
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 | Lesser General Public License for more details. |
|
14 | ||
15 | You should have received a copy of the GNU Lesser General Public |
|
16 | License along with this library; if not, see http://www.gnu.org |
|
17 | ||
18 | $Id: NSComparator.java 913 2006-03-10 00:52:27 +0000 (Fri, 10 Mar 2006) cgruber $ |
|
19 | ||
20 | */ |
|
21 | ||
22 | package net.wotonomy.foundation; |
|
23 | ||
24 | import java.util.Comparator; |
|
25 | ||
26 | ||
27 | /** |
|
28 | * An object that compares two other objects. As a convenience, it |
|
29 | * also implements java.util.Comparator. |
|
30 | * |
|
31 | * @author cgruber@israfil.net |
|
32 | * @author $Author: cgruber $ |
|
33 | * @version $Revision: 913 $ |
|
34 | */ |
|
35 | ||
36 | 0 | public abstract class NSComparator implements Comparator { |
37 | protected static class _NSSelectorComparator extends NSComparator { |
|
38 | ||
39 | public int compare(Object obj, Object obj1) throws ComparisonException { |
|
40 | 0 | throw new UnsupportedOperationException("Not Yet Implemented"); |
41 | } |
|
42 | ||
43 | 0 | public _NSSelectorComparator(NSSelector nsselector) { |
44 | 0 | throw new UnsupportedOperationException("Not Yet Implemented"); |
45 | } |
|
46 | } |
|
47 | ||
48 | private static class StandInComparator extends NSComparator { |
|
49 | ||
50 | 0 | public StandInComparator() { |
51 | 0 | throw new UnsupportedOperationException("Not Yet Implemented"); |
52 | } |
|
53 | ||
54 | public int compare(Object obj, Object obj1) throws ComparisonException { |
|
55 | 0 | throw new UnsupportedOperationException("Not Yet Implemented"); |
56 | } |
|
57 | ||
58 | } |
|
59 | ||
60 | public static class ComparisonException extends ClassCastException { |
|
61 | ||
62 | public ComparisonException(String s) { |
|
63 | 0 | super(s); |
64 | 0 | } |
65 | } |
|
66 | ||
67 | ||
68 | 0 | public static final NSComparator AscendingStringComparator = new StandInComparator(); |
69 | 0 | public static final NSComparator DescendingStringComparator = new StandInComparator(); |
70 | 0 | public static final NSComparator AscendingCaseInsensitiveStringComparator = new StandInComparator(); |
71 | 0 | public static final NSComparator DescendingCaseInsensitiveStringComparator = new StandInComparator(); |
72 | 0 | public static final NSComparator AscendingNumberComparator = new StandInComparator(); |
73 | 0 | public static final NSComparator DescendingNumberComparator = new StandInComparator(); |
74 | 0 | public static final NSComparator AscendingTimestampComparator = new StandInComparator(); |
75 | 0 | public static final NSComparator DescendingTimestampComparator = new StandInComparator(); |
76 | public static final int OrderedAscending = -1; |
|
77 | public static final int OrderedSame = 0; |
|
78 | public static final int OrderedDescending = 1; |
|
79 | ||
80 | 0 | public NSComparator() { |
81 | 0 | } |
82 | ||
83 | public abstract int compare(Object obj, Object obj1) throws ClassCastException; |
|
84 | ||
85 | public static int _compareObjects(Comparable comparable, Comparable comparable1) { |
|
86 | 0 | throw new UnsupportedOperationException("Not Yet Implemented"); |
87 | } |
|
88 | ||
89 | } |
|
90 | /* |
|
91 | * $Log$ |
|
92 | * Revision 1.2 2006/03/10 00:52:27 cgruber |
|
93 | * Add tests for NSArray and fix some problems that became obvious as a result. |
|
94 | * |
|
95 | * Revision 1.1 2006/02/16 12:47:16 cgruber |
|
96 | * Check in all sources in eclipse-friendly maven-enabled packages. |
|
97 | * |
|
98 | * Revision 1.1 2002/07/14 21:56:16 mpowers |
|
99 | * Contributions from cgruber. |
|
100 | * |
|
101 | * Revision 1.1 2002/06/25 07:52:56 cgruber |
|
102 | * Add quite a few abstract classes, interfaces, and classes. All API consistent with WebObjects, but with no implementation, nor any private or package access members from the original. |
|
103 | * |
|
104 | */ |