diff --git a/apps/shared/function_app.cpp b/apps/shared/function_app.cpp index 298f018d2..41efe2b44 100644 --- a/apps/shared/function_app.cpp +++ b/apps/shared/function_app.cpp @@ -15,9 +15,7 @@ FunctionApp::Snapshot::Snapshot() : } void FunctionApp::Snapshot::reset() { - m_interval.setStart(0); - m_interval.setEnd(10); - m_interval.setStep(1); + m_interval.reset(); m_indexFunctionSelectedByCursor = 0; m_modelVersion = 0; m_rangeVersion = 0; diff --git a/apps/shared/interval.cpp b/apps/shared/interval.cpp index 5731de680..047c94d3c 100644 --- a/apps/shared/interval.cpp +++ b/apps/shared/interval.cpp @@ -4,12 +4,9 @@ namespace Shared { Interval::Interval() : - m_numberOfElements(0), - m_start(0.0), - m_end(10.0), - m_step(1.0), - m_needCompute(true) + m_numberOfElements(0) { + reset(); } int Interval::numberOfElements() { @@ -55,6 +52,13 @@ void Interval::setElement(int i, double f) { } } +void Interval::reset() { + m_start = 0.0; + m_end = 10.0; + m_step = 1.0; + m_needCompute = true; +} + void Interval::computeElements() { if (!m_needCompute) { return; diff --git a/apps/shared/interval.h b/apps/shared/interval.h index edca86274..54bd946f7 100644 --- a/apps/shared/interval.h +++ b/apps/shared/interval.h @@ -18,6 +18,7 @@ public: void setEnd(double f); void setStep(double f); void setElement(int i, double f); + void reset(); // TODO: decide the max number of elements after optimization constexpr static int k_maxNumberOfElements = 100; private: