Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthState.java @ 8914:e3519c3e7a0a
Workflow for SINFO-Transport bodies heights inclduing winfo calculation
author | gernotbelger |
---|---|
date | Tue, 27 Feb 2018 18:06:52 +0100 |
parents | 7a8c12706834 |
children | 5d5d0051723f |
comparison
equal
deleted
inserted
replaced
8913:924cd9943337 | 8914:e3519c3e7a0a |
---|---|
76 * @param old | 76 * @param old |
77 * Object that was cached. | 77 * Object that was cached. |
78 */ | 78 */ |
79 private Object compute(final SINFOArtifact sinfo, final CallContext context, final String hash, final List<Facet> facets, final Object old) { | 79 private Object compute(final SINFOArtifact sinfo, final CallContext context, final String hash, final List<Facet> facets, final Object old) { |
80 | 80 |
81 final CalculationResult res; | 81 final CalculationResult res = doCompute(sinfo, context, old); |
82 if (old instanceof CalculationResult) | |
83 res = (CalculationResult) old; | |
84 else | |
85 res = new FlowDepthCalculation(context).calculate(sinfo); | |
86 | 82 |
87 if (facets == null) { | 83 if (facets == null) |
88 return res; | 84 return res; |
89 } | |
90 | 85 |
91 final FlowDepthCalculationResults results = (FlowDepthCalculationResults) res.getData(); | 86 final FlowDepthCalculationResults results = (FlowDepthCalculationResults) res.getData(); |
92 | 87 |
93 /* add themes for chart, for each result */ | 88 /* add themes for chart, for each result */ |
94 final List<FlowDepthCalculationResult> resultList = results.getResults(); | 89 final List<FlowDepthCalculationResult> resultList = results.getResults(); |
138 facets.add(new ReportFacet(ComputeType.ADVANCE, hash, this.id)); | 133 facets.add(new ReportFacet(ComputeType.ADVANCE, hash, this.id)); |
139 } | 134 } |
140 | 135 |
141 return res; | 136 return res; |
142 } | 137 } |
138 | |
139 private CalculationResult doCompute(final SINFOArtifact sinfo, final CallContext context, final Object old) { | |
140 if (old instanceof CalculationResult) | |
141 return (CalculationResult) old; | |
142 | |
143 return new FlowDepthCalculation(context).calculate(sinfo); | |
144 } | |
143 } | 145 } |