Inheritance: libsbml.Rule
Esempio n. 1
0
        AssignmentRule clone()
        {
            IntPtr         cPtr = libsbmlPINVOKE.AssignmentRule_clone(swigCPtr);
            AssignmentRule ret  = (cPtr == IntPtr.Zero) ? null : new AssignmentRule(cPtr, true);

            return(ret);
        }
 public void test_AssignmentRule()
 {
     AssignmentRule r = new AssignmentRule(2,4);
       assertEquals( false, (r.hasRequiredElements()) );
       r.setMath(libsbml.parseFormula("ar"));
       assertEquals( true, r.hasRequiredElements() );
       r = null;
 }
 public void test_AssignmentRule()
 {
     AssignmentRule r = new AssignmentRule(2,4);
       assertEquals( false, (r.hasRequiredAttributes()) );
       r.setVariable("r");
       assertEquals( true, r.hasRequiredAttributes() );
       r = null;
 }
Esempio n. 4
0
        internal static HandleRef getCPtrAndDisown(AssignmentRule obj)
        {
            HandleRef ptr = new HandleRef(null, IntPtr.Zero);

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

            return ptr;
        }
Esempio n. 5
0
        internal static HandleRef getCPtrAndDisown(AssignmentRule obj)
        {
            HandleRef ptr = new HandleRef(null, IntPtr.Zero);

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

            return(ptr);
        }
Esempio n. 6
0
 public void test_AssignmentRule_createWithMath()
 {
     ASTNode math = libsbml.parseFormula("1 + 1");
       Rule ar = new  AssignmentRule(2,4);
       ar.setVariable( "s");
       ar.setMath(math);
       assertTrue( ar.getTypeCode() == libsbml.SBML_ASSIGNMENT_RULE );
       assertTrue( ar.getMetaId() == "" );
       assertTrue((  "s" == ar.getVariable() ));
       assertTrue((  "1 + 1" == ar.getFormula() ));
       assertTrue( ar.getMath() != math );
       ar = null;
 }
Esempio n. 7
0
 public void test_AssignmentRule_createWithFormula()
 {
     ASTNode math;
       string formula;
       Rule ar = new  AssignmentRule(2,4);
       ar.setVariable( "s");
       ar.setFormula( "1 + 1");
       assertTrue( ar.getTypeCode() == libsbml.SBML_ASSIGNMENT_RULE );
       assertTrue( ar.getMetaId() == "" );
       assertTrue((  "s" == ar.getVariable() ));
       math = ar.getMath();
       assertTrue( math != null );
       formula = libsbml.formulaToString(math);
       assertTrue( formula != null );
       assertTrue((  "1 + 1" == formula ));
       assertTrue(( formula == ar.getFormula() ));
       ar = 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_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;
 }
Esempio n. 10
0
 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;
 }
Esempio n. 11
0
 internal static HandleRef getCPtr(AssignmentRule obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }
 public void test_internal_consistency_check_99911_rule_assign()
 {
     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 AssignmentRule(2,4);
       d.setLevelAndVersion(2,1,false);
       r.setVariable("p");
       r.setSBOTerm(2);
       m.addRule(r);
       errors = d.checkInternalConsistency();
       assertTrue( errors == 0 );
       d = null;
 }
Esempio n. 13
0
 public void test_Rule_setUnits4()
 {
     Rule R1 = new  AssignmentRule(1,2);
       R1.setL1TypeCode(libsbml.SBML_PARAMETER_RULE);
       int i = R1.setUnits( "second");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertEquals( true, R1.isSetUnits() );
       i = R1.setUnits("");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertEquals( false, R1.isSetUnits() );
       R1 = null;
 }
Esempio n. 14
0
 public void test_AssignmentRule_createWithNS()
 {
     XMLNamespaces xmlns = new  XMLNamespaces();
       xmlns.add( "http://www.sbml.org", "testsbml");
       SBMLNamespaces sbmlns = new  SBMLNamespaces(2,1);
       sbmlns.addNamespaces(xmlns);
       Rule object1 = new  AssignmentRule(sbmlns);
       assertTrue( object1.getTypeCode() == libsbml.SBML_ASSIGNMENT_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;
 }
Esempio n. 15
0
 public void test_Model_getRules()
 {
     Rule ar = new  AlgebraicRule(2,4);
       Rule scr = new  AssignmentRule(2,4);
       Rule cvr = new  AssignmentRule(2,4);
       Rule pr = new  AssignmentRule(2,4);
       scr.setVariable( "r2");
       cvr.setVariable( "r3");
       pr.setVariable( "r4");
       ar.setFormula( "x + 1"         );
       scr.setFormula( "k * t/(1 + k)" );
       cvr.setFormula( "0.10 * t"      );
       pr.setFormula( "k3/k2"         );
       M.addRule(ar);
       M.addRule(scr);
       M.addRule(cvr);
       M.addRule(pr);
       assertTrue( M.getNumRules() == 4 );
       ar = M.getRule(0);
       scr = M.getRule(1);
       cvr = M.getRule(2);
       pr = M.getRule(3);
       assertTrue((  "x + 1"         == ar.getFormula() ));
       assertTrue((  "k * t/(1 + k)" == scr.getFormula() ));
       assertTrue((  "0.10 * t"      == cvr.getFormula() ));
       assertTrue((  "k3/k2"         == pr.getFormula() ));
 }
Esempio n. 16
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_AssignmentRule_constructor()
        {
            SBase s;

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

              string msg = "";

              try
              {
            s = new AssignmentRule(99,99);
              }
              catch (SBMLConstructorException e)
              {
             msg = e.Message;
              }
              assertTrue(msg == ErrMsg);
        }
Esempio n. 18
0
 internal static HandleRef getCPtr(AssignmentRule obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
 public void test_internal_consistency_check_99904_rule_assign()
 {
     SBMLDocument d = new SBMLDocument(2,4);
       long errors;
       Rule r = new AssignmentRule(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;
 }