[poincare] Add Expression::FunctionHelper class

That class is meant to contain data about named functions (e.g. sin,
tan...) in one place: their name, their number of children and a pointer to
a builder. The derived class corresponding to each such function
contains a private instance (m_functionHelper) and a getter.
The previous parser is removed, along with unecessary
constructors (used by the previous parsers).
This commit is contained in:
Ruben Dashyan
2018-10-24 15:03:24 +02:00
committed by Émilie Feral
parent cda6f522f0
commit 61b1b8a09d
120 changed files with 660 additions and 933 deletions

View File

@@ -85,7 +85,7 @@ void StorageCartesianFunction::setDisplayDerivative(bool display) {
}
double StorageCartesianFunction::approximateDerivative(double x, Poincare::Context * context) const {
Poincare::Derivative derivative(expression(context).clone(), Symbol(Symbol::SpecialSymbols::UnknownX), Poincare::Float<double>(x)); // derivative takes ownership of Poincare::Float<double>(x) and the clone of expression
Poincare::Derivative derivative = Poincare::Derivative::Builder(expression(context).clone(), Symbol(Symbol::SpecialSymbols::UnknownX), Poincare::Float<double>(x)); // derivative takes ownership of Poincare::Float<double>(x) and the clone of expression
/* TODO: when we approximate derivative, we might want to simplify the
* derivative here. However, we might want to do it once for all x (to avoid
* lagging in the derivative table. */
@@ -93,7 +93,8 @@ double StorageCartesianFunction::approximateDerivative(double x, Poincare::Conte
}
double StorageCartesianFunction::sumBetweenBounds(double start, double end, Poincare::Context * context) const {
Poincare::Integral integral(expression(context).clone(), Symbol(Symbol::SpecialSymbols::UnknownX), Poincare::Float<double>(start), Poincare::Float<double>(end)); // Integral takes ownership of args
// TODO: this does not work yet because integral does not understand UnknownX
Poincare::Integral integral = Poincare::Integral::Builder(expression(context).clone(), Symbol(Symbol::SpecialSymbols::UnknownX), Poincare::Float<double>(start), Poincare::Float<double>(end)); // Integral takes ownership of args
/* TODO: when we approximate integral, we might want to simplify the integral
* here. However, we might want to do it once for all x (to avoid lagging in
* the derivative table. */