Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/states/WaterlevelState.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 | 5e38e2924c07 |
children |
comparison
equal
deleted
inserted
replaced
9424:da19f1f58d72 | 9425:3f49835a00c3 |
---|---|
49 } | 49 } |
50 | 50 |
51 | 51 |
52 /** | 52 /** |
53 * Compute result or returned object from cache, create facets. | 53 * Compute result or returned object from cache, create facets. |
54 * @param feed | |
54 * @param old Object that was cached. | 55 * @param old Object that was cached. |
55 */ | 56 */ |
56 protected Object compute( | 57 private Object compute( |
57 WINFOArtifact winfo, | 58 WINFOArtifact winfo, |
58 CallContext cc, | 59 CallContext cc, |
60 ComputeType type, | |
59 String hash, | 61 String hash, |
60 List<Facet> facets, | 62 List<Facet> facets, |
61 Object old | 63 Object old |
62 ) { | 64 ) { |
63 String id = getID(); | 65 String id = getID(); |
95 Facet w = new WaterlevelFacet( | 97 Facet w = new WaterlevelFacet( |
96 i, LONGITUDINAL_W, nameW, ComputeType.ADVANCE, id, hash); | 98 i, LONGITUDINAL_W, nameW, ComputeType.ADVANCE, id, hash); |
97 Facet q = new WaterlevelFacet( | 99 Facet q = new WaterlevelFacet( |
98 i, LONGITUDINAL_Q, nameQ, ComputeType.ADVANCE, id, hash); | 100 i, LONGITUDINAL_Q, nameQ, ComputeType.ADVANCE, id, hash); |
99 | 101 |
100 facets.add(new CrossSectionWaterLineFacet(i, nameW)); | 102 facets.add(new CrossSectionWaterLineFacet(i, nameW, type, hash, getID(), Integer.valueOf(i))); |
101 | 103 |
102 facets.add(w); | 104 facets.add(w); |
103 facets.add(q); | 105 facets.add(q); |
104 } | 106 } |
105 | 107 |
161 ) { | 163 ) { |
162 if (artifact instanceof ChartArtifact) { | 164 if (artifact instanceof ChartArtifact) { |
163 facets.add(new EmptyFacet()); | 165 facets.add(new EmptyFacet()); |
164 return null; | 166 return null; |
165 } | 167 } |
166 return compute((WINFOArtifact) artifact, context, hash, facets, old); | 168 return compute((WINFOArtifact) artifact, context, ComputeType.FEED, hash, facets, old); |
167 } | 169 } |
168 | 170 |
169 | 171 |
170 /** | 172 /** |
171 * @param context Ignored. | 173 * @param context Ignored. |
180 ) { | 182 ) { |
181 if (artifact instanceof ChartArtifact) { | 183 if (artifact instanceof ChartArtifact) { |
182 facets.add(new EmptyFacet()); | 184 facets.add(new EmptyFacet()); |
183 return null; | 185 return null; |
184 } | 186 } |
185 return compute((WINFOArtifact) artifact, context, hash, facets, old); | 187 return compute((WINFOArtifact) artifact, context, ComputeType.ADVANCE, hash, facets, old); |
186 } | 188 } |
187 } | 189 } |
188 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : | 190 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |