Mercurial > dive4elements > river
changeset 8237:25c3a62863d2
(issue1448) Unify SedimentLoadData ctor again
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 08 Sep 2014 19:00:30 +0200 |
parents | 90727aa9913d |
children | be3c11bef6e8 |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadData.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataFactory.java |
diffstat | 2 files changed, 15 insertions(+), 39 deletions(-) [+] |
line wrap: on
line diff
--- 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() {
--- 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 =