[Jreepad-CVS] jreepad/src/jreepad JreepadNode.java,1.23,1.24
Brought to you by:
danstowell
From: PeWu <pe...@us...> - 2007-01-22 23:31:07
|
Update of /cvsroot/jreepad/jreepad/src/jreepad In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv3689/src/jreepad Modified Files: JreepadNode.java Log Message: Comparator class is not needed. Comparable.compareTo() is sufficient Index: JreepadNode.java =================================================================== RCS file: /cvsroot/jreepad/jreepad/src/jreepad/JreepadNode.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** JreepadNode.java 22 Jan 2007 23:00:37 -0000 1.23 --- JreepadNode.java 22 Jan 2007 23:31:03 -0000 1.24 *************** *** 23,30 **** import java.io.IOException; import java.io.InputStreamReader; - import java.io.Serializable; import java.text.CharacterIterator; import java.text.StringCharacterIterator; - import java.util.Comparator; import java.util.Enumeration; --- 23,28 ---- *************** *** 41,45 **** private String content; private JreepadNode softLinkTarget; - private static OurSortComparator ourSortComparator = new OurSortComparator(); //protected transient javax.swing.table.TableColumnModel tblColModel; --- 39,42 ---- *************** *** 496,529 **** { Object[] childrenArray = children.toArray(); ! java.util.Arrays.sort(childrenArray, ourSortComparator); removeAllChildren(); for(int i=0; i<childrenArray.length; i++) add((JreepadNode)childrenArray[i]); } ! private static class OurSortComparator implements Comparator, Serializable ! { ! public int compare(Object o1, Object o2) ! { ! // return ((JreepadNode)o1).getTitle().compareToIgnoreCase( ! // ((JreepadNode)o2).getTitle()); ! return ((JreepadNode)o1).compareTo(o2); ! } ! /* ! public boolean equals(Object obj) ! { ! return obj.equals(this); // Lazy! ! } ! public int hashCode() // Apparently this is required by the contract of Object.hashCode() ! { ! return this.hashCode(); ! } ! */ ! } ! /* ! public int OLDSIMPLEcompareTo(Object o) ! { ! return getTitle().compareToIgnoreCase( ! ((JreepadNode)o).getTitle()); ! }*/ // The following function is a halfway-house on the way to "natural numerical ordering" public int compareTo(Object o) --- 493,502 ---- { Object[] childrenArray = children.toArray(); ! java.util.Arrays.sort(childrenArray); removeAllChildren(); for(int i=0; i<childrenArray.length; i++) add((JreepadNode)childrenArray[i]); } ! // The following function is a halfway-house on the way to "natural numerical ordering" public int compareTo(Object o) |