ResetTimeSteps(), GetTimeSteps(), GetSteps():

add parameter paymentOptionIndex (default=0)
This commit is contained in:
Gerhard Hoffmann 2024-04-12 14:20:05 +02:00
parent f241a87dc1
commit afa62183fd

View File

@ -14,7 +14,7 @@
using namespace std;
class Calculator {
mutable QList<int> m_timeSteps;
mutable QVector<QList<int>> m_timeSteps;
mutable QList<int> m_priceSteps;
protected:
@ -29,8 +29,17 @@ public:
return c;
}
void ResetTimeSteps() { m_timeSteps.clear(); }
QList<int> timeSteps() const { return m_timeSteps; }
void ResetTimeSteps(int paymentOptionIndex) {
if (m_timeSteps.size() > 0) {
m_timeSteps[paymentOptionIndex].clear();
}
}
QList<int> timeSteps(int paymentOptionIndex=0) const {
if (m_timeSteps.size() > 0) {
return m_timeSteps[paymentOptionIndex];
}
return QList<int>();
}
void ResetPriceSteps() { m_priceSteps.clear(); }
QList<int> priceSteps() const { return m_priceSteps; }
@ -66,8 +75,8 @@ public:
// helper function to find time steps for a tariff with PaymentMethod::Steps
// (e.g. Schoenau/Koenigsee)
//
QList<int> GetTimeSteps(Configuration *cfg) const;
QList<int> GetSteps(Configuration *cfg) const { return GetTimeSteps(cfg); }
QList<int> GetTimeSteps(Configuration *cfg, int paymentOptionIndex=0) const;
QList<int> GetSteps(Configuration *cfg, int paymentOptionIndex=0) const { return GetTimeSteps(cfg, paymentOptionIndex); }
QList<int> GetPriceSteps(Configuration *cfg) const;