Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/tkhstate/DefaultBedHeightsConfig.java @ 9469:6acd22e86951
Improvements on Config-Files
author | gernotbelger |
---|---|
date | Tue, 04 Sep 2018 16:42:03 +0200 |
parents | eedb0bcf226b |
children |
comparison
equal
deleted
inserted
replaced
9468:c01f1e65903b | 9469:6acd22e86951 |
---|---|
27 * | 27 * |
28 * @author Gernot Belger | 28 * @author Gernot Belger |
29 */ | 29 */ |
30 final class DefaultBedHeightsConfig { | 30 final class DefaultBedHeightsConfig { |
31 | 31 |
32 private static final String CONFIG_FILE = "sinfo_tkh_sohlhoehen_%s.properties"; | 32 private static final String CONFIG_FILE = "standard_sohlhoehen_%s.properties"; |
33 | |
34 | 33 |
35 public static class DefaultBedHeight { | 34 public static class DefaultBedHeight { |
36 | 35 |
37 public final String description; | 36 public final String description; |
38 public final double startKm; | 37 public final double startKm; |
54 private final Map<String, Collection<DefaultBedHeight>> cache = new HashMap<>(); | 53 private final Map<String, Collection<DefaultBedHeight>> cache = new HashMap<>(); |
55 | 54 |
56 private DefaultBedHeightsConfig() { | 55 private DefaultBedHeightsConfig() { |
57 } | 56 } |
58 | 57 |
59 | |
60 private synchronized Collection<DefaultBedHeight> getBedHeightDefaultsForRiver(final River river, final Calculation problems) { | 58 private synchronized Collection<DefaultBedHeight> getBedHeightDefaultsForRiver(final River river, final Calculation problems) { |
61 | 59 |
62 final String rivername = river.getName(); | 60 final String rivername = river.getName(); |
63 if (!this.cache.containsKey(rivername)) { | 61 if (!this.cache.containsKey(rivername)) { |
64 final Collection<DefaultBedHeight> newDefaults = loadBedHeightDefaultsForRiver(river, problems); | 62 final Collection<DefaultBedHeight> newDefaults = loadBedHeightDefaultsForRiver(river, problems); |
73 | 71 |
74 try { | 72 try { |
75 final String rivername = river.getName(); | 73 final String rivername = river.getName(); |
76 final String filename = String.format(CONFIG_FILE, rivername); | 74 final String filename = String.format(CONFIG_FILE, rivername); |
77 | 75 |
78 final Properties properties = Config.loadProperties(filename); | 76 final Properties properties = Config.loadProperties(filename, Config.getModulesConfigDirectory()); |
79 | 77 |
80 final Set<String> keys = properties.stringPropertyNames(); | 78 final Set<String> keys = properties.stringPropertyNames(); |
81 | 79 |
82 final Collection<DefaultBedHeight> defaults = new ArrayList<>(keys.size()); | 80 final Collection<DefaultBedHeight> defaults = new ArrayList<>(keys.size()); |
83 | 81 |