public void setUp()
 {
     P = new  Parameter(1,2);
       if (P == null);
       {
       }
 }
Ejemplo n.º 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_Parameter_setConstant2()
 {
     Parameter p = new  Parameter(2,2);
       int i = p.setConstant(false);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( p.getConstant() == false );
       p = null;
 }
Ejemplo n.º 4
0
 public void test_KineticLaw_addParameter()
 {
     Parameter p = new  Parameter(2,4);
       p.setId( "p");
       kl.addParameter(p);
       assertTrue( kl.getNumParameters() == 1 );
       p = null;
 }
 public void test_KineticLaw_addParameter2()
 {
     KineticLaw kl = new  KineticLaw(2,2);
       Parameter p = new  Parameter(2,1);
       p.setId( "p");
       int i = kl.addParameter(p);
       assertTrue( i == libsbml.LIBSBML_VERSION_MISMATCH );
       assertTrue( kl.getNumParameters() == 0 );
       p = null;
       kl = null;
 }
 public void test_KineticLaw_addParameter1()
 {
     KineticLaw kl = new  KineticLaw(2,2);
       Parameter p = new  Parameter(2,2);
       int i = kl.addParameter(p);
       assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
       p.setId( "p");
       i = kl.addParameter(p);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( kl.getNumParameters() == 1 );
       p = null;
       kl = null;
 }
Ejemplo n.º 7
0
 public void test_Parameter_createWithNS()
 {
     XMLNamespaces xmlns = new  XMLNamespaces();
       xmlns.add( "http://www.sbml.org", "testsbml");
       SBMLNamespaces sbmlns = new  SBMLNamespaces(2,1);
       sbmlns.addNamespaces(xmlns);
       Parameter object1 = new  Parameter(sbmlns);
       assertTrue( object1.getTypeCode() == libsbml.SBML_PARAMETER );
       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_Parameter_setValue2()
 {
     Parameter p = new  Parameter(2,2);
       int i = p.unsetValue();
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertEquals( false, p.isSetValue() );
       p = null;
 }
Ejemplo n.º 9
0
 public void test_Model_getParameterById()
 {
     Parameter p1 = new  Parameter(2,4);
       Parameter p2 = new  Parameter(2,4);
       p1.setId( "Km1" );
       p2.setId( "Km2" );
       M.addParameter(p1);
       M.addParameter(p2);
       assertTrue( M.getNumParameters() == 2 );
       assertNotEquals(M.getParameter( "Km1" ),p1);
       assertNotEquals(M.getParameter( "Km2" ),p2);
       assertEquals(M.getParameter( "Km3" ),null);
 }
 public void test_Parameter_parent_add()
 {
     Parameter ia = new Parameter(2,4);
       Model m = new Model(2,4);
       ia.setId("p");
       m.addParameter(ia);
       ia = null;
       ListOf lo = m.getListOfParameters();
       assertTrue( lo == m.getParameter(0).getParentSBMLObject() );
       assertTrue( m == lo.getParentSBMLObject() );
 }
 public void test_Parameter_setName3()
 {
     Parameter p = new  Parameter(1,2);
       int i = p.setName( "11pp");
       assertTrue( i == libsbml.LIBSBML_INVALID_ATTRIBUTE_VALUE );
       assertEquals( false, p.isSetName() );
       i = p.setName("");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertEquals( false, p.isSetName() );
       p = null;
 }
Ejemplo n.º 12
0
 internal static HandleRef getCPtr(Parameter obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
 public void test_KineticLaw_Parameter_parent_add()
 {
     KineticLaw kl = new KineticLaw(2,4);
       Parameter p = new Parameter(2,4);
       p.setId("jake");
       kl.addParameter(p);
       p = null;
       assertTrue( kl.getNumParameters() == 1 );
       assertTrue( kl.getParameter(0).getId() ==  "jake" );
       ListOfParameters lop = kl.getListOfParameters();
       assertTrue( kl == lop.getParentSBMLObject() );
       assertTrue( lop == kl.getParameter(0).getParentSBMLObject() );
       kl = null;
 }
        public void test_Parameter_constructor()
        {
            SBase s;

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

              string msg = "";

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

              msg = "";

              try
              {
            s = new Parameter(SN99);
              }
              catch (SBMLConstructorException e)
              {
             msg = e.Message;
              }
              assertTrue(msg == ErrMsg);
        }
Ejemplo n.º 15
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);
       kl.addParameter(k1);
       kl.addParameter(k2);
       k1 = null;
       k2 = null;
       assertTrue( kl.getNumParameters() == 2 );
       k1 = kl.getParameter( "k1");
       k2 = kl.getParameter( "k2");
       assertTrue((  "k1" == k1.getId() ));
       assertTrue((  "k2" == k2.getId() ));
       assertTrue( k1.getValue() == 3.14 );
       assertTrue( k2.getValue() == 2.72 );
 }
Ejemplo n.º 16
0
 public void test_Model_addParameter5()
 {
     Model m = new  Model(2,2);
       Parameter p = new  Parameter(2,2);
       p.setId( "p");
       Parameter p1 = new  Parameter(2,2);
       p1.setId( "p");
       int i = m.addParameter(p);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( m.getNumParameters() == 1 );
       i = m.addParameter(p1);
       assertTrue( i == libsbml.LIBSBML_DUPLICATE_OBJECT_ID );
       assertTrue( m.getNumParameters() == 1 );
       p = null;
       p1 = null;
       m = null;
 }
Ejemplo n.º 17
0
 /**
    * Adds a copy of the given Parameter object to the list of local
    * parameters in this KineticLaw.
    *
    * @param p the Parameter to add
    *
    * *
  * @return integer value indicating success/failure of the
  * function.  @if clike The value is drawn from the
  * enumeration #OperationReturnValues_t. @endif The possible values
  * returned by this function are:
  *
  *
    * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink
    * @li @link libsbml#LIBSBML_LEVEL_MISMATCH LIBSBML_LEVEL_MISMATCH@endlink
    * @li @link libsbml#LIBSBML_VERSION_MISMATCH LIBSBML_VERSION_MISMATCH@endlink
    * @li @link libsbml#LIBSBML_DUPLICATE_OBJECT_ID LIBSBML_DUPLICATE_OBJECT_ID@endlink
    * @li @link libsbml#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT@endlink
    * @li @link 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 createParameter()
    */
 public int addParameter(Parameter p)
 {
     int ret = libsbmlPINVOKE.KineticLaw_addParameter(swigCPtr, Parameter.getCPtr(p));
     return ret;
 }
Ejemplo n.º 18
0
 public void test_Model_addParameter3()
 {
     Model m = new  Model(2,2);
       Parameter p = new  Parameter(1,2);
       p.setId( "p");
       int i = m.addParameter(p);
       assertTrue( i == libsbml.LIBSBML_LEVEL_MISMATCH );
       assertTrue( m.getNumParameters() == 0 );
       p = null;
       m = null;
 }
Ejemplo n.º 19
0
 public void test_Model_addParameter1()
 {
     Model m = new  Model(2,2);
       Parameter p = new  Parameter(2,2);
       int i = m.addParameter(p);
       assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
       p.setId( "p");
       i = m.addParameter(p);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( m.getNumParameters() == 1 );
       p = null;
       m = null;
 }
Ejemplo n.º 20
0
 public void test_Model_addParameter()
 {
     Parameter p = new  Parameter(2,4);
       p.setId( "p");
       M.addParameter(p);
       assertTrue( M.getNumParameters() == 1 );
 }
 public void tearDown()
 {
     P = null;
 }
 public void test_internal_consistency_check_99904_param()
 {
     SBMLDocument d = new SBMLDocument(2,4);
       long errors;
       Parameter p = new Parameter(2,4);
       d.setLevelAndVersion(1,2,false);
       Model m = d.createModel();
       Compartment c = m.createCompartment();
       c.setId("cc");
       p.setId("p");
       p.setMetaId("mmm");
       m.addParameter(p);
       errors = d.checkInternalConsistency();
       assertTrue( errors == 0 );
       d = null;
 }
Ejemplo n.º 23
0
 public void test_Model_getParameter()
 {
     Parameter p1 = new  Parameter(2,4);
       Parameter p2 = new  Parameter(2,4);
       p1.setId( "Km1");
       p2.setId( "Km2");
       M.addParameter(p1);
       M.addParameter(p2);
       assertTrue( M.getNumParameters() == 2 );
       p1 = M.getParameter(0);
       p2 = M.getParameter(1);
       assertTrue((  "Km1" == p1.getId() ));
       assertTrue((  "Km2" == p2.getId() ));
 }
Ejemplo n.º 24
0
 public void test_L3_Parameter_createWithNS()
 {
     XMLNamespaces xmlns = new  XMLNamespaces();
       xmlns.add( "http://www.sbml.org", "testsbml");
       SBMLNamespaces sbmlns = new  SBMLNamespaces(3,1);
       sbmlns.addNamespaces(xmlns);
       Parameter p = new  Parameter(sbmlns);
       assertTrue( p.getTypeCode() == libsbml.SBML_PARAMETER );
       assertTrue( p.getMetaId() == "" );
       assertTrue( p.getNotes() == null );
       assertTrue( p.getAnnotation() == null );
       assertTrue( p.getLevel() == 3 );
       assertTrue( p.getVersion() == 1 );
       assertTrue( p.getNamespaces() != null );
       assertTrue( p.getNamespaces().getLength() == 2 );
       assertTrue( p.getId() == "" );
       assertTrue( p.getName() == "" );
       assertTrue( p.getUnits() == "" );
       assertEquals( true, isnan(p.getValue()) );
       assertTrue( p.getConstant() == true );
       assertEquals( false, p.isSetId() );
       assertEquals( false, p.isSetName() );
       assertEquals( false, p.isSetValue() );
       assertEquals( false, p.isSetUnits() );
       assertEquals( false, p.isSetConstant() );
       p = null;
 }
Ejemplo n.º 25
0
 public void test_KineticLaw_Parameter_ancestor_add()
 {
     KineticLaw kl = new KineticLaw(2,4);
       Parameter p = new Parameter(2,4);
       p.setId("jake");
       kl.addParameter(p);
       p = null;
       ListOfParameters lop = kl.getListOfParameters();
       Parameter obj = kl.getParameter(0);
       assertTrue( obj.getAncestorOfType(libsbml.SBML_KINETIC_LAW) == kl );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_LIST_OF) == lop );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_COMPARTMENT) == null );
       kl = null;
 }
Ejemplo n.º 26
0
        internal static HandleRef getCPtrAndDisown(Parameter obj)
        {
            HandleRef ptr = new HandleRef(null, IntPtr.Zero);

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

            return ptr;
        }
 public void test_Parameter()
 {
     Parameter p = new Parameter(2,4);
       assertEquals( true, p.hasRequiredElements() );
       p = null;
 }
Ejemplo n.º 28
0
 public void test_Parameter_ancestor_add()
 {
     Parameter ia = new Parameter(2,4);
       Model m = new Model(2,4);
       ia.setId("p");
       m.addParameter(ia);
       ia = null;
       ListOf lo = m.getListOfParameters();
       Parameter obj = m.getParameter(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 );
 }
Ejemplo n.º 29
0
 /**
    * Copy constructor; creates a LocalParameter object by copying
    * the attributes of a given Parameter object.
    *
    * @param orig the Parameter instance to copy.
    *
    * @throws SBMLConstructorException
    * Thrown if the argument @p orig is @c null.
    */
 public LocalParameter(Parameter orig)
     : this(libsbmlPINVOKE.new_LocalParameter__SWIG_3(Parameter.getCPtr(orig)), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
 }
Ejemplo n.º 30
0
 public void test_L3_Parameter_hasRequiredAttributes()
 {
     Parameter p = new  Parameter(3,1);
       assertEquals( false, p.hasRequiredAttributes() );
       p.setId( "id");
       assertEquals( false, p.hasRequiredAttributes() );
       p.setConstant(false);
       assertEquals( true, p.hasRequiredAttributes() );
       p = null;
 }