[apps/graph] Handle undefined function

Change-Id: Id26e0f81ba5c1446655f33b2c63f97ab5b684e41
This commit is contained in:
Émilie Feral
2016-10-20 16:00:11 +02:00
parent 5693b9f95f
commit e5ff8f65c3
10 changed files with 66 additions and 18 deletions

View File

@@ -99,9 +99,9 @@ int ValuesController::numberOfRows() {
int ValuesController::numberOfColumns() {
int result = 1;
for (int i = 0; i < m_functionStore->numberOfFunctions(); i++) {
if (m_functionStore->functionAtIndex(i)->isActive()) {
result += 1 + m_functionStore->functionAtIndex(i)->displayDerivative();
for (int i = 0; i < m_functionStore->numberOfDefinedFunctions(); i++) {
if (m_functionStore->definedFunctionAtIndex(i)->isActive()) {
result += 1 + m_functionStore->definedFunctionAtIndex(i)->displayDerivative();
}
}
return result;
@@ -426,15 +426,15 @@ void ValuesController::willDisplayCellAtLocation(View * cell, int i, int j) {
Function * ValuesController::functionAtColumn(int i) {
assert(i > 0);
int index = 1;
for (int k = 0; k < m_functionStore->numberOfFunctions(); k++) {
if (m_functionStore->functionAtIndex(k)->isActive()) {
for (int k = 0; k < m_functionStore->numberOfDefinedFunctions(); k++) {
if (m_functionStore->definedFunctionAtIndex(k)->isActive()) {
if (i == index) {
return m_functionStore->functionAtIndex(k);
return m_functionStore->definedFunctionAtIndex(k);
}
index++;
if (m_functionStore->functionAtIndex(k)->displayDerivative()) {
if (m_functionStore->definedFunctionAtIndex(k)->displayDerivative()) {
if (i == index) {
return m_functionStore->functionAtIndex(k);
return m_functionStore->definedFunctionAtIndex(k);
}
index++;
}
@@ -447,13 +447,13 @@ Function * ValuesController::functionAtColumn(int i) {
bool ValuesController::isDerivativeColumn(int i) {
assert(i >= 1);
int index = 1;
for (int k = 0; k < m_functionStore->numberOfFunctions(); k++) {
if (m_functionStore->functionAtIndex(k)->isActive()) {
for (int k = 0; k < m_functionStore->numberOfDefinedFunctions(); k++) {
if (m_functionStore->definedFunctionAtIndex(k)->isActive()) {
if (i == index) {
return false;
}
index++;
if (m_functionStore->functionAtIndex(k)->displayDerivative()) {
if (m_functionStore->definedFunctionAtIndex(k)->displayDerivative()) {
if (i == index) {
return true;
}