comparison artifacts/src/main/java/org/dive4elements/river/artifacts/states/WaterlevelFetcher.java @ 9425:3f49835a00c3

Extended CrossSectionFacet so it may fetch different data from within the artifact result. Also allows to have acces to the potentially already computed artifact result via its normal computation cache.
author gernotbelger
date Fri, 17 Aug 2018 15:31:02 +0200
parents 392745cccede
children 93389a05119e
comparison
equal deleted inserted replaced
9424:da19f1f58d72 9425:3f49835a00c3
77 77
78 private WaterlevelData fetchWaterlevelFromArtifact(final CallContext context, final D4EArtifact d4eArtifact, final int idx, final double from, 78 private WaterlevelData fetchWaterlevelFromArtifact(final CallContext context, final D4EArtifact d4eArtifact, final int idx, final double from,
79 final double to) { 79 final double to) {
80 80
81 if (d4eArtifact instanceof StaticWKmsArtifact) 81 if (d4eArtifact instanceof StaticWKmsArtifact)
82 return fetchStaticWKmsArtifactWaterlevel((StaticWKmsArtifact) d4eArtifact, idx, from, to); 82 return fetchStaticWKmsArtifactWaterlevel((StaticWKmsArtifact) d4eArtifact, from, to);
83 83
84 if (d4eArtifact instanceof StaticWQKmsArtifact) 84 if (d4eArtifact instanceof StaticWQKmsArtifact)
85 return fetchStaticWQKmsArtifactWaterlevel((StaticWQKmsArtifact) d4eArtifact, from, to); 85 return fetchStaticWQKmsArtifactWaterlevel((StaticWQKmsArtifact) d4eArtifact, from, to);
86 86
87 if (d4eArtifact instanceof WINFOArtifact) 87 if (d4eArtifact instanceof WINFOArtifact)
96 96
97 // REMARK: instead of several helper methods here this would be a good place for abstraction, in order to push 97 // REMARK: instead of several helper methods here this would be a good place for abstraction, in order to push
98 // this logic back to the corresponding artifacts. However this will most certainly break existing 98 // this logic back to the corresponding artifacts. However this will most certainly break existing
99 // artifact-serialization 99 // artifact-serialization
100 100
101 private WaterlevelData fetchStaticWKmsArtifactWaterlevel(final StaticWKmsArtifact staticWKms, final int idx, final double from, final double to) { 101 private WaterlevelData fetchStaticWKmsArtifactWaterlevel(final StaticWKmsArtifact staticWKms, final double from, final double to) {
102 102
103 log.debug("WDifferencesState obtain data from StaticWKms"); 103 log.debug("WDifferencesState obtain data from StaticWKms");
104 104
105 final WKms wkms = staticWKms.getWKms(idx, from, to); 105 final WKms wkms = staticWKms.getWKms(from, to);
106 106
107 if (wkms != null) { 107 if (wkms != null) {
108 final int year = fetchStaticWKmsYear(staticWKms); 108 final int year = fetchStaticWKmsYear(staticWKms);
109 return new WaterlevelData(wkms, year, false, false); 109 return new WaterlevelData(wkms, year, false, false);
110 } 110 }

http://dive4elements.wald.intevation.org