Exemple #1
0
 public void setUp()
 {
     R = new  Reaction(2,4);
       if (R == null);
       {
       }
 }
Exemple #2
0
 public void test_KineticLaw_getParameterById()
 {
     Parameter k1 = new  Parameter(2,4);
       Parameter k2 = new  Parameter(2,4);
       k1.setId( "k1");
       k2.setId( "k2");
       k1.setValue(3.14);
       k2.setValue(2.72);
       M.addParameter(k1);
       M.addParameter(k2);
       Reaction r1 = new  Reaction(2,4);
       r1.setId( "reaction_1" );
       KineticLaw kl = new  KineticLaw(2,4);
       kl.setFormula( "k1 * X0");
       Parameter k3 = new  Parameter(2,4);
       Parameter k4 = new  Parameter(2,4);
       k3.setId( "k1");
       k4.setId( "k2");
       k3.setValue(2.72);
       k4.setValue(3.14);
       kl.addParameter(k3);
       kl.addParameter(k4);
       r1.setKineticLaw(kl);
       M.addReaction(r1);
       KineticLaw kl1 = M.getReaction(0).getKineticLaw();
       assertNotEquals(kl1.getParameter( "k1" ),k3);
       assertNotEquals(kl1.getParameter( "k1" ),k1);
       assertNotEquals(kl1.getParameter( "k2" ),k4);
       assertEquals(kl1.getParameter( "k3" ),null);
 }
 public void test_Reaction_addProduct1()
 {
     Reaction m = new  Reaction(2,2);
       SpeciesReference p = new  SpeciesReference(2,2);
       SpeciesReference p1 = new  SpeciesReference(2,2);
       p1.setSpecies( "k");
       p1.setId( "k1");
       int i = m.addProduct(p);
       assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
       p.setSpecies( "k");
       p.setId( "k1");
       i = m.addProduct(p);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( m.getNumProducts() == 1 );
       i = m.addProduct(p1);
       assertTrue( i == libsbml.LIBSBML_DUPLICATE_OBJECT_ID );
       assertTrue( m.getNumProducts() == 1 );
       p = null;
       p1 = null;
       m = null;
 }
Exemple #4
0
 public void test_Model_addReaction()
 {
     Reaction r = new  Reaction(2,4);
       r.setId( "r");
       M.addReaction(r);
       assertTrue( M.getNumReactions() == 1 );
 }
 public void test_Model_addReaction3()
 {
     Model m = new  Model(2,2);
       Reaction r = new  Reaction(1,2);
       r.setId( "r");
       int i = m.addReaction(r);
       assertTrue( i == libsbml.LIBSBML_LEVEL_MISMATCH );
       assertTrue( m.getNumReactions() == 0 );
       r = null;
       m = null;
 }
 /**
    * Copy constructor; creates a copy of this Reaction.
    *
    * @param orig the object to copy.
    */
 public Reaction(Reaction orig)
     : this(libsbmlPINVOKE.new_Reaction__SWIG_2(Reaction.getCPtr(orig)), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
 }
 internal static HandleRef getCPtr(Reaction obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
 public void test_internal_consistency_check_99904_react()
 {
     SBMLDocument d = new SBMLDocument(2,4);
       long errors;
       Reaction r = new Reaction(2,4);
       d.setLevelAndVersion(1,2,false);
       Model m = d.createModel();
       Compartment c = m.createCompartment();
       c.setId("cc");
       r.setId("r");
       r.setMetaId("mmm");
       m.addReaction(r);
       errors = d.checkInternalConsistency();
       assertTrue( errors == 0 );
       d = null;
 }
 public void test_Reaction_copyConstructor()
 {
     Reaction o1 = new Reaction(2,4);
       o1.setId("c");
       assertTrue( o1.getId() ==  "c" );
       KineticLaw kl = new KineticLaw(2,4);
       o1.setKineticLaw(kl);
       kl = null;
       assertTrue( o1.isSetKineticLaw() == true );
       assertNotEquals(o1.getKineticLaw(),null);
       Reaction o2 = new Reaction(o1);
       assertTrue( o2.getId() ==  "c" );
       assertTrue( o2.isSetKineticLaw() == true );
       assertNotEquals(o2.getKineticLaw(),null);
       assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() );
       o2 = null;
       o1 = null;
 }
 public void test_Reaction()
 {
     Reaction r = new Reaction(2,4);
       assertEquals( true, r.hasRequiredElements() );
       r = null;
 }
Exemple #11
0
 public void test_L3_Reaction_createWithNS()
 {
     XMLNamespaces xmlns = new  XMLNamespaces();
       xmlns.add( "http://www.sbml.org", "testsbml");
       SBMLNamespaces sbmlns = new  SBMLNamespaces(3,1);
       sbmlns.addNamespaces(xmlns);
       Reaction r = new  Reaction(sbmlns);
       assertTrue( r.getTypeCode() == libsbml.SBML_REACTION );
       assertTrue( r.getMetaId() == "" );
       assertTrue( r.getNotes() == null );
       assertTrue( r.getAnnotation() == null );
       assertTrue( r.getLevel() == 3 );
       assertTrue( r.getVersion() == 1 );
       assertTrue( r.getNamespaces() != null );
       assertTrue( r.getNamespaces().getLength() == 2 );
       assertTrue( r.getId() == "" );
       assertTrue( r.getName() == "" );
       assertTrue( r.getCompartment() == "" );
       assertTrue( r.getFast() == false );
       assertTrue( r.getReversible() == true );
       assertEquals( false, r.isSetId() );
       assertEquals( false, r.isSetName() );
       assertEquals( false, r.isSetCompartment() );
       assertEquals( false, r.isSetFast() );
       assertEquals( false, r.isSetReversible() );
       r = null;
 }
Exemple #12
0
 public void test_L3_Reaction_hasRequiredAttributes()
 {
     Reaction r = new  Reaction(3,1);
       assertEquals( false, r.hasRequiredAttributes() );
       r.setId( "id");
       assertEquals( false, r.hasRequiredAttributes() );
       r.setFast(false);
       assertEquals( false, r.hasRequiredAttributes() );
       r.setReversible(false);
       assertEquals( true, r.hasRequiredAttributes() );
       r = null;
 }
Exemple #13
0
 public void test_Model_getSpeciesReferenceById()
 {
     Reaction r1 = new  Reaction(2,4);
       r1.setId( "r1");
       SpeciesReference sr = r1.createReactant();
       sr.setId( "s1");
       M.addReaction(r1);
       assertTrue( M.getNumReactions() == 1 );
       assertNotEquals(M.getSpeciesReference( "s1" ),sr);
 }
Exemple #14
0
 public void test_Model_getReactionById()
 {
     Reaction r1 = new  Reaction(2,4);
       Reaction r2 = new  Reaction(2,4);
       r1.setId( "reaction_1" );
       r2.setId( "reaction_2" );
       M.addReaction(r1);
       M.addReaction(r2);
       assertTrue( M.getNumReactions() == 2 );
       assertNotEquals(M.getReaction( "reaction_1" ),r1);
       assertNotEquals(M.getReaction( "reaction_2" ),r2);
       assertEquals(M.getReaction( "reaction_3" ),null);
 }
Exemple #15
0
 public void test_Model_getReaction()
 {
     Reaction r1 = new  Reaction(2,4);
       Reaction r2 = new  Reaction(2,4);
       r1.setId( "reaction_1");
       r2.setId( "reaction_2");
       M.addReaction(r1);
       M.addReaction(r2);
       assertTrue( M.getNumReactions() == 2 );
       r1 = M.getReaction(0);
       r2 = M.getReaction(1);
       assertTrue((  "reaction_1" == r1.getId() ));
       assertTrue((  "reaction_2" == r2.getId() ));
 }
 public void test_Reaction_addProduct3()
 {
     Reaction m = new  Reaction(2,2);
       SpeciesReference p = new  SpeciesReference(1,2);
       p.setSpecies( "k");
       int i = m.addProduct(p);
       assertTrue( i == libsbml.LIBSBML_LEVEL_MISMATCH );
       assertTrue( m.getNumProducts() == 0 );
       p = null;
       m = null;
 }
Exemple #17
0
 public void test_Reaction_createWithNS()
 {
     XMLNamespaces xmlns = new  XMLNamespaces();
       xmlns.add( "http://www.sbml.org", "testsbml");
       SBMLNamespaces sbmlns = new  SBMLNamespaces(2,1);
       sbmlns.addNamespaces(xmlns);
       Reaction object1 = new  Reaction(sbmlns);
       assertTrue( object1.getTypeCode() == libsbml.SBML_REACTION );
       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_Reaction_addReactant2()
 {
     Reaction m = new  Reaction(2,2);
       SpeciesReference p = new  SpeciesReference(2,1);
       p.setSpecies( "k");
       int i = m.addReactant(p);
       assertTrue( i == libsbml.LIBSBML_VERSION_MISMATCH );
       assertTrue( m.getNumReactants() == 0 );
       p = null;
       m = null;
 }
Exemple #19
0
 public void tearDown()
 {
     R = null;
 }
 public void test_Reaction_addReactant4()
 {
     Reaction m = new  Reaction(2,2);
       SpeciesReference p = null;
       int i = m.addReactant(p);
       assertTrue( i == libsbml.LIBSBML_OPERATION_FAILED );
       assertTrue( m.getNumReactants() == 0 );
       m = null;
 }
Exemple #21
0
 /**
    * Adds a copy of the given Reaction object to this Model.
    *
    * @param r the Reaction object to add
    *
    * @return integer value indicating success/failure of the
    * function.  The possible values
    * returned by this function are:
    * @li @link libsbmlcs.libsbml.LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS @endlink
    * @li @link libsbmlcs.libsbml.LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH @endlink
    * @li @link libsbmlcs.libsbml.LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH @endlink
    * @li @link libsbmlcs.libsbml.LIBSBML_DUPLICATE_OBJECT_ID LIBSBML_DUPLICATE_OBJECT_ID @endlink
    * @li @link libsbmlcs.libsbml.LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT @endlink
    * @li @link libsbmlcs.libsbml.LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED @endlink
    *
    * *
  * @note This method should be used with some caution.  The fact that this
  * method @em copies the object passed to it means that the caller will be
  * left holding a physically different object instance than the one contained
  * inside this object.  Changes made to the original object instance (such as
  * resetting attribute values) will <em>not affect the instance in this
  * object</em>.  In addition, the caller should make sure to free the
  * original object if it is no longer being used, or else a memory leak will
  * result.  Please see other methods on this class (particularly a
  * corresponding method whose name begins with the word <code>create</code>)
  * for alternatives that do not lead to these issues.
  *
  *
    *
    * @see createReaction()
    */
 public int addReaction(Reaction r)
 {
     int ret = libsbmlPINVOKE.Model_addReaction(swigCPtr, Reaction.getCPtr(r));
     return ret;
 }
 public void test_Reaction_createKineticLaw()
 {
     Reaction r = new  Reaction(2,2);
       KineticLaw kl = r.createKineticLaw();
       assertTrue( r.isSetKineticLaw() == true );
       assertTrue( (kl).getLevel() == 2 );
       assertTrue( (kl).getVersion() == 2 );
       r = null;
 }
 public void test_internal_consistency_check_99911_react()
 {
     SBMLDocument d = new SBMLDocument(2,4);
       long errors;
       Model m = d.createModel();
       Reaction r = new Reaction(2,4);
       d.setLevelAndVersion(2,1,false);
       r.setId("r");
       r.setSBOTerm(2);
       m.addReaction(r);
       errors = d.checkInternalConsistency();
       assertTrue( errors == 0 );
       d = null;
 }
 public void test_Reaction_createReactant()
 {
     Reaction m = new  Reaction(2,2);
       SpeciesReference p = m.createReactant();
       assertTrue( m.getNumReactants() == 1 );
       assertTrue( (p).getLevel() == 2 );
       assertTrue( (p).getVersion() == 2 );
       m = null;
 }
        internal static HandleRef getCPtrAndDisown(Reaction obj)
        {
            HandleRef ptr = new HandleRef(null, IntPtr.Zero);

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

            return ptr;
        }
 public void test_Reaction_setFast2()
 {
     Reaction R1 = new  Reaction(2,4);
       int i = R1.unsetFast();
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( R1.getFast() == false );
       assertEquals( false, R1.isSetFast() );
 }
 public void test_Model_addReaction1()
 {
     Model m = new  Model(2,2);
       Reaction r = new  Reaction(2,2);
       int i = m.addReaction(r);
       assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
       r.setId( "r");
       i = m.addReaction(r);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( m.getNumReactions() == 1 );
       r = null;
       m = null;
 }
 public void test_Reaction_setName3()
 {
     Reaction p = new  Reaction(2,2);
       int i = p.setName("");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertEquals( false, p.isSetName() );
       p = null;
 }
 public void test_Model_addReaction5()
 {
     Model m = new  Model(2,2);
       Reaction r = new  Reaction(2,2);
       r.setId( "r");
       Reaction r1 = new  Reaction(2,2);
       r1.setId( "r");
       int i = m.addReaction(r);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( m.getNumReactions() == 1 );
       i = m.addReaction(r1);
       assertTrue( i == libsbml.LIBSBML_DUPLICATE_OBJECT_ID );
       assertTrue( m.getNumReactions() == 1 );
       r = null;
       r1 = null;
       m = null;
 }
        public void test_Reaction_constructor()
        {
            SBase s;

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

              string msg = "";

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