From: Egon W. <eg...@us...> - 2005-01-03 09:11:50
|
Update of /cvsroot/cdk/cdk/src/org/openscience/cdk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3650/src/org/openscience/cdk Modified Files: RingSet.java Log Message: Moved RingSet.sort() to RingSetManipulator.sort() Index: RingSet.java =================================================================== RCS file: /cvsroot/cdk/cdk/src/org/openscience/cdk/RingSet.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- RingSet.java 3 Jan 2005 08:22:10 -0000 1.20 +++ RingSet.java 3 Jan 2005 09:11:40 -0000 1.21 @@ -282,58 +282,6 @@ return false; } - /** - * Sorts the rings in the set by size. The largest ring comes - * first. - */ - public void sort() - { - Collections.sort(this, new RingSizeComparator(LARGE_FIRST)); - } - - /** - * Comparator to sort Ring sets by size. - */ - public class RingSizeComparator implements java.util.Comparator { - - int sortOrder = SMALL_FIRST; - - /** - * Constructs a new comparator to sort rings by size. - * - * @param order Sort order: either RingSet.SMALL_FIRST or - * RingSet.LARGE_FIRST. - */ - public RingSizeComparator(int order) - { - sortOrder = order; - } - - public int compare(Object object1, Object object2) throws ClassCastException - { - int size1 = ((Ring)object1).getAtomCount(); - int size2 = ((Ring)object2).getAtomCount(); - if (size1 == size2) return 0; - if (size2 > size1 && sortOrder == SMALL_FIRST) - { - return 1; - } - if (size2 > size1 && sortOrder == LARGE_FIRST) - { - return -1; - } - if (size2 < size1 && sortOrder == SMALL_FIRST) - { - return -1; - } - if (size2 < size1 && sortOrder == LARGE_FIRST) - { - return 1; - } - return 0; - } - } - /** * Clones this <code>RingSet</code> including the Rings. * |