comparison servlet/src/digilib/io/DocuDirent.java @ 475:1fc30116efc3

modified DocuDirent.compareTo instead of ImageFileset.compareTo
author hertzhaft
date Wed, 12 Apr 2006 14:12:37 +0200
parents 2188086cd143
children e758a49258e8
comparison
equal deleted inserted replaced
474:fb51443ca0ee 475:1fc30116efc3
148 public static int getFileClass() { 148 public static int getFileClass() {
149 return fileClass; 149 return fileClass;
150 } 150 }
151 151
152 /** Comparator using the file name. 152 /** Comparator using the file name.
153 * Compares to a String (for binarySearch)
154 * or to another DocuDirent (for sort)
153 * 155 *
154 * @see java.lang.Comparable#compareTo(java.lang.Object) 156 * @see java.lang.Comparable#compareTo(java.lang.Object)
155 */ 157 */
156 public int compareTo(Object arg0) { 158 public int compareTo(Object arg0) {
157 return (getName().compareTo((String) arg0)); 159 return (arg0 instanceof DocuDirent)
160 ? getName().compareTo(((DocuDirent) arg0).getName())
161 : getName().compareTo((String) arg0);
158 } 162 }
163
159 164
160 } 165 }