comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/BedHeightsUtils.java @ 9573:b9c87bbff6a4

mean bed height -> mean bed LEVEL
author gernotbelger
date Tue, 06 Nov 2018 10:56:22 +0100
parents 8e100593aec3
children
comparison
equal deleted inserted replaced
9572:0d0c8fd1b8c8 9573:b9c87bbff6a4
14 14
15 import org.apache.commons.lang.ArrayUtils; 15 import org.apache.commons.lang.ArrayUtils;
16 import org.apache.commons.lang.math.DoubleRange; 16 import org.apache.commons.lang.math.DoubleRange;
17 17
18 /** 18 /**
19 * Helper functions for bed height calculations 19 * Helper functions for bed level calculations
20 */ 20 */
21 public final class BedHeightsUtils { 21 public final class BedHeightsUtils {
22 22
23 /** 23 /**
24 * Get a union of all stations in a collection of bed heights 24 * Get a union of all stations in a collection of bed levels
25 */ 25 */
26 public static double[] extractStations(final Collection<BedHeightsFinder> bedHeightFinders) { 26 public static double[] extractStations(final Collection<BedHeightsFinder> bedHeightFinders) {
27 27
28 return extractStations(bedHeightFinders, false); 28 return extractStations(bedHeightFinders, false);
29 } 29 }
30 30
31 /** 31 /**
32 * Get a union of all stations in a collection of bed heights 32 * Get a union of all stations in a collection of bed levels
33 */ 33 */
34 public static double[] extractStations(final Collection<BedHeightsFinder> bedHeightFinders, final boolean minMaxAware) { 34 public static double[] extractStations(final Collection<BedHeightsFinder> bedHeightFinders, final boolean minMaxAware) {
35 35
36 final Collection<Double> allStations = extractStationCollection(bedHeightFinders, minMaxAware); 36 final Collection<Double> allStations = extractStationCollection(bedHeightFinders, minMaxAware);
37 return ArrayUtils.toPrimitive(allStations.toArray(new Double[allStations.size()])); 37 return ArrayUtils.toPrimitive(allStations.toArray(new Double[allStations.size()]));
38 } 38 }
39 39
40 /** 40 /**
41 * Get a union of all stations in a collection of bed heights 41 * Get a union of all stations in a collection of bed levels
42 */ 42 */
43 public static Collection<Double> extractStationCollection(final Collection<BedHeightsFinder> bedHeightFinders, final boolean minMaxAware) { 43 public static Collection<Double> extractStationCollection(final Collection<BedHeightsFinder> bedHeightFinders, final boolean minMaxAware) {
44 44
45 if (!minMaxAware) 45 if (!minMaxAware)
46 return extractStationCollection(bedHeightFinders); 46 return extractStationCollection(bedHeightFinders);
55 } 55 }
56 return allStations; 56 return allStations;
57 } 57 }
58 58
59 /** 59 /**
60 * Get a union of all stations in a collection of bed heights 60 * Get a union of all stations in a collection of bed levels
61 */ 61 */
62 public static Collection<Double> extractStationCollection(final Collection<BedHeightsFinder> bedHeights) { 62 public static Collection<Double> extractStationCollection(final Collection<BedHeightsFinder> bedHeights) {
63 63
64 final Collection<Double> allStations = new TreeSet<>(); 64 final Collection<Double> allStations = new TreeSet<>();
65 65
68 68
69 return allStations; 69 return allStations;
70 } 70 }
71 71
72 /** 72 /**
73 * Intersects all km ranges of a collection of bed heights 73 * Intersects all km ranges of a collection of bed levels
74 */ 74 */
75 public static DoubleRange extractMinimumStationRange(final Collection<BedHeightsFinder> bedHeightFinders) { 75 public static DoubleRange extractMinimumStationRange(final Collection<BedHeightsFinder> bedHeightFinders) {
76 DoubleRange kmRange = null; 76 DoubleRange kmRange = null;
77 for (final BedHeightsFinder bhf : bedHeightFinders) 77 for (final BedHeightsFinder bhf : bedHeightFinders)
78 kmRange = intersectRanges(kmRange, bhf.getKmRange()); 78 kmRange = intersectRanges(kmRange, bhf.getKmRange());

http://dive4elements.wald.intevation.org