本文整理汇总了C#中libsbmlcs.Model.getNumRules方法的典型用法代码示例。如果您正苦于以下问题:C# Model.getNumRules方法的具体用法?C# Model.getNumRules怎么用?C# Model.getNumRules使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libsbmlcs.Model
的用法示例。
在下文中一共展示了Model.getNumRules方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: test_Model_createRule
public void test_Model_createRule()
{
Model m = new Model(2,2);
Rule p = m.createAssignmentRule();
assertTrue( m.getNumRules() == 1 );
assertTrue( (p).getLevel() == 2 );
assertTrue( (p).getVersion() == 2 );
m = null;
}
示例2: printMath
private static void printMath(Model m)
{
int n;
for (n = 0; n < m.getNumFunctionDefinitions(); ++n)
{
printFunctionDefinition(n + 1, m.getFunctionDefinition(n));
}
for (n = 0; n < m.getNumRules(); ++n)
{
printRuleMath(n + 1, m.getRule(n));
}
Console.WriteLine();
for (n = 0; n < m.getNumReactions(); ++n)
{
printReactionMath(n + 1, m.getReaction(n));
}
Console.WriteLine();
for (n = 0; n < m.getNumEvents(); ++n)
{
printEventMath(n + 1, m.getEvent(n));
}
}
示例3: test_Model_addRule4
public void test_Model_addRule4()
{
Model m = new Model(2,2);
Rule r = null;
int i = m.addRule(r);
assertTrue( i == libsbml.LIBSBML_OPERATION_FAILED );
assertTrue( m.getNumRules() == 0 );
m = null;
}
示例4: test_Model_addRule5
public void test_Model_addRule5()
{
Model m = new Model(2,2);
Rule ar = new AssignmentRule(2,2);
ar.setVariable( "ar");
ar.setMath(libsbml.parseFormula("a-j"));
Rule ar1 = new AssignmentRule(2,2);
ar1.setVariable( "ar");
ar1.setMath(libsbml.parseFormula("a-j"));
int i = m.addRule(ar);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue( m.getNumRules() == 1 );
i = m.addRule(ar1);
assertTrue( i == libsbml.LIBSBML_DUPLICATE_OBJECT_ID );
assertTrue( m.getNumRules() == 1 );
ar = null;
ar1 = null;
m = null;
}
示例5: test_Model_addRule1
public void test_Model_addRule1()
{
Model m = new Model(2,2);
Rule r = new AssignmentRule(2,2);
int i = m.addRule(r);
assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
r.setVariable( "f");
i = m.addRule(r);
assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
r.setMath(libsbml.parseFormula("a-n"));
i = m.addRule(r);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue( m.getNumRules() == 1 );
r = null;
m = null;
}
示例6: test_Model_addRule3
public void test_Model_addRule3()
{
Model m = new Model(2,2);
Rule r = new AssignmentRule(1,2);
r.setVariable( "f");
r.setMath(libsbml.parseFormula("a-n"));
int i = m.addRule(r);
assertTrue( i == libsbml.LIBSBML_LEVEL_MISMATCH );
assertTrue( m.getNumRules() == 0 );
r = null;
m = null;
}
示例7: test_ReadSBML_CompartmentVolumeRule
public void test_ReadSBML_CompartmentVolumeRule()
{
Rule cvr;
string s = wrapSBML_L1v2("<listOfRules>" +
" <compartmentVolumeRule compartment='A' formula='0.10 * t'/>" +
"</listOfRules>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue( M.getNumRules() == 1 );
cvr = M.getRule(0);
assertEquals( true, cvr.isCompartmentVolume() );
assertTrue(( "A" == cvr.getVariable() ));
assertTrue(( "0.10 * t" == cvr.getFormula() ));
assertTrue( cvr.getType() == libsbml.RULE_TYPE_SCALAR );
}
示例8: test_ReadSBML_AlgebraicRule
public void test_ReadSBML_AlgebraicRule()
{
Rule ar;
string s = wrapSBML_L1v2("<listOfRules>" +
" <algebraicRule formula='x + 1'/>" +
"</listOfRules>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue( M.getNumRules() == 1 );
ar = M.getRule(0);
assertTrue(( "x + 1" == ar.getFormula() ));
}
示例9: test_ReadSBML_AssignmentRule
public void test_ReadSBML_AssignmentRule()
{
Rule ar;
ASTNode math;
string formula;
string s = wrapSBML_L2v1("<listOfRules>" +
" <assignmentRule variable='k'>" +
" <math>" +
" <apply>" +
" <divide/>" +
" <ci> k3 </ci>" +
" <ci> k2 </ci>" +
" </apply>" +
" </math>" +
" </assignmentRule>" +
"</listOfRules>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue( M.getNumRules() == 1 );
ar = M.getRule(0);
assertTrue( ar != null );
assertEquals( true, ar.isSetMath() );
math = ar.getMath();
formula = ar.getFormula();
assertTrue( formula != null );
assertTrue(( "k3 / k2" == formula ));
}
示例10: test_ReadSBML_SpeciesConcentrationRule
public void test_ReadSBML_SpeciesConcentrationRule()
{
Rule scr;
string s = wrapSBML_L1v2("<listOfRules>" +
" <speciesConcentrationRule species='s2' formula='k * t/(1 + k)'/>" +
"</listOfRules>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue( M.getNumRules() == 1 );
scr = M.getRule(0);
assertEquals( true, scr.isSpeciesConcentration() );
assertTrue(( "s2" == scr.getVariable() ));
assertTrue(( "k * t/(1 + k)" == scr.getFormula() ));
assertTrue( scr.getType() == libsbml.RULE_TYPE_SCALAR );
}
示例11: test_ReadSBML_RateRule
public void test_ReadSBML_RateRule()
{
Rule rr;
ASTNode math;
string formula;
string s = wrapSBML_L2v1("<listOfRules>" +
" <rateRule variable='x'>" +
" <math>" +
" <apply>" +
" <times/>" +
" <apply>" +
" <minus/>" +
" <cn> 1 </cn>" +
" <ci> x </ci>" +
" </apply>" +
" <apply>" +
" <ln/>" +
" <ci> x </ci>" +
" </apply>" +
" </apply>" +
" </math>" +
" </rateRule>" +
"</listOfRules>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue( M.getNumRules() == 1 );
rr = M.getRule(0);
assertTrue( rr != null );
assertEquals( true, rr.isSetMath() );
math = rr.getMath();
formula = rr.getFormula();
assertTrue( formula != null );
assertTrue(( "(1 - x) * log(x)" == formula ));
}
示例12: test_ReadSBML_ParameterRule
public void test_ReadSBML_ParameterRule()
{
Rule pr;
string s = wrapSBML_L1v2("<listOfRules>" +
" <parameterRule name='k' formula='k3/k2'/>" +
"</listOfRules>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue( M.getNumRules() == 1 );
pr = M.getRule(0);
assertEquals( true, pr.isParameter() );
assertTrue(( "k" == pr.getVariable() ));
assertTrue(( "k3/k2" == pr.getFormula() ));
assertTrue( pr.getType() == libsbml.RULE_TYPE_SCALAR );
}
示例13: test_ReadSBML_AlgebraicRule_L2
public void test_ReadSBML_AlgebraicRule_L2()
{
Rule ar;
ASTNode math;
string formula;
string s = wrapSBML_L2v1("<listOfRules>" +
" <algebraicRule>" +
" <math>" +
" <apply>" +
" <minus/>" +
" <apply>" +
" <plus/>" +
" <ci> S1 </ci>" +
" <ci> S2 </ci>" +
" </apply>" +
" <ci> T </ci>" +
" </apply>" +
" </math>" +
" </algebraicRule>" +
"</listOfRules>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue( M.getNumRules() == 1 );
ar = M.getRule(0);
assertTrue( ar != null );
assertEquals( true, ar.isSetMath() );
math = ar.getMath();
formula = ar.getFormula();
assertTrue( formula != null );
assertTrue(( "S1 + S2 - T" == formula ));
}