KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > icl > saxon > sort > DescendingComparer


1 package com.icl.saxon.sort;
2 import com.icl.saxon.*;
3 import org.xml.sax.*;
4
5
6 /**
7  * A Comparer used for comparing descending keys
8  *
9  *
10  */

11
12 public class DescendingComparer extends Comparer {
13
14     private Comparer baseComparer;
15
16     public DescendingComparer(Comparer base) {
17         baseComparer = base;
18     }
19
20     /**
21     * Compare two objects.
22     * @return <0 if a<b, 0 if a=b, >0 if a>b
23     * @throws ClassCastException if the objects are of the wrong type for this Comparer
24     */

25
26     public int compare(Object JavaDoc a, Object JavaDoc b) {
27         return 0 - baseComparer.compare(a, b);
28     }
29
30 }
31
Popular Tags