diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Segment.java @ 655:913b52064449

Refactored version of "Berechnung 4" flys-artifacts/trunk@2053 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sun, 05 Jun 2011 18:24:46 +0000
parents 6695e03e9b82
children 8124ca1ecaaa
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Segment.java	Fri Jun 03 10:21:13 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Segment.java	Sun Jun 05 18:24:46 2011 +0000
@@ -9,6 +9,8 @@
 
 import gnu.trove.TDoubleArrayList;
 
+import de.intevation.flys.utils.DoubleUtil;
+
 public class Segment
 implements   Serializable
 {
@@ -17,10 +19,16 @@
     protected double    from;
     protected double    to;
     protected double [] values;
+    protected double [] backup;
+    protected double    referencePoint;
 
     public Segment() {
     }
 
+    public Segment(double referencePoint) {
+        this.referencePoint = referencePoint;
+    }
+
     public Segment(double from, double to, double [] values) {
         this.from   = from;
         this.to     = to;
@@ -43,6 +51,42 @@
         return sb.toString();
     }
 
+    public void setFrom(double from) {
+        this.from = from;
+    }
+
+    public void backup() {
+        backup = (double [])values.clone();
+    }
+
+    public double getFrom() {
+        return from;
+    }
+
+    public void setTo(double to) {
+        this.to = to;
+    }
+
+    public double getTo() {
+        return to;
+    }
+
+    public void setValues(double [] values) {
+        this.values = values;
+    }
+
+    public double [] getValues() {
+        return values;
+    }
+
+    public void setReferencePoint(double referencePoint) {
+        this.referencePoint = referencePoint;
+    }
+
+    public double getReferencePoint() {
+        return referencePoint;
+    }
+
     public static List<Segment> parseSegments(String input) {
 
         ArrayList<Segment> segments = new ArrayList<Segment>();
@@ -62,7 +106,8 @@
                 vs.clear();
 
                 for (String valueStr: parts[2].split(",")) {
-                    vs.add(Double.parseDouble(valueStr.trim()));
+                    vs.add(DoubleUtil.round(
+                        Double.parseDouble(valueStr.trim())));
                 }
 
                 double [] values = vs.toNativeArray();

http://dive4elements.wald.intevation.org