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