[poincare] Refactor the first lines of shallowReduce

This commit is contained in:
Léa Saviot
2018-08-24 09:45:34 +02:00
parent 9e0702a13c
commit fe77449ea4
33 changed files with 66 additions and 66 deletions

View File

@@ -28,8 +28,8 @@ LayoutRef AbsoluteValue::createLayout(Preferences::PrintFloatMode floatDisplayMo
}
Expression AbsoluteValue::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
Expression * op = editableOperand(0);

View File

@@ -18,8 +18,8 @@ Expression * ArcSine::clone() const {
}
Expression ArcSine::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
#if MATRIX_EXACT_REDUCING

View File

@@ -18,8 +18,8 @@ Expression * ArcTangent::clone() const {
}
Expression ArcTangent::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
#if MATRIX_EXACT_REDUCING

View File

@@ -21,8 +21,8 @@ Expression * BinomialCoefficient::clone() const {
}
Expression BinomialCoefficient::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
Expression * op0 = editableOperand(0);

View File

@@ -21,8 +21,8 @@ Expression * Ceiling::clone() const {
}
Expression Ceiling::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
Expression * op = editableOperand(0);

View File

@@ -17,8 +17,8 @@ Expression * ComplexArgument::clone() const {
}
Expression ComplexArgument::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
#if MATRIX_EXACT_REDUCING

View File

@@ -25,8 +25,8 @@ int ConfidenceInterval::polynomialDegree(char symbolName) const {
}
Expression ConfidenceInterval::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
Expression * op0 = editableOperand(0);

View File

@@ -20,8 +20,8 @@ LayoutRef Conjugate::createLayout(Preferences::PrintFloatMode floatDisplayMode,
}
Expression Conjugate::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
Expression * op = editableOperand(0);

View File

@@ -17,8 +17,8 @@ Expression * Determinant::clone() const {
}
Expression Determinant::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
Expression * op = editableOperand(0);

View File

@@ -19,8 +19,8 @@ Expression * DivisionQuotient::clone() const {
}
Expression DivisionQuotient::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
Expression * op0 = editableOperand(0);

View File

@@ -19,8 +19,8 @@ Expression * DivisionRemainder::clone() const {
}
Expression DivisionRemainder::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
Expression * op0 = editableOperand(0);

View File

@@ -39,8 +39,8 @@ Expression * Equal::standardEquation(Context & context, Preferences::AngleUnit a
}
Expression Equal::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
if (operand(0)->isIdenticalTo(operand(1))) {

View File

@@ -37,8 +37,8 @@ bool Factorial::needsParenthesesWithParent(const SerializationHelperInterface *
/* Simplification */
Expression Factorial::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
#if MATRIX_EXACT_REDUCING

View File

@@ -21,8 +21,8 @@ Expression * Floor::clone() const {
}
Expression Floor::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
Expression * op = editableOperand(0);

View File

@@ -18,8 +18,8 @@ Expression * FracPart::clone() const {
}
Expression FracPart::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
Expression * op = editableOperand(0);

View File

@@ -20,8 +20,8 @@ Expression * GreatCommonDivisor::clone() const {
}
Expression GreatCommonDivisor::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
Expression * op0 = editableOperand(0);

View File

@@ -18,8 +18,8 @@ Expression * HyperbolicArcCosine::clone() const {
}
Expression HyperbolicArcCosine::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
#if MATRIX_EXACT_REDUCING

View File

@@ -18,8 +18,8 @@ Expression * HyperbolicArcSine::clone() const {
}
Expression HyperbolicArcSine::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
#if MATRIX_EXACT_REDUCING

View File

@@ -18,8 +18,8 @@ Expression * HyperbolicArcTangent::clone() const {
}
Expression HyperbolicArcTangent::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
#if MATRIX_EXACT_REDUCING

View File

@@ -22,8 +22,8 @@ Expression * HyperbolicCosine::clone() const {
}
Expression HyperbolicCosine::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
#if MATRIX_EXACT_REDUCING

View File

@@ -22,8 +22,8 @@ Expression * HyperbolicSine::clone() const {
}
Expression HyperbolicSine::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
#if MATRIX_EXACT_REDUCING

View File

@@ -21,8 +21,8 @@ Expression * HyperbolicTangent::clone() const {
}
Expression HyperbolicTangent::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
#if MATRIX_EXACT_REDUCING

View File

@@ -19,8 +19,8 @@ Expression * ImaginaryPart::clone() const {
Expression ImaginaryPart::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
Expression * op = editableOperand(0);

View File

@@ -32,8 +32,8 @@ int Integral::polynomialDegree(char symbolName) const {
}
Expression Integral::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
#if MATRIX_EXACT_REDUCING

View File

@@ -20,8 +20,8 @@ Expression * LeastCommonMultiple::clone() const {
}
Expression LeastCommonMultiple::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
Expression * op0 = editableOperand(0);

View File

@@ -17,8 +17,8 @@ Expression * MatrixDimension::clone() const {
}
Expression MatrixDimension::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
#if MATRIX_EXACT_REDUCING

View File

@@ -20,8 +20,8 @@ Expression * MatrixInverse::clone() const {
}
Expression MatrixInverse::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
Expression * op = editableOperand(0);

View File

@@ -19,8 +19,8 @@ Expression * MatrixTrace::clone() const {
}
Expression MatrixTrace::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
Expression * op = editableOperand(0);

View File

@@ -18,8 +18,8 @@ Expression * MatrixTranspose::clone() const {
}
Expression MatrixTranspose::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
Expression * op = editableOperand(0);

View File

@@ -19,8 +19,8 @@ Expression * PermuteCoefficient::clone() const {
}
Expression PermuteCoefficient::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
Expression * op0 = editableOperand(0);

View File

@@ -26,8 +26,8 @@ int PredictionInterval::polynomialDegree(char symbolName) const {
}
Expression PredictionInterval::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
Expression * op0 = editableOperand(0);

View File

@@ -17,8 +17,8 @@ Expression * RealPart::clone() const {
}
Expression RealPart::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
Expression * op = editableOperand(0);

View File

@@ -20,8 +20,8 @@ Expression * Round::clone() const {
}
Expression Round::shallowReduce(Context& context, Preferences::AngleUnit angleUnit) const {
Expression * e = Expression::defaultShallowReduce(context, angleUnit);
if (e != this) {
Expression e = Expression::defaultShallowReduce(context, angleUnit);
if (e.isUndefinedOrAllocationFailure()) {
return e;
}
#if MATRIX_EXACT_REDUCING