#include "expression_model_store.h" #include "function.h" #include namespace Shared { ExpressionModelStore::ExpressionModelStore() : m_numberOfModels(0) { } ExpressionModel * ExpressionModelStore::addEmptyModel() { assert(m_numberOfModels < maxNumberOfModels()); setModelAtIndex(emptyModel(), m_numberOfModels++); return modelAtIndex(m_numberOfModels-1); } void ExpressionModelStore::removeModel(ExpressionModel * f) { int i = 0; while (modelAtIndex(i) != f && i < m_numberOfModels) { i++; } assert(i>=0 && i=0 && iisDefined()) { if (i == index) { return modelAtIndex(k); } index++; } } assert(false); return nullptr; } int ExpressionModelStore::numberOfDefinedModels() { int result = 0; for (int i = 0; i < m_numberOfModels; i++) { if (modelAtIndex(i)->isDefined()) { result++; } } return result; } void ExpressionModelStore::tidy() { for (int i = 0; i < m_numberOfModels; i++) { modelAtIndex(i)->tidy(); } } }