Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/FlowVelocityCalculation.java @ 8202:e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Fri, 05 Sep 2014 12:58:17 +0200 |
parents | be0e3b93144c |
children | 0a5239a1e46e |
comparison
equal
deleted
inserted
replaced
8201:4b8c5a08de04 | 8202:e4606eae8ea5 |
---|---|
24 | 24 |
25 | 25 |
26 /** Calculate flow velocity. */ | 26 /** Calculate flow velocity. */ |
27 public class FlowVelocityCalculation extends Calculation { | 27 public class FlowVelocityCalculation extends Calculation { |
28 | 28 |
29 /** Own logger. */ | 29 /** Own log. */ |
30 private static final Logger logger = | 30 private static final Logger log = |
31 Logger.getLogger(FlowVelocityCalculation.class); | 31 Logger.getLogger(FlowVelocityCalculation.class); |
32 | 32 |
33 | 33 |
34 public CalculationResult calculate(FlowVelocityAccess access) { | 34 public CalculationResult calculate(FlowVelocityAccess access) { |
35 logger.info("FlowVelocityCalculation.calculate"); | 35 log.info("FlowVelocityCalculation.calculate"); |
36 | 36 |
37 int[] mainIds = access.getMainChannels(); | 37 int[] mainIds = access.getMainChannels(); |
38 int[] totalIds = access.getTotalChannels(); | 38 int[] totalIds = access.getTotalChannels(); |
39 | 39 |
40 if (logger.isDebugEnabled()) { | 40 if (log.isDebugEnabled()) { |
41 Artifact a = access.getArtifact(); | 41 Artifact a = access.getArtifact(); |
42 logger.debug("Artifact '" + a.identifier() + "' contains:"); | 42 log.debug("Artifact '" + a.identifier() + "' contains:"); |
43 if (mainIds != null) { | 43 if (mainIds != null) { |
44 logger.debug(" " + mainIds.length + " main channel ids"); | 44 log.debug(" " + mainIds.length + " main channel ids"); |
45 } | 45 } |
46 | 46 |
47 if (totalIds != null) { | 47 if (totalIds != null) { |
48 logger.debug(" " + totalIds.length + " total channel ids"); | 48 log.debug(" " + totalIds.length + " total channel ids"); |
49 } | 49 } |
50 } | 50 } |
51 | 51 |
52 List<DischargeZone> zones = getDischargeZones(mainIds, totalIds); | 52 List<DischargeZone> zones = getDischargeZones(mainIds, totalIds); |
53 List<FlowVelocityModel> models = getFlowVelocityModels(access, zones); | 53 List<FlowVelocityModel> models = getFlowVelocityModels(access, zones); |
98 FlowVelocityAccess access, | 98 FlowVelocityAccess access, |
99 List<DischargeZone> zones | 99 List<DischargeZone> zones |
100 ) { | 100 ) { |
101 String riverName = access.getRiverName(); | 101 String riverName = access.getRiverName(); |
102 if (riverName == null) { | 102 if (riverName == null) { |
103 logger.warn("No river name found"); | 103 log.warn("No river name found"); |
104 return Collections.<FlowVelocityModel>emptyList(); | 104 return Collections.<FlowVelocityModel>emptyList(); |
105 } | 105 } |
106 | 106 |
107 List<FlowVelocityModel> models = new ArrayList<FlowVelocityModel>(); | 107 List<FlowVelocityModel> models = new ArrayList<FlowVelocityModel>(); |
108 | 108 |
122 double kmHi | 122 double kmHi |
123 ) { | 123 ) { |
124 List<FlowVelocityModelValue> values = | 124 List<FlowVelocityModelValue> values = |
125 FlowVelocityModelValue.getValues(model, kmLo, kmHi); | 125 FlowVelocityModelValue.getValues(model, kmLo, kmHi); |
126 | 126 |
127 logger.debug("Found " + values.size() + " values for model."); | 127 log.debug("Found " + values.size() + " values for model."); |
128 | 128 |
129 for (FlowVelocityModelValue value: values) { | 129 for (FlowVelocityModelValue value: values) { |
130 data.addKM(value.getStation().doubleValue()); | 130 data.addKM(value.getStation().doubleValue()); |
131 data.addQ(value.getQ().doubleValue()); | 131 data.addQ(value.getQ().doubleValue()); |
132 data.addVTotal(value.getTotalChannel().doubleValue()); | 132 data.addVTotal(value.getTotalChannel().doubleValue()); |
157 List<FlowVelocityModel> models | 157 List<FlowVelocityModel> models |
158 ) { | 158 ) { |
159 double kmLo = access.getLowerKM(); | 159 double kmLo = access.getLowerKM(); |
160 double kmHi = access.getUpperKM(); | 160 double kmHi = access.getUpperKM(); |
161 | 161 |
162 logger.debug("Prepare data for km range: " + kmLo + " - " + kmHi); | 162 log.debug("Prepare data for km range: " + kmLo + " - " + kmHi); |
163 | 163 |
164 FlowVelocityData[] data = new FlowVelocityData[models.size()]; | 164 FlowVelocityData[] data = new FlowVelocityData[models.size()]; |
165 for (int i = 0, n = models.size(); i < n; i++) { | 165 for (int i = 0, n = models.size(); i < n; i++) { |
166 FlowVelocityData d = new FlowVelocityData(); | 166 FlowVelocityData d = new FlowVelocityData(); |
167 | 167 |
168 prepareData(d, models.get(i), kmLo, kmHi); | 168 prepareData(d, models.get(i), kmLo, kmHi); |
169 | 169 |
170 data[i] = d; | 170 data[i] = d; |
171 } | 171 } |
172 | 172 |
173 logger.debug("Calculation contains " + data.length + " data items."); | 173 log.debug("Calculation contains " + data.length + " data items."); |
174 | 174 |
175 return new CalculationResult(data, this); | 175 return new CalculationResult(data, this); |
176 } | 176 } |
177 } | 177 } |
178 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : | 178 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |