Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/MiddleBedHeightCalculation.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 | b5cba2690347 |
children | 3a0522f1a532 |
comparison
equal
deleted
inserted
replaced
8201:4b8c5a08de04 | 8202:e4606eae8ea5 |
---|---|
21 import org.dive4elements.river.artifacts.model.CalculationResult; | 21 import org.dive4elements.river.artifacts.model.CalculationResult; |
22 | 22 |
23 | 23 |
24 public class MiddleBedHeightCalculation extends Calculation { | 24 public class MiddleBedHeightCalculation extends Calculation { |
25 | 25 |
26 private static final Logger logger = | 26 private static final Logger log = |
27 Logger.getLogger(MiddleBedHeightCalculation.class); | 27 Logger.getLogger(MiddleBedHeightCalculation.class); |
28 | 28 |
29 | 29 |
30 public CalculationResult calculate(BedHeightAccess access) { | 30 public CalculationResult calculate(BedHeightAccess access) { |
31 logger.info("MiddleBedHeightCalculation.calculate"); | 31 log.info("MiddleBedHeightCalculation.calculate"); |
32 | 32 |
33 int[] singleIds = access.getBedHeightSingleIDs(); | 33 int[] singleIds = access.getBedHeightSingleIDs(); |
34 | 34 |
35 | 35 |
36 if (logger.isDebugEnabled()) { | 36 if (log.isDebugEnabled()) { |
37 Artifact artifact = access.getArtifact(); | 37 Artifact artifact = access.getArtifact(); |
38 | 38 |
39 logger.debug("Artifact '" + artifact.identifier() + "' contains:"); | 39 log.debug("Artifact '" + artifact.identifier() + "' contains:"); |
40 if (singleIds != null) { | 40 if (singleIds != null) { |
41 logger.debug(" " + singleIds.length + " single bedheight ids"); | 41 log.debug(" " + singleIds.length + " single bedheight ids"); |
42 } | 42 } |
43 } | 43 } |
44 | 44 |
45 List<BedHeightSingle> singles = getSingles(access, singleIds); | 45 List<BedHeightSingle> singles = getSingles(access, singleIds); |
46 | 46 |
59 | 59 |
60 if (s != null) { | 60 if (s != null) { |
61 singles.add(s); | 61 singles.add(s); |
62 } | 62 } |
63 else { | 63 else { |
64 logger.warn("Cannot find Single by id: " + id); | 64 log.warn("Cannot find Single by id: " + id); |
65 // TODO ADD WARNING | 65 // TODO ADD WARNING |
66 } | 66 } |
67 } | 67 } |
68 | 68 |
69 return singles; | 69 return singles; |
72 | 72 |
73 protected CalculationResult buildCalculationResult( | 73 protected CalculationResult buildCalculationResult( |
74 BedHeightAccess access, | 74 BedHeightAccess access, |
75 List<BedHeightSingle> singles | 75 List<BedHeightSingle> singles |
76 ) { | 76 ) { |
77 logger.info("MiddleBedHeightCalculation.buildCalculationResult"); | 77 log.info("MiddleBedHeightCalculation.buildCalculationResult"); |
78 | 78 |
79 double kmLo = access.getLowerKM(); | 79 double kmLo = access.getLowerKM(); |
80 double kmHi = access.getUpperKM(); | 80 double kmHi = access.getUpperKM(); |
81 | 81 |
82 List<MiddleBedHeightData> data = new ArrayList<MiddleBedHeightData>(); | 82 List<MiddleBedHeightData> data = new ArrayList<MiddleBedHeightData>(); |
87 if (d != null) { | 87 if (d != null) { |
88 data.add(d); | 88 data.add(d); |
89 } | 89 } |
90 } | 90 } |
91 | 91 |
92 logger.debug("Calculation results in " + data.size() + " data objects."); | 92 log.debug("Calculation results in " + data.size() + " data objects."); |
93 | 93 |
94 return new CalculationResult((MiddleBedHeightData[]) | 94 return new CalculationResult((MiddleBedHeightData[]) |
95 data.toArray(new MiddleBedHeightData[data.size()]), this); | 95 data.toArray(new MiddleBedHeightData[data.size()]), this); |
96 } | 96 } |
97 | 97 |
99 protected MiddleBedHeightData prepareSingleData( | 99 protected MiddleBedHeightData prepareSingleData( |
100 BedHeightSingle single, | 100 BedHeightSingle single, |
101 double kmLo, | 101 double kmLo, |
102 double kmHi | 102 double kmHi |
103 ) { | 103 ) { |
104 logger.debug("Prepare data for single: " + single.getDescription()); | 104 log.debug("Prepare data for single: " + single.getDescription()); |
105 | 105 |
106 List<BedHeightSingleValue> values = | 106 List<BedHeightSingleValue> values = |
107 BedHeightSingleValue.getBedHeightSingleValues(single, kmLo, kmHi); | 107 BedHeightSingleValue.getBedHeightSingleValues(single, kmLo, kmHi); |
108 | 108 |
109 int year = single.getYear() != null ? single.getYear() : 0; | 109 int year = single.getYear() != null ? single.getYear() : 0; |
155 0, | 155 0, |
156 true); | 156 true); |
157 } | 157 } |
158 } | 158 } |
159 | 159 |
160 logger.debug("Single contains " + values.size() + " values"); | 160 log.debug("Single contains " + values.size() + " values"); |
161 | 161 |
162 return data; | 162 return data; |
163 } | 163 } |
164 } | 164 } |
165 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : | 165 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |