[PATCH 2 of 3] (issue1448) Unify SedimentLoadData ctor again

Wald Commits scm-commit at wald.intevation.org
Mon Sep 8 19:01:32 CEST 2014


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1410195630 -7200
# Node ID 25c3a62863d267b781f72e3d13e4e6f5effa62ba
# Parent  90727aa9913d9181f0e5f58d2883c7b9e723997a
(issue1448) Unify SedimentLoadData ctor again

diff -r 90727aa9913d -r 25c3a62863d2 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadData.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadData.java	Mon Sep 08 18:59:10 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadData.java	Mon Sep 08 19:00:30 2014 +0200
@@ -123,7 +123,7 @@
 
         private int id;
         private int kind;
-        private int sqRelId;
+        private int sqTiId;
 
         private String description;
 
@@ -136,31 +136,14 @@
         }
 
         public Load(
-            int    id,
-            int    kind,
-            String description,
-            Date   startTime,
-            Date   stopTime
-        ) {
-            this.id          = id;
-            this.kind        = kind;
-            this.description = description;
-            this.startTime   = startTime;
-            this.stopTime    = stopTime;
-            this.sqStartTime = null;
-            this.sqStopTime  = null;
-            this.sqRelId     = 0;
-        }
-
-        public Load(
-            int    id,
-            int    kind,
-            String description,
-            Date   startTime,
-            Date   stopTime,
-            int    sqRelId,
-            Date   sqStartTime,
-            Date   sqStopTime
+            int     id,
+            int     kind,
+            String  description,
+            Date    startTime,
+            Date    stopTime,
+            Integer sqTiId,
+            Date    sqStartTime,
+            Date    sqStopTime
         ) {
             this.id          = id;
             this.kind        = kind;
@@ -169,7 +152,7 @@
             this.stopTime    = stopTime;
             this.sqStartTime = sqStartTime;
             this.sqStopTime  = sqStopTime;
-            this.sqRelId     = sqRelId;
+            this.sqTiId      = sqTiId == null ? 0 : sqTiId;
         }
 
         public int getId() {
@@ -177,7 +160,7 @@
         }
 
         public int getSQRelationTimeIntervalId() {
-            return sqRelId;
+            return sqTiId;
         }
 
         public int getKind() {
diff -r 90727aa9913d -r 25c3a62863d2 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataFactory.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataFactory.java	Mon Sep 08 18:59:10 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataFactory.java	Mon Sep 08 19:00:30 2014 +0200
@@ -173,17 +173,10 @@
             String    ms_type          = (String)row[12];
 
             if (load == null || load.getId() != sl_id) {
-                if (sq_id == null) {
-                    /* Avoid NPE when converting the objects. */
-                    load = new SedimentLoadData.Load(
-                        sl_id, sl_kind, sl_description,
-                        ti_start_time, ti_stop_time);
-                } else {
-                    load = new SedimentLoadData.Load(
-                        sl_id, sl_kind, sl_description,
-                        ti_start_time, ti_stop_time, sq_id,
-                        sq_start_time, sq_stop_time);
-                }
+                load = new SedimentLoadData.Load(
+                    sl_id, sl_kind, sl_description,
+                    ti_start_time, ti_stop_time, sq_id,
+                    sq_start_time, sq_stop_time);
 
                 // Grain fractions only change when a new sediment load starts.
                 grainFractionIndex =


More information about the Dive4Elements-commits mailing list