diff gnv-artifacts/src/main/java/de/intevation/gnv/math/L1Comparator.java @ 798:6cff63d0c434

Fixed vim modeline. Added some Javadoc. gnv-artifacts/trunk@880 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 06 Apr 2010 11:05:00 +0000
parents b1f5f2a8840f
children bb7afd783321
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/L1Comparator.java	Tue Apr 06 07:01:03 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/L1Comparator.java	Tue Apr 06 11:05:00 2010 +0000
@@ -5,7 +5,7 @@
 import java.util.Comparator;
 
 /**
- *  @author Sascha L. Teichmann
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
 public  class L1Comparator
 implements    Comparator
@@ -26,12 +26,16 @@
     public int compare(Object a, Object b) {
         Coordinate pa = (Coordinate)a;
         Coordinate pb = (Coordinate)b;
-        double da = Point2d.L1(ref, pa);
-        double db = Point2d.L1(ref, pb);
+        double da = L1(ref, pa);
+        double db = L1(ref, pb);
         if (da < db) return -1;
         if (da > db) return +1;
         return 0;
     }
+
+    public static double L1(Coordinate a, Coordinate b) {
+        return Math.abs(a.x - b.x) + Math.abs(a.y - b.y);
+    }
+
 }
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
-
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org