예제 #1
0
 public void test_Rule_copyConstructor()
 {
     Rule o1 = new RateRule(2,1);
       o1.setVariable("a");
       assertTrue( o1.getVariable() ==  "a" );
       ASTNode node = new ASTNode(libsbml.AST_CONSTANT_PI);
       o1.setMath(node);
       node = null;
       assertTrue( o1.isSetMath() == true );
       Rule o2 = new Rule(o1);
       assertTrue( o2.getVariable() ==  "a" );
       assertTrue( o2.isSetMath() == true );
       assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() );
       o2 = null;
       o1 = null;
 }
예제 #2
0
 public void test_RateRule()
 {
     RateRule r = new RateRule(2,4);
       assertEquals( false, (r.hasRequiredElements()) );
       r.setMath(libsbml.parseFormula("ar"));
       assertEquals( true, r.hasRequiredElements() );
       r = null;
 }
예제 #3
0
 public void test_Rule_parent_add()
 {
     Rule ia = new RateRule(2,4);
       ia.setVariable("a");
       ia.setMath(libsbml.parseFormula("9"));
       Model m = new Model(2,4);
       m.addRule(ia);
       ia = null;
       ListOf lo = m.getListOfRules();
       assertTrue( lo == m.getRule(0).getParentSBMLObject() );
       assertTrue( m == lo.getParentSBMLObject() );
 }
예제 #4
0
 public void test_Model_addRules()
 {
     Rule r1 = new  AlgebraicRule(2,4);
       Rule r2 = new  AssignmentRule(2,4);
       Rule r3 = new  RateRule(2,4);
       r2.setVariable( "r2");
       r3.setVariable( "r3");
       r1.setMath(libsbml.parseFormula("2"));
       r2.setMath(libsbml.parseFormula("2"));
       r3.setMath(libsbml.parseFormula("2"));
       M.addRule(r1);
       M.addRule(r2);
       M.addRule(r3);
       assertTrue( M.getNumRules() == 3 );
 }
예제 #5
0
 public void test_Rule_ancestor_add()
 {
     Rule ia = new RateRule(2,4);
       ia.setVariable("a");
       ia.setMath(libsbml.parseFormula("9"));
       Model m = new Model(2,4);
       m.addRule(ia);
       ia = null;
       ListOf lo = m.getListOfRules();
       Rule obj = m.getRule(0);
       assertTrue( obj.getAncestorOfType(libsbml.SBML_MODEL) == m );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_LIST_OF) == lo );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_EVENT) == null );
 }