[apps/graph][apps/sequence] In function store model, specify the

implementation of removeAll (always let an empty function in cartesian
functions)

Change-Id: I5e91a0ea427ba823eee4f86cdd8b7cd5426df2c6
This commit is contained in:
Émilie Feral
2017-04-10 10:52:22 +02:00
parent cebd5f69ed
commit b9183eb84d
6 changed files with 18 additions and 7 deletions

View File

@@ -100,4 +100,12 @@ const KDColor CartesianFunctionStore::firstAvailableColor() {
return k_defaultColors[0];
}
void CartesianFunctionStore::removeAll() {
for (int i = 0; i < m_numberOfFunctions; i++) {
m_functions[i] = CartesianFunction("", KDColorBlack);
}
m_numberOfFunctions = 0;
addEmptyFunction();
}
}

View File

@@ -19,6 +19,7 @@ public:
void removeFunction(Shared::Function * f) override;
int maxNumberOfFunctions() override;
char symbol() const override;
void removeAll() override;
static constexpr int k_maxNumberOfFunctions = 8;
private:
const char * firstAvailableName() override;

View File

@@ -93,4 +93,11 @@ const KDColor SequenceStore::firstAvailableColor() {
return k_defaultColors[0];
}
void SequenceStore::removeAll() {
for (int i = 0; i < m_numberOfFunctions; i++) {
m_sequences[i] = Sequence("", KDColorBlack);
}
m_numberOfFunctions = 0;
}
}

View File

@@ -20,6 +20,7 @@ public:
int maxNumberOfFunctions() override;
const char * firstAvailableName() override;
char symbol() const override;
void removeAll() override;
static constexpr int k_maxNumberOfSequences = 3;
private:
const KDColor firstAvailableColor() override;

View File

@@ -62,10 +62,4 @@ int FunctionStore::numberOfDefinedFunctions() {
return result;
}
void FunctionStore::removeAll() {
for (int i = 0; i < numberOfFunctions(); i++) {
removeFunction(functionAtIndex(i));
}
}
}

View File

@@ -18,7 +18,7 @@ public:
virtual Function * definedFunctionAtIndex(int i);
virtual Function * addEmptyFunction() = 0;
virtual void removeFunction(Function * f) = 0;
void removeAll();
virtual void removeAll() = 0;
int numberOfFunctions();
// Functions can be undefined when they have a color and a name but no content
int numberOfDefinedFunctions();