mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[poincare] Expression::Type --> ExpressionNode::Type
This commit is contained in:
@@ -36,14 +36,14 @@ void Equation::tidy() {
|
||||
Expression * Equation::standardForm(Context * context) const {
|
||||
if (m_standardForm == nullptr) {
|
||||
Expression * e = expression(context);
|
||||
if (e->type() == Expression::Type::Equal) {
|
||||
if (e->type() == ExpressionNode::Type::Equal) {
|
||||
m_standardForm = static_cast<const Equal *>(e)->standardEquation(*context, Preferences::sharedPreferences()->angleUnit());
|
||||
} else if (e->type() == Expression::Type::Rational && static_cast<Rational *>(e)->isOne()) {
|
||||
} else if (e->type() == ExpressionNode::Type::Rational && static_cast<Rational *>(e)->isOne()) {
|
||||
// The equality was reduced which means the equality was always true.
|
||||
m_standardForm = RationalReference(0);
|
||||
} else {
|
||||
// The equality has an undefined operand
|
||||
assert(e->type() == Expression::Type::Undefined);
|
||||
assert(e->type() == ExpressionNode::Type::Undefined);
|
||||
}
|
||||
}
|
||||
return m_standardForm;
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
* So we don't want it to be deleted when we're destroyed (parent destructor). */
|
||||
}
|
||||
int polynomialDegree(char symbolName) const override { return -1; }
|
||||
Type type() const override { return Expression::Type::SimplificationRoot; }
|
||||
Type type() const override { return ExpressionNode::Type::SimplificationRoot; }
|
||||
LayoutRef createLayout(Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type ArcCosine::type() const {
|
||||
ExpressionNode::Type ArcCosine::type() const {
|
||||
return Type::ArcCosine;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type ArcSine::type() const {
|
||||
ExpressionNode::Type ArcSine::type() const {
|
||||
return Type::ArcSine;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type ArcTangent::type() const {
|
||||
ExpressionNode::Type ArcTangent::type() const {
|
||||
return Type::ArcTangent;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type BinomialCoefficient::type() const {
|
||||
ExpressionNode::Type BinomialCoefficient::type() const {
|
||||
return Type::BinomialCoefficient;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type Ceiling::type() const {
|
||||
ExpressionNode::Type Ceiling::type() const {
|
||||
return Type::Ceiling;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type ComplexArgument::type() const {
|
||||
ExpressionNode::Type ComplexArgument::type() const {
|
||||
return Type::ComplexArgument;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type ConfidenceInterval::type() const {
|
||||
ExpressionNode::Type ConfidenceInterval::type() const {
|
||||
return Type::ConfidenceInterval;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type Conjugate::type() const {
|
||||
ExpressionNode::Type Conjugate::type() const {
|
||||
return Type::Conjugate;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type Determinant::type() const {
|
||||
ExpressionNode::Type Determinant::type() const {
|
||||
return Type::Determinant;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type DivisionQuotient::type() const {
|
||||
ExpressionNode::Type DivisionQuotient::type() const {
|
||||
return Type::DivisionQuotient;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type DivisionRemainder::type() const {
|
||||
ExpressionNode::Type DivisionRemainder::type() const {
|
||||
return Type::DivisionRemainder;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type Equal::type() const {
|
||||
ExpressionNode::Type Equal::type() const {
|
||||
return Type::Equal;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,197 +17,197 @@ void print_expression(const Expression * e, int indentationLevel) {
|
||||
}
|
||||
GlobalContext context;
|
||||
switch (e->type()) {
|
||||
case Expression::Type::AbsoluteValue:
|
||||
case ExpressionNode::Type::AbsoluteValue:
|
||||
std::cout << "AbsoluteValue";
|
||||
break;
|
||||
case Expression::Type::Addition:
|
||||
case ExpressionNode::Type::Addition:
|
||||
std::cout << "Addition";
|
||||
break;
|
||||
case Expression::Type::Approximation:
|
||||
case ExpressionNode::Type::Approximation:
|
||||
std::cout << "Approximation";
|
||||
break;
|
||||
case Expression::Type::ArcCosine:
|
||||
case ExpressionNode::Type::ArcCosine:
|
||||
std::cout << "ArcCosine";
|
||||
break;
|
||||
case Expression::Type::ArcSine:
|
||||
case ExpressionNode::Type::ArcSine:
|
||||
std::cout << "ArcSine";
|
||||
break;
|
||||
case Expression::Type::ArcTangent:
|
||||
case ExpressionNode::Type::ArcTangent:
|
||||
std::cout << "ArcTangent";
|
||||
break;
|
||||
case Expression::Type::BinomialCoefficient:
|
||||
case ExpressionNode::Type::BinomialCoefficient:
|
||||
std::cout << "BinomialCoefficient";
|
||||
break;
|
||||
case Expression::Type::Ceiling:
|
||||
case ExpressionNode::Type::Ceiling:
|
||||
std::cout << "Ceiling";
|
||||
break;
|
||||
case Expression::Type::ComplexArgument:
|
||||
case ExpressionNode::Type::ComplexArgument:
|
||||
std::cout << "ComplexArgument";
|
||||
break;
|
||||
case Expression::Type::ConfidenceInterval:
|
||||
case ExpressionNode::Type::ConfidenceInterval:
|
||||
std::cout << "ConfidenceInterval";
|
||||
break;
|
||||
case Expression::Type::Conjugate:
|
||||
case ExpressionNode::Type::Conjugate:
|
||||
std::cout << "Conjugate";
|
||||
break;
|
||||
case Expression::Type::Cosine:
|
||||
case ExpressionNode::Type::Cosine:
|
||||
std::cout << "Cosine";
|
||||
break;
|
||||
case Expression::Type::Decimal:
|
||||
case ExpressionNode::Type::Decimal:
|
||||
std::cout << "Decimal(";
|
||||
std::cout << e->approximateToScalar<double>(context, Preferences::AngleUnit::Radian);
|
||||
std::cout << ")";
|
||||
break;
|
||||
case Expression::Type::Derivative:
|
||||
case ExpressionNode::Type::Derivative:
|
||||
std::cout << "Derivative";
|
||||
break;
|
||||
case Expression::Type::Determinant:
|
||||
case ExpressionNode::Type::Determinant:
|
||||
std::cout << "Determinant";
|
||||
break;
|
||||
case Expression::Type::Division:
|
||||
case ExpressionNode::Type::Division:
|
||||
std::cout << "Division";
|
||||
break;
|
||||
case Expression::Type::DivisionQuotient:
|
||||
case ExpressionNode::Type::DivisionQuotient:
|
||||
std::cout << "DivisionQuotient";
|
||||
break;
|
||||
case Expression::Type::DivisionRemainder:
|
||||
case ExpressionNode::Type::DivisionRemainder:
|
||||
std::cout << "DivisionRemainder";
|
||||
break;
|
||||
case Expression::Type::EmptyExpression:
|
||||
case ExpressionNode::Type::EmptyExpression:
|
||||
std::cout << "EmptyExpression";
|
||||
break;
|
||||
case Expression::Type::Equal:
|
||||
case ExpressionNode::Type::Equal:
|
||||
std::cout << "Equal";
|
||||
break;
|
||||
case Expression::Type::Factor:
|
||||
case ExpressionNode::Type::Factor:
|
||||
std::cout << "Factor";
|
||||
break;
|
||||
case Expression::Type::Factorial:
|
||||
case ExpressionNode::Type::Factorial:
|
||||
std::cout << "Factorial";
|
||||
break;
|
||||
case Expression::Type::Floor:
|
||||
case ExpressionNode::Type::Floor:
|
||||
std::cout << "Floor";
|
||||
break;
|
||||
case Expression::Type::FracPart:
|
||||
case ExpressionNode::Type::FracPart:
|
||||
std::cout << "FracPart";
|
||||
break;
|
||||
case Expression::Type::GreatCommonDivisor:
|
||||
case ExpressionNode::Type::GreatCommonDivisor:
|
||||
std::cout << "GreatCommonDivisor";
|
||||
break;
|
||||
case Expression::Type::HyperbolicArcCosine:
|
||||
case ExpressionNode::Type::HyperbolicArcCosine:
|
||||
std::cout << "HyperbolicArcCosine";
|
||||
break;
|
||||
case Expression::Type::HyperbolicArcSine:
|
||||
case ExpressionNode::Type::HyperbolicArcSine:
|
||||
std::cout << "HyperbolicArcSine";
|
||||
break;
|
||||
case Expression::Type::HyperbolicArcTangent:
|
||||
case ExpressionNode::Type::HyperbolicArcTangent:
|
||||
std::cout << "HyperbolicArcTangent";
|
||||
break;
|
||||
case Expression::Type::HyperbolicCosine:
|
||||
case ExpressionNode::Type::HyperbolicCosine:
|
||||
std::cout << "HyperbolicCosine";
|
||||
break;
|
||||
case Expression::Type::HyperbolicSine:
|
||||
case ExpressionNode::Type::HyperbolicSine:
|
||||
std::cout << "HyperbolicSine";
|
||||
break;
|
||||
case Expression::Type::HyperbolicTangent:
|
||||
case ExpressionNode::Type::HyperbolicTangent:
|
||||
std::cout << "HyperbolicTangent";
|
||||
break;
|
||||
case Expression::Type::ImaginaryPart:
|
||||
case ExpressionNode::Type::ImaginaryPart:
|
||||
std::cout << "ImaginaryPart";
|
||||
break;
|
||||
case Expression::Type::Integral:
|
||||
case ExpressionNode::Type::Integral:
|
||||
std::cout << "Integral";
|
||||
break;
|
||||
case Expression::Type::LeastCommonMultiple:
|
||||
case ExpressionNode::Type::LeastCommonMultiple:
|
||||
std::cout << "LeastCommonMultiple";
|
||||
break;
|
||||
case Expression::Type::Logarithm:
|
||||
case ExpressionNode::Type::Logarithm:
|
||||
std::cout << "Logarithm";
|
||||
break;
|
||||
case Expression::Type::Matrix:
|
||||
case ExpressionNode::Type::Matrix:
|
||||
std::cout << "Matrix(Rows: ";
|
||||
std::cout << static_cast<const Matrix *>(e)->numberOfRows();
|
||||
std::cout << ", Columns: ";
|
||||
std::cout << static_cast<const Matrix *>(e)->numberOfColumns();
|
||||
std::cout << ")";
|
||||
break;
|
||||
case Expression::Type::MatrixDimension:
|
||||
case ExpressionNode::Type::MatrixDimension:
|
||||
std::cout << "MatrixDimension";
|
||||
break;
|
||||
case Expression::Type::MatrixInverse:
|
||||
case ExpressionNode::Type::MatrixInverse:
|
||||
std::cout << "MatrixInverse";
|
||||
break;
|
||||
case Expression::Type::MatrixTrace:
|
||||
case ExpressionNode::Type::MatrixTrace:
|
||||
std::cout << "MatrixTrace";
|
||||
break;
|
||||
case Expression::Type::MatrixTranspose:
|
||||
case ExpressionNode::Type::MatrixTranspose:
|
||||
std::cout << "MatrixTranspose";
|
||||
break;
|
||||
case Expression::Type::Multiplication:
|
||||
case ExpressionNode::Type::Multiplication:
|
||||
std::cout << "Multiplication";
|
||||
break;
|
||||
case Expression::Type::NaperianLogarithm:
|
||||
case ExpressionNode::Type::NaperianLogarithm:
|
||||
std::cout << "NaperianLogarithm";
|
||||
break;
|
||||
case Expression::Type::NthRoot:
|
||||
case ExpressionNode::Type::NthRoot:
|
||||
std::cout << "NthRoot";
|
||||
break;
|
||||
case Expression::Type::Opposite:
|
||||
case ExpressionNode::Type::Opposite:
|
||||
std::cout << "Opposite";
|
||||
break;
|
||||
case Expression::Type::Parenthesis:
|
||||
case ExpressionNode::Type::Parenthesis:
|
||||
std::cout << "Parenthesis";
|
||||
break;
|
||||
case Expression::Type::PermuteCoefficient:
|
||||
case ExpressionNode::Type::PermuteCoefficient:
|
||||
std::cout << "PermuteCoefficient";
|
||||
break;
|
||||
case Expression::Type::PredictionInterval:
|
||||
case ExpressionNode::Type::PredictionInterval:
|
||||
std::cout << "PredictionInterval";
|
||||
break;
|
||||
case Expression::Type::Power:
|
||||
case ExpressionNode::Type::Power:
|
||||
std::cout << "Power";
|
||||
break;
|
||||
case Expression::Type::Product:
|
||||
case ExpressionNode::Type::Product:
|
||||
std::cout << "Product";
|
||||
break;
|
||||
case Expression::Type::Random:
|
||||
case ExpressionNode::Type::Random:
|
||||
std::cout << "Random";
|
||||
break;
|
||||
case Expression::Type::Randint:
|
||||
case ExpressionNode::Type::Randint:
|
||||
std::cout << "Randint";
|
||||
break;
|
||||
case Expression::Type::Rational:
|
||||
case ExpressionNode::Type::Rational:
|
||||
std::cout << "Rational(";
|
||||
std::cout << static_cast<const Rational * >(e)->numerator().approximate<double>();
|
||||
std::cout << ", ";
|
||||
std::cout << static_cast<const Rational * >(e)->denominator().approximate<double>();
|
||||
std::cout << ")";
|
||||
break;
|
||||
case Expression::Type::RealPart:
|
||||
case ExpressionNode::Type::RealPart:
|
||||
std::cout << "RealPart";
|
||||
break;
|
||||
case Expression::Type::Round:
|
||||
case ExpressionNode::Type::Round:
|
||||
std::cout << "Round";
|
||||
break;
|
||||
case Expression::Type::SimplificationRoot:
|
||||
case ExpressionNode::Type::SimplificationRoot:
|
||||
std::cout << "SimplificationRoot";
|
||||
break;
|
||||
case Expression::Type::Sine:
|
||||
case ExpressionNode::Type::Sine:
|
||||
std::cout << "Sine";
|
||||
break;
|
||||
case Expression::Type::SquareRoot:
|
||||
case ExpressionNode::Type::SquareRoot:
|
||||
std::cout << "SquareRoot";
|
||||
break;
|
||||
case Expression::Type::Store:
|
||||
case ExpressionNode::Type::Store:
|
||||
std::cout << "Store";
|
||||
break;
|
||||
case Expression::Type::Subtraction:
|
||||
case ExpressionNode::Type::Subtraction:
|
||||
std::cout << "Subtraction";
|
||||
break;
|
||||
case Expression::Type::Sum:
|
||||
case ExpressionNode::Type::Sum:
|
||||
std::cout << "Sum";
|
||||
break;
|
||||
case Expression::Type::Symbol:
|
||||
case ExpressionNode::Type::Symbol:
|
||||
std::cout << "Symbol(";
|
||||
switch (((Symbol*)e)->name()) {
|
||||
case Ion::Charset::SmallPi:
|
||||
@@ -224,10 +224,10 @@ void print_expression(const Expression * e, int indentationLevel) {
|
||||
}
|
||||
std::cout << ")";
|
||||
break;
|
||||
case Expression::Type::Tangent:
|
||||
case ExpressionNode::Type::Tangent:
|
||||
std::cout << "Tangent";
|
||||
break;
|
||||
case Expression::Type::Undefined:
|
||||
case ExpressionNode::Type::Undefined:
|
||||
std::cout << "Undefined";
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type Factor::type() const {
|
||||
ExpressionNode::Type Factor::type() const {
|
||||
return Type::Factor;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ Factorial::Factorial(const Expression * argument, bool clone) :
|
||||
{
|
||||
}
|
||||
|
||||
Expression::Type Factorial::type() const {
|
||||
ExpressionNode::Type Factorial::type() const {
|
||||
return Type::Factorial;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type Floor::type() const {
|
||||
ExpressionNode::Type Floor::type() const {
|
||||
return Type::Floor;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type FracPart::type() const {
|
||||
ExpressionNode::Type FracPart::type() const {
|
||||
return Type::FracPart;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type GreatCommonDivisor::type() const {
|
||||
ExpressionNode::Type GreatCommonDivisor::type() const {
|
||||
return Type::GreatCommonDivisor;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type HyperbolicArcCosine::type() const {
|
||||
ExpressionNode::Type HyperbolicArcCosine::type() const {
|
||||
return Type::HyperbolicArcCosine;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type HyperbolicArcSine::type() const {
|
||||
ExpressionNode::Type HyperbolicArcSine::type() const {
|
||||
return Type::HyperbolicArcSine;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type HyperbolicArcTangent::type() const {
|
||||
ExpressionNode::Type HyperbolicArcTangent::type() const {
|
||||
return Type::HyperbolicArcTangent;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type HyperbolicCosine::type() const {
|
||||
ExpressionNode::Type HyperbolicCosine::type() const {
|
||||
return Type::HyperbolicCosine;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type HyperbolicSine::type() const {
|
||||
ExpressionNode::Type HyperbolicSine::type() const {
|
||||
return Type::HyperbolicSine;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type HyperbolicTangent::type() const {
|
||||
ExpressionNode::Type HyperbolicTangent::type() const {
|
||||
return Type::HyperbolicTangent;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type ImaginaryPart::type() const {
|
||||
ExpressionNode::Type ImaginaryPart::type() const {
|
||||
return Type::ImaginaryPart;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type Integral::type() const {
|
||||
ExpressionNode::Type Integral::type() const {
|
||||
return Type::Integral;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type LeastCommonMultiple::type() const {
|
||||
ExpressionNode::Type LeastCommonMultiple::type() const {
|
||||
return Type::LeastCommonMultiple;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type MatrixDimension::type() const {
|
||||
ExpressionNode::Type MatrixDimension::type() const {
|
||||
return Type::MatrixDimension;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type MatrixInverse::type() const {
|
||||
ExpressionNode::Type MatrixInverse::type() const {
|
||||
return Type::MatrixInverse;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type MatrixTrace::type() const {
|
||||
ExpressionNode::Type MatrixTrace::type() const {
|
||||
return Type::MatrixTrace;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type MatrixTranspose::type() const {
|
||||
ExpressionNode::Type MatrixTranspose::type() const {
|
||||
return Type::MatrixTranspose;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type PermuteCoefficient::type() const {
|
||||
ExpressionNode::Type PermuteCoefficient::type() const {
|
||||
return Type::PermuteCoefficient;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type PredictionInterval::type() const {
|
||||
ExpressionNode::Type PredictionInterval::type() const {
|
||||
return Type::PredictionInterval;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type Product::type() const {
|
||||
ExpressionNode::Type Product::type() const {
|
||||
return Type::Product;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type Randint::type() const {
|
||||
ExpressionNode::Type Randint::type() const {
|
||||
return Type::Randint;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type Random::type() const {
|
||||
ExpressionNode::Type Random::type() const {
|
||||
return Type::Random;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type RealPart::type() const {
|
||||
ExpressionNode::Type RealPart::type() const {
|
||||
return Type::RealPart;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type Round::type() const {
|
||||
ExpressionNode::Type Round::type() const {
|
||||
return Type::Round;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
namespace Poincare {
|
||||
|
||||
Expression SimplificationHelper::Map(Expression e, Context & context, Preferences::AngleUnit angleUnit) {
|
||||
assert(e->numberOfChildren() == 1 && e->childAtIndex(0)->type() == Expression::Type::Matrix);
|
||||
assert(e->numberOfChildren() == 1 && e->childAtIndex(0)->type() == ExpressionNode::Type::Matrix);
|
||||
Expression c = e.childAtIndex(0);
|
||||
Matrix matrix;
|
||||
for (int i = 0; i < c->numberOfChildren(); i++) {
|
||||
|
||||
@@ -12,7 +12,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type Store::type() const {
|
||||
ExpressionNode::Type Store::type() const {
|
||||
return Type::Store;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ extern "C" {
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
Expression::Type Sum::type() const {
|
||||
ExpressionNode::Type Sum::type() const {
|
||||
return Type::Sum;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,47 +16,47 @@ void assert_exp_is_bounded(Expression * exp, T lowBound, T upBound, bool upBound
|
||||
}
|
||||
|
||||
QUIZ_CASE(poincare_parse_function) {
|
||||
assert_parsed_expression_type("abs(-1)", Expression::Type::AbsoluteValue);
|
||||
assert_parsed_expression_type("arg(2+I)", Expression::Type::ComplexArgument);
|
||||
assert_parsed_expression_type("binomial(10, 4)", Expression::Type::BinomialCoefficient);
|
||||
assert_parsed_expression_type("ceil(0.2)", Expression::Type::Ceiling);
|
||||
assert_parsed_expression_type("diff(2*x, 2)", Expression::Type::Derivative);
|
||||
assert_parsed_expression_type("abs(-1)", ExpressionNode::Type::AbsoluteValue);
|
||||
assert_parsed_expression_type("arg(2+I)", ExpressionNode::Type::ComplexArgument);
|
||||
assert_parsed_expression_type("binomial(10, 4)", ExpressionNode::Type::BinomialCoefficient);
|
||||
assert_parsed_expression_type("ceil(0.2)", ExpressionNode::Type::Ceiling);
|
||||
assert_parsed_expression_type("diff(2*x, 2)", ExpressionNode::Type::Derivative);
|
||||
#if MATRICES_ARE_DEFINED
|
||||
assert_parsed_expression_type("dim([[2]])", Expression::Type::MatrixDimension);
|
||||
assert_parsed_expression_type("det([[1,2,3][4,5,6][7,8,9]])", Expression::Type::Determinant);
|
||||
assert_parsed_expression_type("dim([[2]])", ExpressionNode::Type::MatrixDimension);
|
||||
assert_parsed_expression_type("det([[1,2,3][4,5,6][7,8,9]])", ExpressionNode::Type::Determinant);
|
||||
#endif
|
||||
assert_parsed_expression_type("confidence(0.1, 100)", Expression::Type::ConfidenceInterval);
|
||||
assert_parsed_expression_type("conj(2)", Expression::Type::Conjugate);
|
||||
assert_parsed_expression_type("factor(23/42)", Expression::Type::Factor);
|
||||
assert_parsed_expression_type("floor(2.3)", Expression::Type::Floor);
|
||||
assert_parsed_expression_type("frac(2.3)", Expression::Type::FracPart);
|
||||
assert_parsed_expression_type("gcd(2,3)", Expression::Type::GreatCommonDivisor);
|
||||
assert_parsed_expression_type("im(2+I)", Expression::Type::ImaginaryPart);
|
||||
assert_parsed_expression_type("int(x, 2, 3)", Expression::Type::Integral);
|
||||
assert_parsed_expression_type("confidence(0.1, 100)", ExpressionNode::Type::ConfidenceInterval);
|
||||
assert_parsed_expression_type("conj(2)", ExpressionNode::Type::Conjugate);
|
||||
assert_parsed_expression_type("factor(23/42)", ExpressionNode::Type::Factor);
|
||||
assert_parsed_expression_type("floor(2.3)", ExpressionNode::Type::Floor);
|
||||
assert_parsed_expression_type("frac(2.3)", ExpressionNode::Type::FracPart);
|
||||
assert_parsed_expression_type("gcd(2,3)", ExpressionNode::Type::GreatCommonDivisor);
|
||||
assert_parsed_expression_type("im(2+I)", ExpressionNode::Type::ImaginaryPart);
|
||||
assert_parsed_expression_type("int(x, 2, 3)", ExpressionNode::Type::Integral);
|
||||
#if MATRICES_ARE_DEFINED
|
||||
assert_parsed_expression_type("inverse([[1,2,3][4,5,6][7,8,9]])", Expression::Type::MatrixInverse);
|
||||
assert_parsed_expression_type("inverse([[1,2,3][4,5,6][7,8,9]])", ExpressionNode::Type::MatrixInverse);
|
||||
#endif
|
||||
assert_parsed_expression_type("lcm(2,3)", Expression::Type::LeastCommonMultiple);
|
||||
assert_parsed_expression_type("ln(2)", Expression::Type::NaperianLogarithm);
|
||||
assert_parsed_expression_type("log(2)", Expression::Type::Logarithm);
|
||||
assert_parsed_expression_type("permute(10, 4)", Expression::Type::PermuteCoefficient);
|
||||
assert_parsed_expression_type("prediction(0.1, 100)", Expression::Type::ConfidenceInterval);
|
||||
assert_parsed_expression_type("prediction95(0.1, 100)", Expression::Type::PredictionInterval);
|
||||
assert_parsed_expression_type("product(n, 4, 10)", Expression::Type::Product);
|
||||
assert_parsed_expression_type("quo(29, 10)", Expression::Type::DivisionQuotient);
|
||||
assert_parsed_expression_type("random()", Expression::Type::Random);
|
||||
assert_parsed_expression_type("randint(1, 2)", Expression::Type::Randint);
|
||||
assert_parsed_expression_type("re(2+I)", Expression::Type::RealPart);
|
||||
assert_parsed_expression_type("rem(29, 10)", Expression::Type::DivisionRemainder);
|
||||
assert_parsed_expression_type("root(2,3)", Expression::Type::NthRoot);
|
||||
assert_parsed_expression_type("R(2)", Expression::Type::SquareRoot);
|
||||
assert_parsed_expression_type("round(2,3)", Expression::Type::Round);
|
||||
assert_parsed_expression_type("sum(n, 4, 10)", Expression::Type::Sum);
|
||||
assert_parsed_expression_type("lcm(2,3)", ExpressionNode::Type::LeastCommonMultiple);
|
||||
assert_parsed_expression_type("ln(2)", ExpressionNode::Type::NaperianLogarithm);
|
||||
assert_parsed_expression_type("log(2)", ExpressionNode::Type::Logarithm);
|
||||
assert_parsed_expression_type("permute(10, 4)", ExpressionNode::Type::PermuteCoefficient);
|
||||
assert_parsed_expression_type("prediction(0.1, 100)", ExpressionNode::Type::ConfidenceInterval);
|
||||
assert_parsed_expression_type("prediction95(0.1, 100)", ExpressionNode::Type::PredictionInterval);
|
||||
assert_parsed_expression_type("product(n, 4, 10)", ExpressionNode::Type::Product);
|
||||
assert_parsed_expression_type("quo(29, 10)", ExpressionNode::Type::DivisionQuotient);
|
||||
assert_parsed_expression_type("random()", ExpressionNode::Type::Random);
|
||||
assert_parsed_expression_type("randint(1, 2)", ExpressionNode::Type::Randint);
|
||||
assert_parsed_expression_type("re(2+I)", ExpressionNode::Type::RealPart);
|
||||
assert_parsed_expression_type("rem(29, 10)", ExpressionNode::Type::DivisionRemainder);
|
||||
assert_parsed_expression_type("root(2,3)", ExpressionNode::Type::NthRoot);
|
||||
assert_parsed_expression_type("R(2)", ExpressionNode::Type::SquareRoot);
|
||||
assert_parsed_expression_type("round(2,3)", ExpressionNode::Type::Round);
|
||||
assert_parsed_expression_type("sum(n, 4, 10)", ExpressionNode::Type::Sum);
|
||||
#if MATRICES_ARE_DEFINED
|
||||
assert_parsed_expression_type("trace([[1,2,3][4,5,6][7,8,9]])", Expression::Type::MatrixTrace);
|
||||
assert_parsed_expression_type("transpose([[1,2,3][4,5,6][7,8,9]])", Expression::Type::MatrixTranspose);
|
||||
assert_parsed_expression_type("trace([[1,2,3][4,5,6][7,8,9]])", ExpressionNode::Type::MatrixTrace);
|
||||
assert_parsed_expression_type("transpose([[1,2,3][4,5,6][7,8,9]])", ExpressionNode::Type::MatrixTranspose);
|
||||
#endif
|
||||
assert_parsed_expression_type("6!", Expression::Type::Factorial);
|
||||
assert_parsed_expression_type("6!", ExpressionNode::Type::Factorial);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
using namespace Poincare;
|
||||
|
||||
QUIZ_CASE(poincare_parse_symbol) {
|
||||
assert_parsed_expression_type("P", Expression::Type::Symbol);
|
||||
assert_parsed_expression_type("X", Expression::Type::Symbol);
|
||||
assert_parsed_expression_type("I", Expression::Type::Symbol);
|
||||
assert_parsed_expression_type("1.2E3", Expression::Type::Decimal);
|
||||
assert_parsed_expression_type("ans", Expression::Type::Symbol);
|
||||
assert_parsed_expression_type("P", ExpressionNode::Type::Symbol);
|
||||
assert_parsed_expression_type("X", ExpressionNode::Type::Symbol);
|
||||
assert_parsed_expression_type("I", ExpressionNode::Type::Symbol);
|
||||
assert_parsed_expression_type("1.2E3", ExpressionNode::Type::Decimal);
|
||||
assert_parsed_expression_type("ans", ExpressionNode::Type::Symbol);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user