comparison 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
comparison
equal deleted inserted replaced
9479:2b83d3a96703 9480:7228bd10a8cc
40 40
41 private final NavigableMap<Double, BedHeightValue> values; 41 private final NavigableMap<Double, BedHeightValue> values;
42 42
43 private Calculation problems; 43 private Calculation problems;
44 44
45 private final boolean isNull;
46
45 /** 47 /**
46 * Create bed height finders from a collection of bed heights. 48 * Create bed height finders from a collection of bed heights.
47 */ 49 */
48 public static Collection<BedHeightsFinder> createTkhBedHeights(final Calculation problems, final DoubleRange range, 50 public static Collection<BedHeightsFinder> createTkhBedHeights(final Calculation problems, final DoubleRange range,
49 final Collection<BedHeight> bedHeights) { 51 final Collection<BedHeight> bedHeights) {
110 112
111 return BedHeightsFinder.createBedHeights(problems, bedHeight, range); 113 return BedHeightsFinder.createBedHeights(problems, bedHeight, range);
112 } 114 }
113 115
114 /** 116 /**
117 * Creates a {@link BedHeightsFinder} that returns always NaN heights
118 */
119 public static BedHeightsFinder NullFinder() {
120 final NavigableMap<Double, BedHeightValue> values = new TreeMap<>();
121 return new BedHeightsFinder(null, null, values, true);
122 }
123
124 /**
115 * Create a finder for a given bed height. 125 * Create a finder for a given bed height.
116 * 126 *
117 */ 127 */
118 private static BedHeightsFinder createBedHeights(final Calculation problems, final BedHeight bedHeight, final DoubleRange range) { 128 private static BedHeightsFinder createBedHeights(final Calculation problems, final BedHeight bedHeight, final DoubleRange range) {
119 129
130 } 140 }
131 } 141 }
132 142
133 final BedHeightInfo info = BedHeightInfo.from(bedHeight); 143 final BedHeightInfo info = BedHeightInfo.from(bedHeight);
134 144
135 return new BedHeightsFinder(problems, info, values); 145 return new BedHeightsFinder(problems, info, values, false);
136 } 146 }
137 147
138 private BedHeightsFinder(final Calculation problems, final BedHeightInfo info, final NavigableMap<Double, BedHeightValue> values) { 148 private BedHeightsFinder(final Calculation problems, final BedHeightInfo info, final NavigableMap<Double, BedHeightValue> values, final boolean isNull) {
139 this.info = info; 149 this.info = info;
140 this.values = values; 150 this.values = values;
141 this.problems = problems; 151 this.problems = problems;
152 this.isNull = isNull;
153 }
154
155 /**
156 * Whether this is a null (always NaN) finder.
157 *
158 * @return
159 */
160 public boolean isNull() {
161 return this.isNull;
142 } 162 }
143 163
144 public boolean isEmpty() { 164 public boolean isEmpty() {
145 return this.values.isEmpty(); 165 return this.values.isEmpty();
146 } 166 }

http://dive4elements.wald.intevation.org