diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/MorphologicWidth.java @ 5764:7ac111db8a07

Model, factory, facet and static artifact for morphologic width.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 18 Apr 2013 14:14:15 +0200
parents
children 4a1bd43e7aa6
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/MorphologicWidth.java	Thu Apr 18 14:14:15 2013 +0200
@@ -0,0 +1,50 @@
+package de.intevation.flys.artifacts.model.minfo;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import de.intevation.flys.jfree.DoubleBounds;
+
+
+public class MorphologicWidth
+{
+
+    private Map<Double, Double> pairs;
+
+
+    public MorphologicWidth() {
+        pairs = new HashMap<Double, Double>();
+    }
+
+    public void add(double station, double width) {
+        this.pairs.put(station, width);
+    }
+
+    public Map<Double, Double> getAll() {
+        return this.pairs;
+    }
+
+    public double[][] getAsArray() {
+        double [][] array = new double[2][pairs.size()];
+        Double[] kms = pairs.keySet().toArray(new Double[pairs.size()]);
+        Double[] width = pairs.values().toArray(new Double[pairs.size()]);
+        int realIndex = 0;
+        for (int i = 0; i < kms.length; i++) {
+            if (kms[i] == null || width[i] == null) {
+                continue;
+            }
+            array[0][realIndex] = kms[i];
+            array[1][realIndex] = width[i];
+            realIndex++;
+        }
+        return array;
+    }
+
+
+    public Double getWidth(double station) {
+        if (this.pairs.containsKey(station)) {
+            return this.pairs.get(station);
+        }
+        return null;
+    }
+}

http://dive4elements.wald.intevation.org