[Fix] Conflicts

This commit is contained in:
Quentin Guidée
2020-07-15 12:09:12 +02:00
7 changed files with 33 additions and 33 deletions

View File

@@ -30,7 +30,7 @@ void UnitListController::setExpression(Poincare::Expression e) {
bool requireSimplification = false;
bool canChangeUnitPrefix = false;
if (Unit::IsISSpeed(units)) {
if (Unit::IsSISpeed(units)) {
// 1.a. Turn speed into km/h
m_memoizedExpressions[numberOfMemoizedExpressions++] = UnitConvert::Builder(
m_expression.clone(),
@@ -43,7 +43,7 @@ void UnitListController::setExpression(Poincare::Expression e) {
)
);
requireSimplification = true; // Simplify the conversion
} else if (Unit::IsISVolume(units)) {
} else if (Unit::IsSIVolume(units)) {
// 1.b. Turn volume into L
m_memoizedExpressions[numberOfMemoizedExpressions++] = UnitConvert::Builder(
m_expression.clone(),
@@ -51,7 +51,7 @@ void UnitListController::setExpression(Poincare::Expression e) {
);
requireSimplification = true; // Simplify the conversion
canChangeUnitPrefix = true; // Pick best prefix (mL)
} else if (Unit::IsISEnergy(units)) {
} else if (Unit::IsSIEnergy(units)) {
// 1.c. Turn energy into Wh
m_memoizedExpressions[numberOfMemoizedExpressions++] = UnitConvert::Builder(
m_expression.clone(),
@@ -66,7 +66,7 @@ void UnitListController::setExpression(Poincare::Expression e) {
);
requireSimplification = true; // Simplify the conversion
canChangeUnitPrefix = true; // Pick best prefix (kWh)
} else if (Unit::IsISTime(units)) {
} else if (Unit::IsSITime(units)) {
// Turn time into ? year + ? month + ? day + ? h + ? min + ? s
double value = Shared::PoincareHelpers::ApproximateToScalar<double>(copy, App::app()->localContext());
m_memoizedExpressions[numberOfMemoizedExpressions++] = Unit::BuildTimeSplit(value, App::app()->localContext(), Preferences::sharedPreferences()->complexFormat(), Preferences::sharedPreferences()->angleUnit());

View File

@@ -258,13 +258,13 @@ Calculation::AdditionalInformationType Calculation::additionalInformationType(Co
Expression unit;
PoincareHelpers::Reduce(&o, App::app()->localContext(), ExpressionNode::ReductionTarget::User,ExpressionNode::SymbolicComputation::ReplaceAllSymbolsWithDefinitionsOrUndefined, ExpressionNode::UnitConversion::None);
o = o.removeUnit(&unit);
if (Unit::IsIS(unit)) {
if (Unit::IsISSpeed(unit) || Unit::IsISVolume(unit) || Unit::IsISEnergy(unit)) {
if (Unit::IsSI(unit)) {
if (Unit::IsSISpeed(unit) || Unit::IsSIVolume(unit) || Unit::IsSIEnergy(unit)) {
/* All these units will provide misc. classic representatives in
* addition to the SI unit in additional information. */
return AdditionalInformationType::Unit;
}
if (Unit::IsISTime(unit)) {
if (Unit::IsSITime(unit)) {
/* If the number of seconds is above 60s, we can write it in the form
* of an addition: 23_min + 12_s for instance. */
double value = Shared::PoincareHelpers::ApproximateToScalar<double>(o, App::app()->localContext());

View File

@@ -39,8 +39,8 @@ MicroPythonVersion = "Version de µPython"
DefaultResult = "Étendue "
CompactResult = "Compact "
FontSizes = "Police Python"
LargeFont = "Grand "
SmallFont = "Petit "
LargeFont = "Grande "
SmallFont = "Petite "
SerialNumber = "Numéro de série"
UpdatePopUp = "Rappel de mise à jour"
BetaPopUp = "Rappel de version bêta"

View File

@@ -4,7 +4,7 @@ PLATFORM ?= device
DEBUG ?= 0
HOME_DISPLAY_EXTERNALS ?= 1
EPSILON_VERSION ?= 14.4.0
EPSILON_VERSION ?= 14.4.1
OMEGA_VERSION ?= 1.20.0
# USERNAME ?= N/A
EPSILON_APPS ?= calculation rpn graph code statistics probability solver atom sequence regression settings external

View File

@@ -797,11 +797,11 @@ public:
static Unit Watt() { return Builder(PowerDimension, WattRepresentative, &EmptyPrefix); }
static Expression BuildTimeSplit(double seconds, Context * context, Preferences::ComplexFormat complexFormat, Preferences::AngleUnit angleUnit);
static bool IsIS(Expression & e);
static bool IsISSpeed(Expression & e);
static bool IsISVolume(Expression & e);
static bool IsISEnergy(Expression & e);
static bool IsISTime(Expression & e);
static bool IsSI(Expression & e);
static bool IsSISpeed(Expression & e);
static bool IsSIVolume(Expression & e);
static bool IsSIEnergy(Expression & e);
static bool IsSITime(Expression & e);
bool isMeter() const;
bool isSecond() const;
bool isKilogram() const;
@@ -821,7 +821,7 @@ private:
static constexpr double MonthPerYear = 12.0;
static constexpr double DaysPerMonth = DaysPerYear/MonthPerYear;
UnitNode * node() const { return static_cast<UnitNode *>(Expression::node()); }
bool isIS() const;
bool isSI() const;
static void ChooseBestMultipleForValue(Expression * units, double * value, bool tuneRepresentative, ExpressionNode::ReductionContext reductionContext);
void chooseBestMultipleForValue(double * value, const int exponent, bool tuneRepresentative, ExpressionNode::ReductionContext reductionContext);
Expression removeUnit(Expression * unit);

View File

@@ -424,7 +424,7 @@ bool Unit::isKilogram() const {
return node()->dimension() == MassDimension && node()->representative() == KilogramRepresentative && node()->prefix() == &KiloPrefix;
}
bool Unit::isIS() const {
bool Unit::isSI() const {
UnitNode * unitNode = node();
const Dimension * dim = unitNode->dimension();
const Representative * rep = unitNode->representative();
@@ -433,12 +433,12 @@ bool Unit::isIS() const {
unitNode->prefix() == dim->stdRepresentativePrefix();
}
bool Unit::IsIS(Expression & e) {
bool Unit::IsSI(Expression & e) {
if (e.type() == ExpressionNode::Type::Multiplication) {
for (int i = 0; i < e.numberOfChildren(); i++) {
Expression child = e.childAtIndex(i);
assert(child.type() == ExpressionNode::Type::Power || child.type() == ExpressionNode::Type::Unit);
if (!IsIS(child)) {
if (!IsSI(child)) {
return false;
}
}
@@ -448,13 +448,13 @@ bool Unit::IsIS(Expression & e) {
assert(e.childAtIndex(1).type() == ExpressionNode::Type::Rational && e.childAtIndex(1).convert<Rational>().isInteger());
Expression child = e.childAtIndex(0);
assert(child.type() == ExpressionNode::Type::Unit);
return IsIS(child);
return IsSI(child);
}
assert(e.type() == ExpressionNode::Type::Unit);
return static_cast<Unit &>(e).isIS();
return static_cast<Unit &>(e).isSI();
}
bool Unit::IsISSpeed(Expression & e) {
bool Unit::IsSISpeed(Expression & e) {
// Form m*s^-1
return e.type() == ExpressionNode::Type::Multiplication && e.numberOfChildren() == 2 &&
e.childAtIndex(0).type() == ExpressionNode::Type::Unit && e.childAtIndex(0).convert<Unit>().isMeter() &&
@@ -463,14 +463,14 @@ bool Unit::IsISSpeed(Expression & e) {
e.childAtIndex(1).childAtIndex(0).type() == ExpressionNode::Type::Unit && e.childAtIndex(1).childAtIndex(0).convert<Unit>().isSecond();
}
bool Unit::IsISVolume(Expression & e) {
bool Unit::IsSIVolume(Expression & e) {
// Form m^3
return e.type() == ExpressionNode::Type::Power &&
e.childAtIndex(0).type() == ExpressionNode::Type::Unit && e.childAtIndex(0).convert<Unit>().isMeter() &&
e.childAtIndex(1).type() == ExpressionNode::Type::Rational && e.childAtIndex(1).convert<const Rational>().isThree();
}
bool Unit::IsISEnergy(Expression & e) {
bool Unit::IsSIEnergy(Expression & e) {
// Form _kg*_m^2*_s^-2
return e.type() == ExpressionNode::Type::Multiplication && e.numberOfChildren() == 3 &&
e.childAtIndex(0).type() == ExpressionNode::Type::Unit && e.childAtIndex(0).convert<Unit>().isKilogram() &&
@@ -482,7 +482,7 @@ bool Unit::IsISEnergy(Expression & e) {
e.childAtIndex(2).childAtIndex(1).type() == ExpressionNode::Type::Rational && e.childAtIndex(2).childAtIndex(1).convert<const Rational>().isMinusTwo();
}
bool Unit::IsISTime(Expression & e) {
bool Unit::IsSITime(Expression & e) {
return e.type() == ExpressionNode::Type::Unit && static_cast<Unit &>(e).isSecond();
}

View File

@@ -420,22 +420,22 @@ QUIZ_CASE(poincare_expression_unit_helper) {
// 2. Speed
Expression meterPerSecond = extract_unit("_m×_s^-1");
quiz_assert(Unit::IsISSpeed(meterPerSecond));
quiz_assert(Unit::IsSISpeed(meterPerSecond));
// 3. Volume
Expression meter3 = extract_unit("_m^3");
quiz_assert(Unit::IsISVolume(meter3));
quiz_assert(Unit::IsSIVolume(meter3));
// 4. Energy
Expression kilogramMeter2PerSecond2 = extract_unit("_kg×_m^2×_s^-2");
quiz_assert(Unit::IsISEnergy(kilogramMeter2PerSecond2));
quiz_assert(Unit::IsSIEnergy(kilogramMeter2PerSecond2));
Expression kilogramMeter3PerSecond2 = extract_unit("_kg×_m^3×_s^-2");
quiz_assert(!Unit::IsISEnergy(kilogramMeter3PerSecond2));
quiz_assert(!Unit::IsSIEnergy(kilogramMeter3PerSecond2));
// 5. International System
quiz_assert(Unit::IsIS(kilogramMeter2PerSecond2));
quiz_assert(Unit::IsIS(meter3));
quiz_assert(Unit::IsIS(meterPerSecond));
quiz_assert(Unit::IsSI(kilogramMeter2PerSecond2));
quiz_assert(Unit::IsSI(meter3));
quiz_assert(Unit::IsSI(meterPerSecond));
Expression joule = extract_unit("_J");
quiz_assert(!Unit::IsIS(joule));
quiz_assert(!Unit::IsSI(joule));
}