Ejemplo n.º 1
0
        StoichiometryMath clone()
        {
            IntPtr            cPtr = libsbmlPINVOKE.StoichiometryMath_clone(swigCPtr);
            StoichiometryMath ret  = (cPtr == IntPtr.Zero) ? null : new StoichiometryMath(cPtr, true);

            return(ret);
        }
Ejemplo n.º 2
0
        StoichiometryMath createStoichiometryMath()
        {
            global::System.IntPtr cPtr = libsbmlPINVOKE.SpeciesReference_createStoichiometryMath(swigCPtr);
            StoichiometryMath     ret  = (cPtr == global::System.IntPtr.Zero) ? null : new StoichiometryMath(cPtr, false);

            return(ret);
        }
Ejemplo n.º 3
0
 public void setUp()
 {
     D = new  StoichiometryMath(2,4);
       if (D == null);
       {
       }
 }
Ejemplo n.º 4
0
 StoichiometryMath(StoichiometryMath orig) : this(libsbmlPINVOKE.new_StoichiometryMath__SWIG_2(StoichiometryMath.getCPtr(orig)), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending)
     {
         throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Ejemplo n.º 5
0
        internal static HandleRef getCPtrAndDisown(StoichiometryMath obj)
        {
            HandleRef ptr = new HandleRef(null, IntPtr.Zero);

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

            return(ptr);
        }
Ejemplo n.º 6
0
 public void test_StoichiometryMath_createWithNS()
 {
     XMLNamespaces xmlns = new  XMLNamespaces();
       xmlns.add( "http://www.sbml.org", "testsbml");
       SBMLNamespaces sbmlns = new  SBMLNamespaces(2,1);
       sbmlns.addNamespaces(xmlns);
       StoichiometryMath object1 = new  StoichiometryMath(sbmlns);
       assertTrue( object1.getTypeCode() == libsbml.SBML_STOICHIOMETRY_MATH );
       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;
 }
 internal static HandleRef getCPtr(StoichiometryMath obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
 /**
    * Copy constructor; creates a copy of this StoichiometryMath.
    *
    * @param orig the object to copy.
    */
 public StoichiometryMath(StoichiometryMath orig)
     : this(libsbmlPINVOKE.new_StoichiometryMath__SWIG_2(StoichiometryMath.getCPtr(orig)), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
 }
 public void test_internal_consistency_check_99905_stoichmath()
 {
     SBMLDocument d = new SBMLDocument(2,4);
       long errors;
       StoichiometryMath sm = new StoichiometryMath(2,4);
       Model m = d.createModel();
       d.setLevelAndVersion(2,2,false);
       Species s = m.createSpecies();
       s.setId("s");
       Compartment c = m.createCompartment();
       c.setId("c");
       s.setCompartment("c");
       Reaction r = m.createReaction();
       r.setId("r");
       SpeciesReference sr = r.createProduct();
       sr.setSpecies("s");
       sm.setSBOTerm(5);
       sr.setStoichiometryMath(sm);
       errors = d.checkInternalConsistency();
       assertTrue( errors == 0 );
       d = null;
 }
Ejemplo n.º 10
0
 public void test_StoichiometryMath()
 {
     StoichiometryMath sm = new StoichiometryMath(2,4);
       assertEquals( true, sm.hasRequiredAttributes() );
       sm = null;
 }
 public void test_SpeciesReference_setStoichiometryMath6()
 {
     StoichiometryMath sm = new  StoichiometryMath(2,1);
       int i = sr.setStoichiometryMath(sm);
       assertTrue( i == libsbml.LIBSBML_VERSION_MISMATCH );
       assertEquals( false, sr.isSetStoichiometryMath() );
       sm = null;
 }
 public void test_SpeciesReference_setStoichiometryMath5()
 {
     SpeciesReference sr1 = new  SpeciesReference(1,2);
       StoichiometryMath sm = new  StoichiometryMath(2,4);
       ASTNode math = new  ASTNode(libsbml.AST_TIMES);
       ASTNode a = new  ASTNode();
       ASTNode b = new  ASTNode();
       a.setName( "a");
       b.setName( "b");
       math.addChild(a);
       math.addChild(b);
       sm.setMath(math);
       int i = sr1.setStoichiometryMath(sm);
       assertTrue( i == libsbml.LIBSBML_UNEXPECTED_ATTRIBUTE );
       assertEquals( false, sr1.isSetStoichiometryMath() );
       sm = null;
       sr1 = null;
 }
 public void test_SpeciesReference_setStoichiometryMath4()
 {
     StoichiometryMath sm = new  StoichiometryMath(2,4);
       ASTNode math = null;
       sm.setMath(math);
       int i = sr.setStoichiometryMath(sm);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertEquals( true, sr.isSetStoichiometryMath() );
       assertTrue( sr.getStoichiometry() == 1 );
       i = sr.unsetStoichiometryMath();
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertEquals( false, sr.isSetStoichiometryMath() );
       sm = null;
 }
 public void test_SpeciesReference_setStoichiometryMath2()
 {
     StoichiometryMath sm = new  StoichiometryMath(2,4);
       ASTNode math = new  ASTNode(libsbml.AST_TIMES);
       ASTNode a = new  ASTNode();
       a.setName( "a");
       math.addChild(a);
       sm.setMath(math);
       int i = sr.setStoichiometryMath(sm);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertEquals( true, sr.isSetStoichiometryMath() );
       sm = null;
 }
Ejemplo n.º 15
0
        internal static HandleRef getCPtrAndDisown(StoichiometryMath obj)
        {
            HandleRef ptr = new HandleRef(null, IntPtr.Zero);

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

            return ptr;
        }
Ejemplo n.º 16
0
 public void test_StoichiometryMath_parent_add()
 {
     StoichiometryMath m = new StoichiometryMath(2,4);
       SpeciesReference sr = new SpeciesReference(2,4);
       sr.setStoichiometryMath(m);
       m = null;
       assertTrue( sr == sr.getStoichiometryMath().getParentSBMLObject() );
       sr = null;
 }
Ejemplo n.º 17
0
 public void test_SpeciesReference_setStoichiometryMath()
 {
     ASTNode math = libsbml.parseFormula("k3 / k2");
       StoichiometryMath stoich = new  StoichiometryMath(2,4);
       stoich.setMath(math);
       StoichiometryMath math1;
       string formula;
       SR.setStoichiometryMath(stoich);
       math1 = SR.getStoichiometryMath();
       assertTrue( math1 != null );
       formula = libsbml.formulaToString(math1.getMath());
       assertTrue( formula != null );
       assertTrue((  "k3 / k2" == formula ));
       assertEquals( true, SR.isSetStoichiometryMath() );
 }
        public void test_StoichiometryMath_constructor()
        {
            SBase s;

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

              string msg = "";

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

              msg = "";
              try
              {
            s = new StoichiometryMath(1,2);
              }
              catch (SBMLConstructorException e)
              {
             msg = e.Message;
              }
              assertTrue(msg == ErrMsg);

              msg = "";
              try
              {
            s = new StoichiometryMath(SN11);
              }
              catch (SBMLConstructorException e)
              {
             msg = e.Message;
              }
              assertTrue(msg == ErrMsg);

              msg = "";
              try
              {
            s = new StoichiometryMath(SN12);
              }
              catch (SBMLConstructorException e)
              {
             msg = e.Message;
              }
              assertTrue(msg == ErrMsg);

              try
              {
            s = new StoichiometryMath(99,99);
              }
              catch (SBMLConstructorException e)
              {
             msg = e.Message;
              }
              assertTrue(msg == ErrMsg);
        }
Ejemplo n.º 19
0
 /**
    * Sets the 'stoichiometryMath' subelement of this SpeciesReference.
    *
    * The Abstract Syntax Tree in @p math is copied.
    *
    * In SBML Level 2, product and reactant stoichiometries can be specified
    * using <em>either</em> 'stoichiometry' or 'stoichiometryMath' in a
    * SpeciesReference object.  The former is to be used when a
    * stoichiometry is simply a scalar number, while the latter is for
    * occasions when it needs to be a rational number or it needs to
    * reference other mathematical expressions.  The 'stoichiometry'
    * attribute is of type @c double and should contain values greater than
    * zero (@c 0).  The 'stoichiometryMath' element is implemented as an
    * element containing a MathML expression.  These two are mutually
    * exclusive; only one of 'stoichiometry' or 'stoichiometryMath' should
    * be defined in a given SpeciesReference instance.  When neither the
    * attribute nor the element is present, the value of 'stoichiometry' in
    * the SpeciesReference instance defaults to @c 1.  For maximum
    * interoperability between different software tools, the 'stoichiometry'
    * attribute should be used in preference to 'stoichiometryMath' when a
    * species' stoichiometry is a simple scalar number (integer or
    * decimal).
    *
    * In SBML Level 3, there is no StoichiometryMath, and SpeciesReference
    * objects have only the 'stoichiometry' attribute.
    *
    * @param math the StoichiometryMath expression that is to be copied as the
    * content of the 'stoichiometryMath' subelement.
    *
    * @note In SBML Level&nbsp;2, the 'stoichiometry' attribute of this
    * SpeciesReference object will be unset (isSetStoichiometry() will
    * return @c false although getStoichiometry() will return @c 1.0) if the
    * given math is not null because the 'stoichiometry' attribute and the
    * stoichiometryMath' subelement are mutually exclusive.
    *
    * @return integer value indicating success/failure of the
    * function.  The possible values
    * returned by this function are:
    * @li @link libsbmlcs#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink
    * @li @link libsbmlcs#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE@endlink
    * @li @link libsbmlcs#LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH@endlink
    * @li @link libsbmlcs#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH@endlink
    */
 public int setStoichiometryMath(StoichiometryMath math)
 {
     int ret = libsbmlPINVOKE.SpeciesReference_setStoichiometryMath(swigCPtr, StoichiometryMath.getCPtr(math));
     return ret;
 }
Ejemplo n.º 20
0
 public void test_StoichiometryMath()
 {
     StoichiometryMath sm = new StoichiometryMath(2,4);
       assertEquals( false, (sm.hasRequiredElements()) );
       sm.setMath(libsbml.parseFormula("ar"));
       assertEquals( true, sm.hasRequiredElements() );
       sm = null;
 }
Ejemplo n.º 21
0
 public void tearDown()
 {
     D = null;
 }
Ejemplo n.º 22
0
 internal static HandleRef getCPtr(StoichiometryMath obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }
Ejemplo n.º 23
0
        int setStoichiometryMath(StoichiometryMath math)
        {
            int ret = libsbmlPINVOKE.SpeciesReference_setStoichiometryMath(swigCPtr, StoichiometryMath.getCPtr(math));

            return(ret);
        }
Ejemplo n.º 24
0
 public void test_StoichiometryMath_ancestor_add()
 {
     StoichiometryMath m = new StoichiometryMath(2,4);
       SpeciesReference sr = new SpeciesReference(2,4);
       sr.setStoichiometryMath(m);
       m = null;
       StoichiometryMath obj = sr.getStoichiometryMath();
       assertTrue( obj.getAncestorOfType(libsbml.SBML_SPECIES_REFERENCE) == sr );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_MODEL) == null );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null );
       sr = null;
 }