From b3f8156cfeb436059d57e08438ee0bbebeee963e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Fri, 17 Nov 2017 11:36:10 +0100 Subject: [PATCH] [poincare] Fix Expression::IsMatrix Change-Id: I7956ba5c293431f91020e2211245da8fafdd5e1b --- poincare/include/poincare/expression.h | 2 +- poincare/src/determinant.cpp | 2 +- poincare/src/expression.cpp | 4 ++-- poincare/src/matrix_dimension.cpp | 2 +- poincare/src/matrix_inverse.cpp | 2 +- poincare/src/matrix_trace.cpp | 2 +- poincare/src/matrix_transpose.cpp | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/poincare/include/poincare/expression.h b/poincare/include/poincare/expression.h index cd6edb4f8..7522af8de 100644 --- a/poincare/include/poincare/expression.h +++ b/poincare/include/poincare/expression.h @@ -186,7 +186,7 @@ public: virtual Sign sign() const { return Sign::Unknown; } typedef bool (*ExpressionTest)(const Expression * e); bool recursivelyMatches(ExpressionTest test) const; - static bool isMatrix(const Expression * e); + static bool IsMatrix(const Expression * e); /* Comparison */ /* isIdenticalTo is the "easy" equality, it returns true if both trees have diff --git a/poincare/src/determinant.cpp b/poincare/src/determinant.cpp index 33a23bc36..8a907a790 100644 --- a/poincare/src/determinant.cpp +++ b/poincare/src/determinant.cpp @@ -22,7 +22,7 @@ Expression * Determinant::shallowReduce(Context& context, AngleUnit angleUnit) { return e; } Expression * op = editableOperand(0); - if (!op->recursivelyMatches(Expression::isMatrix)) { + if (!op->recursivelyMatches(Expression::IsMatrix)) { return replaceWith(op, true); } return this; diff --git a/poincare/src/expression.cpp b/poincare/src/expression.cpp index 1d7442224..9735cc2cf 100644 --- a/poincare/src/expression.cpp +++ b/poincare/src/expression.cpp @@ -88,8 +88,8 @@ bool Expression::recursivelyMatches(ExpressionTest test) const { return false; } -bool Expression::isMatrix(const Expression * e) { - return e->type() == Type::Matrix || e->type() == Type::ConfidenceInterval || e->type() == Type::MatrixDimension || e->type() == Type::PredictionInterval; +bool Expression::IsMatrix(const Expression * e) { + return e->type() == Type::Matrix || e->type() == Type::ConfidenceInterval || e->type() == Type::MatrixDimension || e->type() == Type::PredictionInterval || e->type() == Type::MatrixInverse || e->type() == Type::MatrixTranspose; } /* Comparison */ diff --git a/poincare/src/matrix_dimension.cpp b/poincare/src/matrix_dimension.cpp index 51333f0b4..076a695c4 100644 --- a/poincare/src/matrix_dimension.cpp +++ b/poincare/src/matrix_dimension.cpp @@ -27,7 +27,7 @@ Expression * MatrixDimension::shallowReduce(Context& context, AngleUnit angleUni const Expression * newOperands[2] = {new Rational(m->numberOfRows()), new Rational(m->numberOfColumns())}; return replaceWith(new Matrix(newOperands, 1, 2, false), true); } - if (!op->recursivelyMatches(Expression::isMatrix)) { + if (!op->recursivelyMatches(Expression::IsMatrix)) { const Expression * newOperands[2] = {new Rational(1), new Rational(1)}; return replaceWith(new Matrix(newOperands, 1, 2, false), true); } diff --git a/poincare/src/matrix_inverse.cpp b/poincare/src/matrix_inverse.cpp index 14fc9aaed..2a450e320 100644 --- a/poincare/src/matrix_inverse.cpp +++ b/poincare/src/matrix_inverse.cpp @@ -26,7 +26,7 @@ Expression * MatrixInverse::shallowReduce(Context& context, AngleUnit angleUnit) return e; } Expression * op = editableOperand(0); - if (!op->recursivelyMatches(Expression::isMatrix)) { + if (!op->recursivelyMatches(Expression::IsMatrix)) { detachOperand(op); return replaceWith(new Power(op, new Rational(-1), false), true)->shallowReduce(context, angleUnit); } diff --git a/poincare/src/matrix_trace.cpp b/poincare/src/matrix_trace.cpp index 710f2a956..d7c3c207a 100644 --- a/poincare/src/matrix_trace.cpp +++ b/poincare/src/matrix_trace.cpp @@ -38,7 +38,7 @@ Expression * MatrixTrace::shallowReduce(Context& context, AngleUnit angleUnit) { } return replaceWith(a, true)->shallowReduce(context, angleUnit); } - if (!op->recursivelyMatches(Expression::isMatrix)) { + if (!op->recursivelyMatches(Expression::IsMatrix)) { return replaceWith(op, true); } return this; diff --git a/poincare/src/matrix_transpose.cpp b/poincare/src/matrix_transpose.cpp index 66db61e7e..f2da1314c 100644 --- a/poincare/src/matrix_transpose.cpp +++ b/poincare/src/matrix_transpose.cpp @@ -28,7 +28,7 @@ Expression * MatrixTranspose::shallowReduce(Context& context, AngleUnit angleUni Matrix * transpose = static_cast(op)->createTranspose(); return replaceWith(transpose, true); } - if (!op->recursivelyMatches(Expression::isMatrix)) { + if (!op->recursivelyMatches(Expression::IsMatrix)) { return replaceWith(op, true); } return this;