1 22 23 package org.xquark.mediator.DOMUtils; 24 25 import java.util.ArrayList ; 26 27 import org.xquark.xquery.parser.util.Constants; 28 29 public class TupleKey extends ArrayList implements Comparable { 30 private static final String RCSRevision = "$Revision: 1.3 $"; 34 private static final String RCSName = "$Name: $"; 35 36 private int order = Constants.ASCENDING_ORDER; 37 38 TupleKey(int size, int order) { 39 super(size); 40 this.order = order; 41 } 42 43 public int compareTo(Object obj) { 44 int retVal = 0; 45 int i = 0; 46 while (i < size() && retVal == 0) { 47 if (get(i) == null) { 48 if (((TupleKey) obj).get(i) == null) 49 retVal = 0; 50 else 51 retVal = 1; 52 } else 53 retVal = DOMUtils.compareObjects((Comparable )get(i),(Comparable )((TupleKey) obj).get(i)); 54 i++; 55 } 56 if (i == size() && order == Constants.DESCENDING_ORDER) 57 retVal = -retVal; 58 return retVal; 59 } 60 61 } 62 | Popular Tags |