mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-26 01:00:50 +01:00
[poincare] Change replaceSymbolWithExpression signature
replaceSymbolWithExpression(char symbol..)->replaceSymbolWithExpression(const char *..
This commit is contained in:
@@ -143,7 +143,7 @@ public:
|
||||
static constexpr int k_maxPolynomialDegree = 2;
|
||||
static constexpr int k_maxNumberOfPolynomialCoefficients = k_maxPolynomialDegree+1;
|
||||
int getPolynomialReducedCoefficients(char symbolName, Expression coefficients[], Context & context, Preferences::AngleUnit angleUnit) const;
|
||||
Expression replaceSymbolWithExpression(char symbol, Expression & expression) { return node()->replaceSymbolWithExpression(symbol, expression); }
|
||||
Expression replaceSymbolWithExpression(const char * symbol, Expression & expression) { return node()->replaceSymbolWithExpression(symbol, expression); }
|
||||
|
||||
/* Comparison */
|
||||
/* isIdenticalTo is the "easy" equality, it returns true if both trees have
|
||||
@@ -231,7 +231,7 @@ private:
|
||||
template<typename U> Evaluation<U> approximateToEvaluation(Context& context, Preferences::AngleUnit angleUnit) const;
|
||||
|
||||
/* Properties */
|
||||
Expression defaultReplaceSymbolWithExpression(char symbol, Expression expression);
|
||||
Expression defaultReplaceSymbolWithExpression(const char * symbol, Expression expression);
|
||||
int defaultGetPolynomialCoefficients(Context & context, char symbol, Expression expression[]) const;
|
||||
|
||||
/* Expression roots/extrema solver*/
|
||||
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
};
|
||||
virtual Sign sign() const { return Sign::Unknown; }
|
||||
virtual bool isNumber() const { return false; }
|
||||
/*!*/ virtual Expression replaceSymbolWithExpression(char symbol, Expression & expression);
|
||||
/*!*/ virtual Expression replaceSymbolWithExpression(const char * symbol, Expression & expression);
|
||||
/*!*/ virtual Expression setSign(Sign s, Context & context, Preferences::AngleUnit angleUnit);
|
||||
virtual int polynomialDegree(Context & context, char symbolName) const;
|
||||
/*!*/ virtual int getPolynomialCoefficients(Context & context, char symbolName, Expression coefficients[]) const;
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
// Expression Properties
|
||||
Type type() const override { return Type::Symbol; }
|
||||
Sign sign() const override;
|
||||
Expression replaceSymbolWithExpression(char symbol, Expression & expression) override;
|
||||
Expression replaceSymbolWithExpression(const char * symbol, Expression & expression) override;
|
||||
int polynomialDegree(Context & context, char symbolName) const override;
|
||||
int getPolynomialCoefficients(Context & context, char symbolName, Expression coefficients[]) const override;
|
||||
int getVariables(Context & context, isVariableTest isVariable, char * variables) const override;
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
|
||||
// Expression
|
||||
Expression shallowReduce(Context & context, Preferences::AngleUnit angleUnit);
|
||||
Expression replaceSymbolWithExpression(char symbol, Expression & expression);
|
||||
Expression replaceSymbolWithExpression(const char * symbol, Expression & expression);
|
||||
int getPolynomialCoefficients(Context & context, char symbolName, Expression coefficients[]) const;
|
||||
|
||||
// Symbol
|
||||
|
||||
@@ -182,7 +182,7 @@ Evaluation<U> Expression::approximateToEvaluation(Context& context, Preferences:
|
||||
return node()->approximate(U(), context, angleUnit);
|
||||
}
|
||||
|
||||
Expression Expression::defaultReplaceSymbolWithExpression(char symbol, Expression expression) {
|
||||
Expression Expression::defaultReplaceSymbolWithExpression(const char * symbol, Expression expression) {
|
||||
for (int i = 0; i < numberOfChildren(); i++) {
|
||||
childAtIndex(i).replaceSymbolWithExpression(symbol, expression);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression ExpressionNode::replaceSymbolWithExpression(char symbol, Expression & expression) {
|
||||
Expression ExpressionNode::replaceSymbolWithExpression(const char * symbol, Expression & expression) {
|
||||
return Expression(this).defaultReplaceSymbolWithExpression(symbol, expression);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ ExpressionNode::Sign SymbolNode::sign() const {
|
||||
return Sign::Unknown;
|
||||
}
|
||||
|
||||
Expression SymbolNode::replaceSymbolWithExpression(char symbol, Expression & expression) {
|
||||
Expression SymbolNode::replaceSymbolWithExpression(const char * symbol, Expression & expression) {
|
||||
return Symbol(this).replaceSymbolWithExpression(symbol, expression);
|
||||
}
|
||||
|
||||
@@ -183,8 +183,8 @@ Expression Symbol::shallowReduce(Context & context, Preferences::AngleUnit angle
|
||||
return *this;
|
||||
}
|
||||
|
||||
Expression Symbol::replaceSymbolWithExpression(char symbol, Expression & expression) {
|
||||
if (name() == symbol) {
|
||||
Expression Symbol::replaceSymbolWithExpression(const char * symbol, Expression & expression) {
|
||||
if (strcmp(name(), symbol) == 0) {
|
||||
Expression value = expression.clone();
|
||||
Expression p = parent();
|
||||
if (!p.isUninitialized() && p.node()->childNeedsParenthesis(value.node())) {
|
||||
|
||||
Reference in New Issue
Block a user