Author: chatellier Date: 2009-10-12 15:23:46 +0000 (Mon, 12 Oct 2009) New Revision: 2656 Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/CellPointcomparator.java Log: Make comparator generic Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/CellPointcomparator.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/CellPointcomparator.java 2009-10-02 10:09:14 UTC (rev 2655) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/util/CellPointcomparator.java 2009-10-12 15:23:46 UTC (rev 2656) @@ -1,5 +1,6 @@ /* - * *##% Copyright (C) 2005 Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin + * *##% Copyright (C) 2005, 2009 + * Ifremer, Code Lutin, Cédric Pineau, Benjamin Poussin * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software @@ -16,18 +17,6 @@ * Place - Suite 330, Boston, MA 02111-1307, USA. ##% */ -/******************************************************************************* - * CellPointcomparator.java - * - * Created: 6 septembre 2005 00:57:33 CEST - * - * @author Benjamin POUSSIN <poussin at codelutin.com> - * - * @version $Revision$ - * - * Last update: $Date$ by : $Author$ - */ - package fr.ifremer.isisfish.util; import java.awt.geom.Point2D; @@ -37,11 +26,19 @@ /** * Permet de comparer la position d'une Maille avec un objet Point2D, ou deux - * Mailles, ou deux Points + * Mailles, ou deux Points. + * + * Created: 6 septembre 2005 00:57:33 CEST + * + * @author Benjamin POUSSIN <poussin at codelutin.com> + * + * @version $Revision$ + * + * Last update: $Date$ by : $Author$ */ -public class CellPointcomparator implements Comparator { // CellPointcomparator +public class CellPointcomparator implements Comparator<Cell> { // CellPointcomparator - public int compare(Object o1, Object o2) { + public int compare(Cell o1, Cell o2) { if (o1 == null && o2 == null) { return 0; } @@ -71,8 +68,8 @@ lon1 = cell.getLongitude(); } else { Point2D point = (Point2D) o1; - lat1 = (float)point.getX(); - lon1 = (float)point.getY(); + lat1 = (float) point.getX(); + lon1 = (float) point.getY(); } if (o2 instanceof Cell) { @@ -81,8 +78,8 @@ lon2 = cell.getLongitude(); } else { Point2D point = (Point2D) o2; - lat2 = (float)point.getX(); - lon2 = (float)point.getY(); + lat2 = (float) point.getX(); + lon2 = (float) point.getY(); } // o1 est superieur a o2 int result = Double.compare(lat1, lat2); @@ -94,4 +91,3 @@ } } // CellPointcomparator -