[Dive4elements-commits] [PATCH] Bed height: Removed braindead index determination code

Wald Commits scm-commit at wald.intevation.org
Sun Jun 2 02:43:09 CEST 2013


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1370133780 -7200
# Node ID 3c8147ba35a651f430c581b9e596ef6fe778ecf0
# Parent  b12ec9f240bc0ffcc0a9cdcdb8ae8e665867d5e0
Bed height: Removed braindead index determination code.

diff -r b12ec9f240bc -r 3c8147ba35a6 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeight.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeight.java	Sat Jun 01 20:08:21 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeight.java	Sun Jun 02 02:43:00 2013 +0200
@@ -78,10 +78,8 @@
     }
 
     public double getHeight(double station) {
-        if (this.station.indexOf(station) >= 0) {
-            return this.heights.get(this.station.indexOf(station));
-        }
-        return Double.NaN;
+        int index = this.station.indexOf(station);
+        return index >= 0 ? heights.getQuick(index) : Double.NaN;
     }
 
 
diff -r b12ec9f240bc -r 3c8147ba35a6 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightSingle.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightSingle.java	Sat Jun 01 20:08:21 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedHeightSingle.java	Sun Jun 02 02:43:00 2013 +0200
@@ -51,25 +51,21 @@
     }
 
     public double getMorphWidth(int idx) {
-        return this.morphWidth.get(idx);
+        return this.morphWidth.getQuick(idx);
     }
 
     public double getDataGap(int idx) {
-        return this.data_gap.get(idx);
+        return this.data_gap.getQuick(idx);
     }
 
     public double getMorphWidth(double station) {
-        if (this.station.indexOf(station) >= 0) {
-            return this.morphWidth.get(this.station.indexOf(station));
-        }
-        return Double.NaN;
+        int index = this.station.indexOf(station);
+        return index >= 0 ? morphWidth.getQuick(index): Double.NaN;
     }
 
     public double getDataGap(double station) {
-        if (this.station.indexOf(station) >= 0) {
-            return this.getDataGap(this.station.indexOf(station));
-        }
-        return Double.NaN;
+        int index = this.station.indexOf(station);
+        return index >= 0 ? data_gap.getQuick(index) : Double.NaN;
     }
 
     public double[] getMorphWidths() {


More information about the Dive4elements-commits mailing list