void Module::SetAssignmentFor(Model* sbmlmod, const Variable* var) { char cc = g_registry.GetCC(); formula_type ftype = var->GetFormulaType(); const Formula* formula = var->GetFormula(); if (!formula->IsEmpty()) { ASTNode* math = parseStringToASTNode(formula->ToSBMLString()); if (ftype == formulaASSIGNMENT) { AssignmentRule* ar = sbmlmod->createAssignmentRule(); ar->setVariable(var->GetNameDelimitedBy(cc)); ar->setMath(math); } else if (!formula->IsDouble() && !(IsSpecies(var->GetType()) && formula->IsAmountIn(var->GetCompartment()))) { //if it was a double or a species with an amount, we already dealt with it. Otherwise: InitialAssignment* ia = sbmlmod->createInitialAssignment(); ia->setSymbol(var->GetNameDelimitedBy(cc)); ia->setMath(math); } delete math; } if (ftype == formulaRATE) { formula = var->GetRateRule(); if (!formula->IsEmpty()) { ASTNode* math = parseStringToASTNode(var->GetRateRule()->ToSBMLString()); RateRule* rr = sbmlmod->createRateRule(); rr->setVariable(var->GetNameDelimitedBy(cc)); rr->setMath(math); delete math; } } }
END_TEST START_TEST ( test_RateRule ) { RateRule* r = new RateRule(2, 4); fail_unless (!(r->hasRequiredAttributes())); r->setVariable("r"); fail_unless (r->hasRequiredAttributes()); delete r; }