예제 #1
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 );
 }
 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() );
 }
예제 #3
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 );
 }
 public void test_internal_consistency_check_99904_rule_rate()
 {
     SBMLDocument d = new SBMLDocument(2,4);
       long errors;
       Rule r = new RateRule(2,4);
       d.setLevelAndVersion(1,2,false);
       Model m = d.createModel();
       Compartment c = m.createCompartment();
       c.setId("cc");
       c.setConstant(false);
       r.setVariable("cc");
       r.setFormula("2");
       r.setMetaId("mmm");
       m.addRule(r);
       errors = d.checkInternalConsistency();
       assertTrue( errors == 0 );
       d = null;
 }
 public void test_internal_consistency_check_99911_rule_rate()
 {
     SBMLDocument d = new SBMLDocument(2,4);
       long errors;
       Model m = d.createModel();
       Parameter p = m.createParameter();
       p.setId("p");
       p.setConstant(false);
       Rule r = new RateRule(2,4);
       d.setLevelAndVersion(2,1,false);
       r.setVariable("p");
       r.setSBOTerm(2);
       m.addRule(r);
       errors = d.checkInternalConsistency();
       assertTrue( errors == 0 );
       d = null;
 }
 public void test_RateRule_L1()
 {
     RateRule r = new RateRule(1,2);
       assertEquals( false, (r.hasRequiredAttributes()) );
       r.setVariable("r");
       assertEquals( false, (r.hasRequiredAttributes()) );
       r.setFormula("r");
       assertEquals( true, r.hasRequiredAttributes() );
       r = null;
 }
예제 #7
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;
 }