src/main/java/Kata.java
/**
     * Less than or equal to 5, so do the last bit slowly!
     *
     * @return last pair (closest)
     */
Less than or equal to 5, so do the last bit slowly.
@return last pair (closest)
Less than or equal to 5 so do the last bit slowly . @return last pair ( closest )
private Kata slowly() {
        if (points.size() <= 2) 
            return this;
        Point[] all = points.toArray(new Point[0]);
        double shortest = Double.MAX_VALUE;
        Kata closest = null;
        for (int i = 0; i < all.length; i++) {
            double x = all[i].x;
            double y = all[i].y;
            for (int j = i + 1; j < all.length; j++) {
                double nx = all[j].x;
                double ny = all[j].y;
                double distance = (x - nx)*(x - nx) + (y - ny) * (y - ny);
                if (shortest > distance){
                    shortest = distance;
                    closest = new Kata();
                    closest.addPoint(all[i], x, y);
                    closest.addPoint(all[j], nx, ny);
                }
            }
        }
        return closest;
    }
private Kata slowly ( ) { if ( points . size ( ) <= 2 ) return this ; Point [ ] all = points . toArray ( new Point [ 0 ] ) ; double shortest = Double . MAX_VALUE ; Kata closest = null ; for ( int i = 0 ; i < all . length ; i ++ ) { double x = all [ i ] . x ; double y = all [ i ] . y ; for ( int j = i + 1 ; j < all . length ; j ++ ) { double nx = all [ j ] . x ; double ny = all [ j ] . y ; double distance = ( x - nx ) * ( x - nx ) + ( y - ny ) * ( y - ny ) ; if ( shortest > distance ) { shortest = distance ; closest = new Kata ( ) ; closest . addPoint ( all [ i ] , x , y ) ; closest . addPoint ( all [ j ] , nx , ny ) ; } } } return closest ; }
Less than or equal to 5, so do the last bit slowly!
Less than or equal to 5 so do the last bit slowly!
// System.err.println("Slowly " + points.size()); // got there