diff gnv-artifacts/src/main/java/de/intevation/gnv/math/XYColumn.java @ 429:bed9735adf84

Finished preprocessing data for interpolation in verticalcrosssection charts.ß gnv-artifacts/trunk@477 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 22 Dec 2009 17:19:10 +0000
parents a95aaeb206f7
children 422275fc9927
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/XYColumn.java	Tue Dec 22 13:18:07 2009 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/XYColumn.java	Tue Dec 22 17:19:10 2009 +0000
@@ -1,12 +1,15 @@
 package de.intevation.gnv.math;
 
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
 
 /**
  * @author Ingo Weinzierl <ingo.weinzierl@intevation.de>
  */
-public class XYColumn {
+public class XYColumn
+implements   Serializable
+{
 
     private double x;
     private double y;
@@ -21,12 +24,13 @@
         this.y = y;
         this.i = i;
         this.j = j;
-
-        values = new ArrayList();
     }
 
 
     public void add(HeightValue value) {
+        if (values == null) {
+            values = new ArrayList();
+        }
         values.add(value);
     }
 
@@ -34,4 +38,16 @@
     public HeightValue[] getValues() {
         return (HeightValue[]) values.toArray(new HeightValue[values.size()]);
     }
+
+
+    public int hashCode() {
+        return (i << 16) | j;
+    }
+
+
+    public boolean equals(Object obj) {
+        XYColumn other = (XYColumn) obj;
+
+        return i == other.i && j == other.j && x == other.x && y == other.y;
+    }
 }

http://dive4elements.wald.intevation.org