changeset 2860:2f874d14ac68

Use Doubles to store meassure points of profiles. flys-backend/trunk@4325 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 02 May 2012 08:49:57 +0000
parents ed13816047b3
children b0132e1b9719
files flys-backend/ChangeLog flys-backend/src/main/java/de/intevation/flys/importer/ImportCrossSectionLine.java flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java flys-backend/src/main/java/de/intevation/flys/model/CrossSectionLine.java flys-backend/src/main/java/de/intevation/flys/model/CrossSectionPoint.java flys-backend/src/main/java/de/intevation/flys/model/FastCrossSectionLine.java
diffstat 6 files changed, 34 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/ChangeLog	Fri Apr 27 15:52:08 2012 +0000
+++ b/flys-backend/ChangeLog	Wed May 02 08:49:57 2012 +0000
@@ -1,11 +1,21 @@
-2012-02-27	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+2012-05-02	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/model/FastCrossSectionLine.java,
+	  src/main/java/de/intevation/flys/model/CrossSectionPoint.java,
+	  src/main/java/de/intevation/flys/model/CrossSectionLine.java,
+	  src/main/java/de/intevation/flys/importer/ImportCrossSectionLine.java,
+	  src/main/java/de/intevation/flys/importer/ImportRiver.java:
+	  Store meassure points of profiles as Doubles not as BigDecimal.
+	  This should save a lot of memory during the import.
+
+2012-04-27	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/importer/parsers/FlowVelocityMeasurementParser.java,
 	  src/main/java/de/intevation/flys/importer/ImportWaterlevelDifferenceValue.java,
 	  src/main/java/de/intevation/flys/importer/ImportWaterlevelDifferenceColumn.java:
 	  Removed superfluous imports.
 
-2012-02-27	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+2012-04-27	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* doc/schema/postgresql-minfo.sql: Adjusted PostgreSQL port
 	  to match the Oracle schema.
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportCrossSectionLine.java	Fri Apr 27 15:52:08 2012 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportCrossSectionLine.java	Wed May 02 08:49:57 2012 +0000
@@ -7,8 +7,6 @@
 import org.hibernate.Session;
 import org.hibernate.Query;
 
-import java.math.BigDecimal;
-
 import java.util.List;
 import java.util.Comparator;
 import java.util.Map;
@@ -23,7 +21,7 @@
             }
         };
 
-    protected BigDecimal         km;
+    protected Double         km;
     protected ImportCrossSection crossSection;
     protected List<XY>           points;
 
@@ -32,7 +30,7 @@
     public ImportCrossSectionLine() {
     }
 
-    public ImportCrossSectionLine(BigDecimal km, List<XY> points) {
+    public ImportCrossSectionLine(Double km, List<XY> points) {
         this.km     = km;
         this.points = points;
     }
@@ -45,11 +43,11 @@
         this.crossSection = crossSection;
     }
 
-    public BigDecimal getKm() {
+    public Double getKm() {
         return km;
     }
 
-    public void setKm(BigDecimal km) {
+    public void setKm(Double km) {
         this.km = km;
     }
 
@@ -82,12 +80,12 @@
             if (csp == null) { // create new
                 csp = new CrossSectionPoint(
                     csl, key.getColPos(),
-                    new BigDecimal(xy.getX()),
-                    new BigDecimal(xy.getY()));
+                    Double.valueOf(xy.getX()),
+                    Double.valueOf(xy.getY()));
             }
             else { // update old
-                csp.setX(new BigDecimal(xy.getX()));
-                csp.setY(new BigDecimal(xy.getY()));
+                csp.setX(Double.valueOf(xy.getX()));
+                csp.setY(Double.valueOf(xy.getY()));
             }
             session.save(csp);
         }
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java	Fri Apr 27 15:52:08 2012 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java	Wed May 02 08:49:57 2012 +0000
@@ -854,7 +854,7 @@
                     new ArrayList<ImportCrossSectionLine>();
 
                 for (Map.Entry<Double, List<XY>> entry: parser.getData().entrySet()) {
-                    BigDecimal km     = new BigDecimal(entry.getKey());
+                    Double km         = entry.getKey();
                     List<XY>   points = entry.getValue();
                     lines.add(new ImportCrossSectionLine(km, points));
                 }
--- a/flys-backend/src/main/java/de/intevation/flys/model/CrossSectionLine.java	Fri Apr 27 15:52:08 2012 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/model/CrossSectionLine.java	Wed May 02 08:49:57 2012 +0000
@@ -2,8 +2,6 @@
 
 import java.io.Serializable;
 
-import java.math.BigDecimal;
-
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Collections;
@@ -37,7 +35,7 @@
     public static final double TOO_BIG   = 500;
 
     private Integer                 id;
-    private BigDecimal              km;
+    private Double              km;
     private CrossSection            crossSection;
 
     private List<CrossSectionPoint> points;
@@ -70,7 +68,7 @@
     public CrossSectionLine() {
     }
 
-    public CrossSectionLine(CrossSection crossSection, BigDecimal km) {
+    public CrossSectionLine(CrossSection crossSection, Double km) {
         this.crossSection = crossSection;
         this.km           = km;
     }
@@ -93,11 +91,11 @@
     }
 
     @Column(name = "km")
-    public BigDecimal getKm() {
+    public Double getKm() {
         return km;
     }
 
-    public void setKm(BigDecimal km) {
+    public void setKm(Double km) {
         this.km = km;
     }
 
--- a/flys-backend/src/main/java/de/intevation/flys/model/CrossSectionPoint.java	Fri Apr 27 15:52:08 2012 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/model/CrossSectionPoint.java	Wed May 02 08:49:57 2012 +0000
@@ -1,7 +1,5 @@
 package de.intevation.flys.model;
 
-import java.math.BigDecimal;
-
 import java.io.Serializable;
 
 import javax.persistence.Entity;
@@ -22,8 +20,8 @@
     private Integer          id;
     private CrossSectionLine crossSectionLine;
     private Integer          colPos;
-    private BigDecimal       x;
-    private BigDecimal       y;
+    private Double       x;
+    private Double       y;
 
     public CrossSectionPoint() {
     }
@@ -31,8 +29,8 @@
     public CrossSectionPoint(
         CrossSectionLine crossSectionLine,
         Integer          colPos,
-        BigDecimal       x,
-        BigDecimal       y
+        Double       x,
+        Double       y
     ) {
         this.crossSectionLine = crossSectionLine;
         this.colPos           = colPos;
@@ -77,20 +75,20 @@
     }
 
     @Column(name = "x")
-    public BigDecimal getX() {
+    public Double getX() {
         return x;
     }
 
-    public void setX(BigDecimal x) {
+    public void setX(Double x) {
         this.x = x;
     }
 
     @Column(name = "y")
-    public BigDecimal getY() {
+    public Double getY() {
         return y;
     }
 
-    public void setY(BigDecimal y) {
+    public void setY(Double y) {
         this.y = y;
     }
 }
--- a/flys-backend/src/main/java/de/intevation/flys/model/FastCrossSectionLine.java	Fri Apr 27 15:52:08 2012 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/model/FastCrossSectionLine.java	Wed May 02 08:49:57 2012 +0000
@@ -5,8 +5,6 @@
 
 import java.io.Serializable;
 
-import java.math.BigDecimal;
-
 import java.awt.geom.Point2D;
 
 public class FastCrossSectionLine
@@ -42,7 +40,7 @@
     }
 
     public FastCrossSectionLine(CrossSectionLine csl) {
-        BigDecimal kmBD = csl.getKm();
+        Double kmBD = csl.getKm();
         km = kmBD != null ? kmBD.doubleValue() : 0d;
         points = csl.fetchCrossSectionLinesPoints();
     }

http://dive4elements.wald.intevation.org