1 package net.sf.saxon.sort; 2 import net.sf.saxon.om.Item; 3 import net.sf.saxon.trans.XPathException; 4 5 import java.util.Comparator ; 6 7 15 16 public class TextComparer implements Comparator , java.io.Serializable { 17 18 private Comparator collator; 19 20 public TextComparer(Comparator collator) { 21 this.collator = collator; 22 } 23 24 32 33 public int compare(Object a, Object b) throws ClassCastException { 34 35 String s1, s2; 36 37 s1 = (a instanceof String ? (String )a : ((Item)a).getStringValue()); 39 43 s2 = (b instanceof String ? (String )b : ((Item)b).getStringValue()); 45 49 int x = collator.compare(s1, s2); 50 return x; 52 53 } 54 55 } 56 57 | Popular Tags |