##// END OF EJS Templates
(Refactoring) Renames IDataSeries::minData() and IDataSeries::maxData()
Alexandre Leroux -
r604:6cc1dd13aa83
parent child
Show More
@@ -191,16 +191,16 public:
191 191 std::make_unique<dataseries_detail::IteratorValue<Dim> >(*this, false)}};
192 192 }
193 193
194 /// @sa IDataSeries::minData()
195 DataSeriesIterator minData(double minXAxisData) const override
194 /// @sa IDataSeries::minXAxisData()
195 DataSeriesIterator minXAxisData(double minXAxisData) const override
196 196 {
197 197 return std::lower_bound(
198 198 cbegin(), cend(), minXAxisData,
199 199 [](const auto &itValue, const auto &value) { return itValue.x() < value; });
200 200 }
201 201
202 /// @sa IDataSeries::maxData()
203 DataSeriesIterator maxData(double maxXAxisData) const override
202 /// @sa IDataSeries::maxXAxisData()
203 DataSeriesIterator maxXAxisData(double maxXAxisData) const override
204 204 {
205 205 // Gets the first element that greater than max value
206 206 auto it = std::upper_bound(
@@ -72,11 +72,11 public:
72 72
73 73 /// @return the iterator to the first entry of the data series whose x-axis data is greater than
74 74 /// or equal to the value passed in parameter, or the end iterator if there is no matching value
75 virtual DataSeriesIterator minData(double minXAxisData) const = 0;
75 virtual DataSeriesIterator minXAxisData(double minXAxisData) const = 0;
76 76
77 77 /// @return the iterator to the last entry of the data series whose x-axis data is less than or
78 78 /// equal to the value passed in parameter, or the end iterator if there is no matching value
79 virtual DataSeriesIterator maxData(double maxXAxisData) const = 0;
79 virtual DataSeriesIterator maxXAxisData(double maxXAxisData) const = 0;
80 80
81 81 virtual std::pair<DataSeriesIterator, DataSeriesIterator> subData(double min,
82 82 double max) const = 0;
@@ -174,11 +174,11 QVariant VariableModel::data(const QModelIndex &index, int role) const
174 174 case TSTART_COLUMN:
175 175 // Shows the min value of the data series above the range tstart
176 176 return dateTimeVariant([min = variable->range().m_TStart](
177 const auto &dataSeries) { return dataSeries.minData(min); });
177 const auto &dataSeries) { return dataSeries.minXAxisData(min); });
178 178 case TEND_COLUMN:
179 179 // Shows the max value of the data series under the range tend
180 180 return dateTimeVariant([max = variable->range().m_TEnd](
181 const auto &dataSeries) { return dataSeries.maxData(max); });
181 const auto &dataSeries) { return dataSeries.maxXAxisData(max); });
182 182 case UNIT_COLUMN:
183 183 return variable->metadata().value(QStringLiteral("units"));
184 184 case MISSION_COLUMN:
@@ -24,18 +24,18 private slots:
24 24 void testMerge();
25 25
26 26 /// Input test data
27 /// @sa testMinData()
28 void testMinData_data();
27 /// @sa testMinXAxisData()
28 void testMinXAxisData_data();
29 29
30 /// Tests get min data of a data series
31 void testMinData();
30 /// Tests get min x-axis data of a data series
31 void testMinXAxisData();
32 32
33 33 /// Input test data
34 /// @sa testMaxData()
35 void testMaxData_data();
34 /// @sa testMaxXAxisData()
35 void testMaxXAxisData_data();
36 36
37 /// Tests get max data of a data series
38 void testMaxData();
37 /// Tests get max x-axis data of a data series
38 void testMaxXAxisData();
39 39
40 40 /// Input test data
41 41 /// @sa testSubdata()
@@ -181,7 +181,7 void TestDataSeries::testMerge()
181 181 seriesValuesData.cbegin()));
182 182 }
183 183
184 void TestDataSeries::testMinData_data()
184 void TestDataSeries::testMinXAxisData_data()
185 185 {
186 186 // ////////////// //
187 187 // Test structure //
@@ -217,7 +217,7 void TestDataSeries::testMinData_data()
217 217 << std::numeric_limits<double>::quiet_NaN();
218 218 }
219 219
220 void TestDataSeries::testMinData()
220 void TestDataSeries::testMinXAxisData()
221 221 {
222 222 QFETCH(std::shared_ptr<ScalarSeries>, dataSeries);
223 223 QFETCH(double, min);
@@ -225,7 +225,7 void TestDataSeries::testMinData()
225 225 QFETCH(bool, expectedOK);
226 226 QFETCH(double, expectedMin);
227 227
228 auto it = dataSeries->minData(min);
228 auto it = dataSeries->minXAxisData(min);
229 229
230 230 QCOMPARE(expectedOK, it != dataSeries->cend());
231 231
@@ -235,7 +235,7 void TestDataSeries::testMinData()
235 235 }
236 236 }
237 237
238 void TestDataSeries::testMaxData_data()
238 void TestDataSeries::testMaxXAxisData_data()
239 239 {
240 240 // ////////////// //
241 241 // Test structure //
@@ -271,7 +271,7 void TestDataSeries::testMaxData_data()
271 271 << std::numeric_limits<double>::quiet_NaN();
272 272 }
273 273
274 void TestDataSeries::testMaxData()
274 void TestDataSeries::testMaxXAxisData()
275 275 {
276 276 QFETCH(std::shared_ptr<ScalarSeries>, dataSeries);
277 277 QFETCH(double, max);
@@ -279,7 +279,7 void TestDataSeries::testMaxData()
279 279 QFETCH(bool, expectedOK);
280 280 QFETCH(double, expectedMax);
281 281
282 auto it = dataSeries->maxData(max);
282 auto it = dataSeries->maxXAxisData(max);
283 283
284 284 QCOMPARE(expectedOK, it != dataSeries->cend());
285 285
General Comments 0
You need to be logged in to leave comments. Login now