mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/shared] Specifiy the meaning of a defined sequence in sequence/
Change-Id: I082a7f9f9785c12dfedcee070badb4eded66ab89
This commit is contained in:
@@ -161,4 +161,15 @@ Poincare::ExpressionLayout * Sequence::secondInitialConditionName() {
|
||||
return m_secondInitialConditionName;
|
||||
}
|
||||
|
||||
bool Sequence::isDefined() {
|
||||
switch (m_type) {
|
||||
case Type::Explicite:
|
||||
return layout() != nullptr;
|
||||
case Type::SingleRecurrence:
|
||||
return layout() != nullptr && m_firstInitialConditionLayout != nullptr;
|
||||
default:
|
||||
return layout() != nullptr && m_firstInitialConditionLayout != nullptr && m_secondInitialConditionLayout != nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ public:
|
||||
Poincare::ExpressionLayout * definitionName();
|
||||
Poincare::ExpressionLayout * firstInitialConditionName();
|
||||
Poincare::ExpressionLayout * secondInitialConditionName();
|
||||
bool isDefined() override;
|
||||
private:
|
||||
Type m_type;
|
||||
char m_firstInitialConditionText[Shared::Function::k_bodyLength];
|
||||
|
||||
@@ -62,6 +62,10 @@ Poincare::ExpressionLayout * Function::layout() {
|
||||
return m_layout;
|
||||
}
|
||||
|
||||
bool Function::isDefined() {
|
||||
return m_layout != nullptr;
|
||||
}
|
||||
|
||||
bool Function::isActive() {
|
||||
return m_active;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ public:
|
||||
KDColor color() const { return m_color; }
|
||||
Poincare::Expression * expression();
|
||||
Poincare::ExpressionLayout * layout();
|
||||
virtual bool isDefined();
|
||||
bool isActive();
|
||||
void setActive(bool active);
|
||||
void setContent(const char * c);
|
||||
|
||||
@@ -12,7 +12,7 @@ Function * FunctionStore::activeFunctionAtIndex(int i) {
|
||||
assert(i>=0 && i<m_numberOfFunctions);
|
||||
int index = 0;
|
||||
for (int k = 0; k < m_numberOfFunctions; k++) {
|
||||
if (functionAtIndex(k)->isActive() && functionAtIndex(k)->layout() != nullptr) {
|
||||
if (functionAtIndex(k)->isActive() && functionAtIndex(k)->isDefined()) {
|
||||
if (i == index) {
|
||||
return functionAtIndex(k);
|
||||
}
|
||||
@@ -27,7 +27,7 @@ Function * FunctionStore::definedFunctionAtIndex(int i) {
|
||||
assert(i>=0 && i<m_numberOfFunctions);
|
||||
int index = 0;
|
||||
for (int k = 0; k < m_numberOfFunctions; k++) {
|
||||
if (functionAtIndex(k)->layout() != nullptr) {
|
||||
if (functionAtIndex(k)->isDefined()) {
|
||||
if (i == index) {
|
||||
return functionAtIndex(k);
|
||||
}
|
||||
@@ -45,7 +45,7 @@ int FunctionStore::numberOfFunctions() {
|
||||
int FunctionStore::numberOfActiveFunctions() {
|
||||
int result = 0;
|
||||
for (int i = 0; i < m_numberOfFunctions; i++) {
|
||||
if (functionAtIndex(i)->layout() != nullptr && functionAtIndex(i)->isActive()) {
|
||||
if (functionAtIndex(i)->isDefined() && functionAtIndex(i)->isActive()) {
|
||||
result++;
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,7 @@ int FunctionStore::numberOfActiveFunctions() {
|
||||
int FunctionStore::numberOfDefinedFunctions() {
|
||||
int result = 0;
|
||||
for (int i = 0; i < m_numberOfFunctions; i++) {
|
||||
if (functionAtIndex(i)->layout() != nullptr) {
|
||||
if (functionAtIndex(i)->isDefined()) {
|
||||
result++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user