getNumRules() public method

public getNumRules ( ) : long
return long
 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;
 }
 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;
 }
 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;
 }
 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;
 }
 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;
 }
Example #6
0
 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() ));
 }
Example #7
0
 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 );
 }
Example #8
0
 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 );
 }
Example #9
0
 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 ));
 }
Example #10
0
 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 );
 }
Example #11
0
 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 ));
 }
Example #12
0
 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 ));
 }