diff --git a/include/fintamath/expressions/ExpressionComparator.hpp b/include/fintamath/expressions/ExpressionComparator.hpp index c40667723..3c503800c 100644 --- a/include/fintamath/expressions/ExpressionComparator.hpp +++ b/include/fintamath/expressions/ExpressionComparator.hpp @@ -7,7 +7,7 @@ namespace fintamath::detail { struct ComparatorOptions final { - bool constantGreaterThanVariable = false; + bool termOrderInversed = false; bool comparableOrderInversed = false; }; diff --git a/include/fintamath/expressions/interfaces/IPolynomExpression.hpp b/include/fintamath/expressions/interfaces/IPolynomExpression.hpp index 43000b620..daaf0739f 100644 --- a/include/fintamath/expressions/interfaces/IPolynomExpression.hpp +++ b/include/fintamath/expressions/interfaces/IPolynomExpression.hpp @@ -47,7 +47,7 @@ class IPolynomExpression : public IExpression { ArgumentPtr postSimplify() const override; - virtual bool isConstantGreaterThanVariable() const; + virtual bool isTermOrderInversed() const; virtual bool isComparableOrderInversed() const; diff --git a/src/fintamath/expressions/ExpressionComparator.cpp b/src/fintamath/expressions/ExpressionComparator.cpp index cc957a001..60fb57dd6 100644 --- a/src/fintamath/expressions/ExpressionComparator.cpp +++ b/src/fintamath/expressions/ExpressionComparator.cpp @@ -141,11 +141,11 @@ Ordering compareTerms(const ArgumentPtr &lhs, } if (lhsTerm && !rhsTerm) { - return !options.constantGreaterThanVariable ? Ordering::greater : Ordering::less; + return !options.termOrderInversed ? Ordering::greater : Ordering::less; } if (!lhsTerm && rhsTerm) { - return options.constantGreaterThanVariable ? Ordering::greater : Ordering::less; + return options.termOrderInversed ? Ordering::greater : Ordering::less; } while (lhsTerm && rhsTerm) { @@ -205,17 +205,17 @@ Ordering compareNonExpressions(const ArgumentPtr &lhs, const ComparatorOptions &options) { if (is(lhs) && !is(rhs)) { - return !options.constantGreaterThanVariable ? Ordering::greater : Ordering::less; + return !options.termOrderInversed ? Ordering::greater : Ordering::less; } if (!is(lhs) && is(rhs)) { - return options.constantGreaterThanVariable ? Ordering::greater : Ordering::less; + return options.termOrderInversed ? Ordering::greater : Ordering::less; } if (is(lhs) && !is(rhs)) { - return !options.constantGreaterThanVariable ? Ordering::greater : Ordering::less; + return !options.termOrderInversed ? Ordering::greater : Ordering::less; } if (!is(lhs) && is(rhs)) { - return options.constantGreaterThanVariable ? Ordering::greater : Ordering::less; + return options.termOrderInversed ? Ordering::greater : Ordering::less; } if (*lhs == *rhs) { @@ -269,7 +269,7 @@ Ordering compareExpressions(const std::shared_ptr &lhs, } ComparatorOptions childCompOptions = options; - childCompOptions.constantGreaterThanVariable = false; + childCompOptions.termOrderInversed = false; const ChildrenComparatorResult childrenComp = compareChildren(lhs->getChildren(), rhs->getChildren(), childCompOptions); if (childrenComp.prefixVariables != Ordering::equal) { @@ -317,7 +317,7 @@ Ordering compareExpressionAndNonExpression(const std::shared_ptr(rhs)) { - return !options.constantGreaterThanVariable ? Ordering::greater : Ordering::less; + return !options.termOrderInversed ? Ordering::greater : Ordering::less; } if (const auto res = compareTerms(lhs, rhs, options); res != Ordering::equal) { @@ -325,7 +325,7 @@ Ordering compareExpressionAndNonExpression(const std::shared_ptr(lhs->getFunction())) { - return !options.constantGreaterThanVariable ? Ordering::greater : Ordering::less; + return !options.termOrderInversed ? Ordering::greater : Ordering::less; } if (const auto res = compareTerms(lhs, rhs, options); res != Ordering::equal) { @@ -346,7 +346,7 @@ Ordering compareExpressionAndNonExpression(const std::shared_ptr &lhs, @@ -362,10 +362,10 @@ Ordering compareFunctions(const std::shared_ptr &lhs, const ComparatorOptions &options) { if (is(lhs) && !is(rhs)) { - return options.constantGreaterThanVariable ? Ordering::greater : Ordering::less; + return options.termOrderInversed ? Ordering::greater : Ordering::less; } if (!is(lhs) && is(rhs)) { - return !options.constantGreaterThanVariable ? Ordering::greater : Ordering::less; + return !options.termOrderInversed ? Ordering::greater : Ordering::less; } if (*lhs == *rhs) { diff --git a/src/fintamath/expressions/interfaces/IPolynomExpression.cpp b/src/fintamath/expressions/interfaces/IPolynomExpression.cpp index 1fe45eb46..74509803d 100644 --- a/src/fintamath/expressions/interfaces/IPolynomExpression.cpp +++ b/src/fintamath/expressions/interfaces/IPolynomExpression.cpp @@ -202,13 +202,13 @@ std::string IPolynomExpression::childToString(const IOperator &oper, const Argum std::strong_ordering IPolynomExpression::compare(const ArgumentPtr &lhs, const ArgumentPtr &rhs) const { const ComparatorOptions options = { - .constantGreaterThanVariable = isConstantGreaterThanVariable(), + .termOrderInversed = isTermOrderInversed(), .comparableOrderInversed = isComparableOrderInversed(), }; return fintamath::compare(lhs, rhs, options); } -bool IPolynomExpression::isConstantGreaterThanVariable() const { +bool IPolynomExpression::isTermOrderInversed() const { return false; } diff --git a/src/fintamath/expressions/polynomial/MulExpr.cpp b/src/fintamath/expressions/polynomial/MulExpr.cpp index 634cd2434..3dedd03bc 100644 --- a/src/fintamath/expressions/polynomial/MulExpr.cpp +++ b/src/fintamath/expressions/polynomial/MulExpr.cpp @@ -105,7 +105,7 @@ MulExpr::SimplifyFunctionVector MulExpr::getFunctionsForPostSimplify() const { return simplifyFunctions; } -bool MulExpr::isConstantGreaterThanVariable() const { +bool MulExpr::isTermOrderInversed() const { return true; } diff --git a/src/fintamath/expressions/polynomial/MulExpr.hpp b/src/fintamath/expressions/polynomial/MulExpr.hpp index 2e5cd7277..f31aede8b 100644 --- a/src/fintamath/expressions/polynomial/MulExpr.hpp +++ b/src/fintamath/expressions/polynomial/MulExpr.hpp @@ -23,7 +23,7 @@ class MulExpr final : public IPolynomExpressionCRTP { SimplifyFunctionVector getFunctionsForPostSimplify() const override; - bool isConstantGreaterThanVariable() const override; + bool isTermOrderInversed() const override; private: static ArgumentPtr constSimplify(const IFunction &func, const ArgumentPtr &lhs, const ArgumentPtr &rhs);