/*
 * The baseCode project
 * 
 * Copyright (c) 2006 University of British Columbia
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
package ubic.basecode.dataStructure;

import java.text.NumberFormat;

/**
 * @author Paul Pavlidis
 * @version $Id$
 */
public class Link extends Point {

    private double weight;

    /**
     * @param i int
     * @param j int
     * @param weight double
     */
    public Link( int i, int j, double weight ) {
        super( i, j );
        this.weight = weight;
    }

    /**
     * @return double
     */
    public double getWeight() {
        return weight;
    }

    /**
     * @return java.lang.String
     */
    public String toString() {
        return super.toString() + "\t" + NumberFormat.getInstance().format( this.weight );
    }

}
@@ -719,16 +719,179 @@
 t;%0A%0A/**%0A
+ * Implements comparable, which sorts by the 'x' coordinate and then secondarily by the 'y' coordinate. (This behavior%0A * is important for some applications).%0A * %0A
  * @auth
@@ -960,16 +960,38 @@
 s Point 
+implements Comparable 
 %7B%0A%0A    p
@@ -1483,9 +1483,432 @@
 %0A    %7D%0A%0A
+    public int compareTo( Object arg ) %7B%0A        Link a = ( Link ) arg;%0A%0A        if ( a.getx() %3C this.getx() ) %7B%0A            return -1;%0A        %7D else if ( a.getx() %3E this.getx() ) %7B%0A            return 1;%0A        %7D else %7B%0A            if ( a.gety() %3C this.gety() ) %7B%0A                return -1;%0A            %7D else if ( a.gety() %3E this.gety() ) %7B%0A                return 1;%0A            %7D%0A            return 0;%0A        %7D%0A    %7D%0A%0A
 %7D

fix link sorting bug, part 3