Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java @ 7391:9513d1af7d58
Renamed artifacts/**/BedHeight(Single) to BedHeight(Single)Data, to resolve
class name conflict with class in backend.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 17 Oct 2013 15:08:59 +0200 |
parents | 4eccd72595ee |
children | 04b70a6fe8c5 |
comparison
equal
deleted
inserted
replaced
7390:45e3bb00ce1a | 7391:9513d1af7d58 |
---|---|
64 private CalculationResult internalCalculate() { | 64 private CalculationResult internalCalculate() { |
65 | 65 |
66 BedDiffYearResult [] results = new BedDiffYearResult[heightIds.length]; | 66 BedDiffYearResult [] results = new BedDiffYearResult[heightIds.length]; |
67 | 67 |
68 for (int i = 0; i < heightIds.length; i++) { | 68 for (int i = 0; i < heightIds.length; i++) { |
69 BedHeight [] pair = getHeightPair(heightIds[i], "single"); | 69 BedHeightData [] pair = getHeightPair(heightIds[i], "single"); |
70 results[i] = calculateYearDifference(pair); | 70 results[i] = calculateYearDifference(pair); |
71 } | 71 } |
72 return new CalculationResult(results, this); | 72 return new CalculationResult(results, this); |
73 // Currently epochs are handled like single years. To handle epochs | 73 // Currently epochs are handled like single years. To handle epochs |
74 // uncomment the follwing code and use an if-clause in the code above. | 74 // uncomment the follwing code and use an if-clause in the code above. |
86 return new CalculationResult(); | 86 return new CalculationResult(); |
87 */ | 87 */ |
88 } | 88 } |
89 | 89 |
90 /** Get two BedHeights from factory. */ | 90 /** Get two BedHeights from factory. */ |
91 private static BedHeight [] getHeightPair(int [] ids, String type) { | 91 private static BedHeightData [] getHeightPair(int [] ids, String type) { |
92 return new BedHeight [] { | 92 return new BedHeightData [] { |
93 BedHeightFactory.getHeight(type, ids[0], 0), | 93 BedHeightFactory.getHeight(type, ids[0], 0), |
94 BedHeightFactory.getHeight(type, ids[1], 0) | 94 BedHeightFactory.getHeight(type, ids[1], 0) |
95 }; | 95 }; |
96 } | 96 } |
97 | 97 |
98 private BedDiffEpochResult calculateEpochDifference(BedHeight[] pair) { | 98 private BedDiffEpochResult calculateEpochDifference(BedHeightData[] pair) { |
99 | 99 |
100 BedHeight bh1 = pair[0]; | 100 BedHeightData bh1 = pair[0]; |
101 BedHeight bh2 = pair[1]; | 101 BedHeightData bh2 = pair[1]; |
102 | 102 |
103 TDoubleArrayList stations = bh1.getStations(); | 103 TDoubleArrayList stations = bh1.getStations(); |
104 int size = stations.size(); | 104 int size = stations.size(); |
105 | 105 |
106 TDoubleArrayList diffRes = new TDoubleArrayList(size); | 106 TDoubleArrayList diffRes = new TDoubleArrayList(size); |
123 Date start = ((BedHeightEpoch)bh1).getStart(); | 123 Date start = ((BedHeightEpoch)bh1).getStart(); |
124 Date end = ((BedHeightEpoch)bh2).getEnd(); | 124 Date end = ((BedHeightEpoch)bh2).getEnd(); |
125 return new BedDiffEpochResult(kms, diffRes, heights1, heights2, start, end); | 125 return new BedDiffEpochResult(kms, diffRes, heights1, heights2, start, end); |
126 } | 126 } |
127 | 127 |
128 private BedDiffYearResult calculateYearDifference(BedHeight[] pair) { | 128 private BedDiffYearResult calculateYearDifference(BedHeightData[] pair) { |
129 logger.debug("BedDiffCalculation.calculateYearDifference"); | 129 logger.debug("BedDiffCalculation.calculateYearDifference"); |
130 BedHeightSingle s1 = (BedHeightSingle) pair[0]; | 130 BedHeightSingleData s1 = (BedHeightSingleData) pair[0]; |
131 BedHeightSingle s2 = (BedHeightSingle) pair[1]; | 131 BedHeightSingleData s2 = (BedHeightSingleData) pair[1]; |
132 | 132 |
133 TDoubleArrayList stations = s1.getStations(); | 133 TDoubleArrayList stations = s1.getStations(); |
134 int size = stations.size(); | 134 int size = stations.size(); |
135 | 135 |
136 TDoubleArrayList diffRes = new TDoubleArrayList(size); | 136 TDoubleArrayList diffRes = new TDoubleArrayList(size); |