diff artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/BedHeightsFinder.java @ 9480:7228bd10a8cc

Fixed bundu bzws bedheightfinder todos, added types for excavation volume and costs total
author mschaefer
date Mon, 10 Sep 2018 17:06:23 +0200
parents ecadc9ed0ba0
children b9c87bbff6a4
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/BedHeightsFinder.java	Mon Sep 10 15:31:55 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/BedHeightsFinder.java	Mon Sep 10 17:06:23 2018 +0200
@@ -42,6 +42,8 @@
 
     private Calculation problems;
 
+    private final boolean isNull;
+
     /**
      * Create bed height finders from a collection of bed heights.
      */
@@ -112,6 +114,14 @@
     }
 
     /**
+     * Creates a {@link BedHeightsFinder} that returns always NaN heights
+     */
+    public static BedHeightsFinder NullFinder() {
+        final NavigableMap<Double, BedHeightValue> values = new TreeMap<>();
+        return new BedHeightsFinder(null, null, values, true);
+    }
+
+    /**
      * Create a finder for a given bed height.
      *
      */
@@ -132,13 +142,23 @@
 
         final BedHeightInfo info = BedHeightInfo.from(bedHeight);
 
-        return new BedHeightsFinder(problems, info, values);
+        return new BedHeightsFinder(problems, info, values, false);
     }
 
-    private BedHeightsFinder(final Calculation problems, final BedHeightInfo info, final NavigableMap<Double, BedHeightValue> values) {
+    private BedHeightsFinder(final Calculation problems, final BedHeightInfo info, final NavigableMap<Double, BedHeightValue> values, final boolean isNull) {
         this.info = info;
         this.values = values;
         this.problems = problems;
+        this.isNull = isNull;
+    }
+
+    /**
+     * Whether this is a null (always NaN) finder.
+     * 
+     * @return
+     */
+    public boolean isNull() {
+        return this.isNull;
     }
 
     public boolean isEmpty() {

http://dive4elements.wald.intevation.org