RateRule clone()
        {
            global::System.IntPtr cPtr = libsbmlPINVOKE.RateRule_clone(swigCPtr);
            RateRule ret = (cPtr == global::System.IntPtr.Zero) ? null : new RateRule(cPtr, true);

            return(ret);
        }
        internal static HandleRef getCPtrAndDisown(RateRule obj)
        {
            HandleRef ptr = new HandleRef(null, IntPtr.Zero);

            if (obj != null)
            {
                ptr             = obj.swigCPtr;
                obj.swigCMemOwn = false;
            }

            return(ptr);
        }
Example #3
0
 public void test_RateRule_createWithNS()
 {
     XMLNamespaces xmlns = new  XMLNamespaces();
       xmlns.add( "http://www.sbml.org", "testsbml");
       SBMLNamespaces sbmlns = new  SBMLNamespaces(2,1);
       sbmlns.addNamespaces(xmlns);
       Rule object1 = new  RateRule(sbmlns);
       assertTrue( object1.getTypeCode() == libsbml.SBML_RATE_RULE );
       assertTrue( object1.getMetaId() == "" );
       assertTrue( object1.getNotes() == null );
       assertTrue( object1.getAnnotation() == null );
       assertTrue( object1.getLevel() == 2 );
       assertTrue( object1.getVersion() == 1 );
       assertTrue( object1.getNamespaces() != null );
       assertTrue( object1.getNamespaces().getLength() == 2 );
       object1 = null;
 }
        public void test_RateRule_constructor()
        {
            SBase s;

              try
              {
            s = new RateRule(1,1);
            s = new RateRule(1,2);
            s = new RateRule(2,1);
            s = new RateRule(2,2);
            s = new RateRule(2,3);
            s = new RateRule(2,4);
            s = new RateRule(3,1);
            s = new RateRule(SN11);
            s = new RateRule(SN12);
            s = new RateRule(SN21);
            s = new RateRule(SN22);
            s = new RateRule(SN23);
            s = new RateRule(SN24);
            s = new RateRule(SN31);
              }
              catch (SBMLConstructorException e)
              {
             s = null;
              }
              assertTrue(s != null);

              string msg = "";

              try
              {
            s = new RateRule(9,9);
              }
              catch (SBMLConstructorException e)
              {
             msg = e.Message;
              }
              assertTrue(msg == ErrMsg);

              msg = "";

              try
              {
            s = new RateRule(SN99);
              }
              catch (SBMLConstructorException e)
              {
             msg = e.Message;
              }
              assertTrue(msg == ErrMsg);
        }
 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;
 }
 internal static HandleRef getCPtr(RateRule obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }
 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() );
 }
 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;
 }
Example #10
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_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;
 }
Example #12
0
        internal static HandleRef getCPtrAndDisown(RateRule obj)
        {
            HandleRef ptr = new HandleRef(null, IntPtr.Zero);

            if (obj != null)
            {
            ptr             = obj.swigCPtr;
            obj.swigCMemOwn = false;
            }

            return ptr;
        }
Example #13
0
 internal static HandleRef getCPtr(RateRule obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
 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;
 }
 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;
 }