public void setUp()
 {
     C = new  Species(1,2);
       if (C == null);
       {
       }
 }
示例#2
0
 public void test_ListOf_clear()
 {
     ListOf lo = new  ListOf(2,4);
       SBase sp = new  Species(2,4);
       lo.append(sp);
       lo.append(sp);
       lo.append(sp);
       lo.append(sp);
       lo.append(sp);
       assertTrue( lo.size() == 5 );
       lo.clear(true);
       assertTrue( lo.size() == 0 );
       lo.append(sp);
       lo.append(sp);
       lo.append(sp);
       lo.append(sp);
       lo.appendAndOwn(sp);
       assertTrue( lo.size() == 5 );
       SBase elem;
       elem = lo.get(0);
       elem = null;
       elem = lo.get(1);
       elem = null;
       elem = lo.get(2);
       elem = null;
       elem = lo.get(3);
       elem = null;
       elem = lo.get(4);
       elem = null;
       lo.clear(false);
       assertTrue( lo.size() == 0 );
       lo = null;
 }
示例#3
0
 public void setUp()
 {
     S = new  Species(3,1);
       if (S == null);
       {
       }
 }
 public void test_Species_setCharge2()
 {
     Species c = new  Species(2,2);
       int i = c.setCharge(4);
       assertTrue( i == libsbml.LIBSBML_UNEXPECTED_ATTRIBUTE );
       assertEquals( false, c.isSetCharge() );
       c = null;
 }
示例#5
0
 public void test_ListOf_append()
 {
     Model m = new  Model(2,4);
       m.createCompartment();
       ListOf loc = m.getListOfCompartments();
       assertTrue( loc.size() == 1 );
       SBase c = new  Compartment(2,4);
       int i = loc.append(c);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( loc.size() == 2 );
       SBase sp = new  Species(2,4);
       i = loc.append(sp);
       assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
       assertTrue( loc.size() == 2 );
       m = null;
       sp = null;
 }
示例#6
0
 public void test_Model_addSpecies3()
 {
     Model m = new  Model(2,2);
       Species s = new  Species(1,2);
       s.setId( "s");
       s.setCompartment( "c");
       s.setInitialAmount(2);
       int i = m.addSpecies(s);
       assertTrue( i == libsbml.LIBSBML_LEVEL_MISMATCH );
       assertTrue( m.getNumSpecies() == 0 );
       s = null;
       m = null;
 }
示例#7
0
 public void test_Model_addSpecies2()
 {
     Model m = new  Model(2,2);
       Species s = new  Species(2,1);
       s.setId( "s");
       s.setCompartment( "c");
       int i = m.addSpecies(s);
       assertTrue( i == libsbml.LIBSBML_VERSION_MISMATCH );
       assertTrue( m.getNumSpecies() == 0 );
       s = null;
       m = null;
 }
示例#8
0
 /**
    * Copy constructor; creates a copy of this Species object.
    *
    * @param orig the object to copy.
    *
    * @throws @if python ValueError @else SBMLConstructorException @endif
    * Thrown if the argument @p orig is @c null.
    */
 public Species(Species orig)
     : this(libsbmlPINVOKE.new_Species__SWIG_2(Species.getCPtr(orig)), true)
 {
     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
 }
示例#9
0
        internal static HandleRef getCPtrAndDisown(Species obj)
        {
            HandleRef ptr = new HandleRef(null, IntPtr.Zero);

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

            return ptr;
        }
 public void test_Species_setName2()
 {
     Species c = new  Species(2,2);
       int i = c.setName( "1cell");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertEquals( true, c.isSetName() );
       i = c.unsetName();
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertEquals( false, c.isSetName() );
       c = null;
 }
 public void test_Species_parent_add()
 {
     Species ia = new Species(2,4);
       ia.setId("s");
       ia.setCompartment("c");
       Model m = new Model(2,4);
       m.addSpecies(ia);
       ia = null;
       ListOf lo = m.getListOfSpecies();
       assertTrue( lo == m.getSpecies(0).getParentSBMLObject() );
       assertTrue( m == lo.getParentSBMLObject() );
 }
 public void test_SBase_setModelHistory()
 {
     SBase sb = new Species(2,4);
       ModelHistory mh = new  ModelHistory();
       int i = sb.setModelHistory(mh);
       assertTrue( i == libsbml.LIBSBML_UNEXPECTED_ATTRIBUTE );
       mh = null;
 }
 public void tearDown()
 {
     C = null;
 }
 public void test_Species_setHasOnlySubstanceUnits2()
 {
     Species c = new  Species(2,2);
       int i = c.setHasOnlySubstanceUnits(false);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( c.getHasOnlySubstanceUnits() == false );
       i = c.setHasOnlySubstanceUnits(true);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( c.getHasOnlySubstanceUnits() == true );
       c = null;
 }
 public void test_Species_setSubstanceUnits4()
 {
     Species c = new  Species(2,2);
       int i = c.setSubstanceUnits( "mole");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue((  "mole" == c.getSubstanceUnits() ));
       assertEquals( true, c.isSetSubstanceUnits() );
       i = c.setSubstanceUnits("");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertEquals( false, c.isSetSubstanceUnits() );
       c = null;
 }
 public void test_Species_setSubstanceUnits2()
 {
     Species c = new  Species(2,2);
       int i = c.setSubstanceUnits( "1cell");
       assertTrue( i == libsbml.LIBSBML_INVALID_ATTRIBUTE_VALUE );
       assertEquals( false, c.isSetSubstanceUnits() );
       c = null;
 }
 public void test_Species_setSpeciesType4()
 {
     Species c = new  Species(2,2);
       int i = c.setSpeciesType( "cell");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertEquals( true, c.isSetSpeciesType() );
       assertTrue((  "cell"  == c.getSpeciesType() ));
       i = c.setSpeciesType("");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertEquals( false, c.isSetSpeciesType() );
       c = null;
 }
 public void test_Species_setSpeciesType2()
 {
     Species c = new  Species(2,2);
       int i = c.setSpeciesType( "1cell");
       assertTrue( i == libsbml.LIBSBML_INVALID_ATTRIBUTE_VALUE );
       assertEquals( false, c.isSetSpeciesType() );
       i = c.unsetSpeciesType();
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertEquals( false, c.isSetSpeciesType() );
       c = null;
 }
 public void test_Species_setSpatialSizeUnits4()
 {
     Species c = new  Species(2,2);
       int i = c.setSpatialSizeUnits("");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertEquals( false, c.isSetSpatialSizeUnits() );
       c = null;
 }
示例#20
0
 public void test_Model_addSpecies5()
 {
     Model m = new  Model(2,2);
       Species s = new  Species(2,2);
       s.setId( "s");
       s.setCompartment( "c");
       Species s1 = new  Species(2,2);
       s1.setId( "s");
       s1.setCompartment( "c");
       int i = m.addSpecies(s);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( m.getNumSpecies() == 1 );
       i = m.addSpecies(s1);
       assertTrue( i == libsbml.LIBSBML_DUPLICATE_OBJECT_ID );
       assertTrue( m.getNumSpecies() == 1 );
       s = null;
       s1 = null;
       m = null;
 }
 public void test_Species_ancestor_add()
 {
     Species ia = new Species(2,4);
       Model m = new Model(2,4);
       ia.setId("s");
       ia.setCompartment("c");
       m.addSpecies(ia);
       ia = null;
       ListOf lo = m.getListOfSpecies();
       Species obj = m.getSpecies(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_SBMLConvert_convertToL1_Species_Concentration()
 {
     SBMLDocument d = new  SBMLDocument(2,1);
       Model m = d.createModel();
       string sid =  "C";
       Compartment c = new  Compartment(2,1);
       Species s = new  Species(2,1);
       c.setId(sid);
       c.setSize(1.2);
       m.addCompartment(c);
       s.setId( "s"  );
       s.setCompartment(sid);
       s.setInitialConcentration(2.34);
       m.addSpecies(s);
       assertTrue( d.setLevelAndVersion(1,2,true) == true );
       Species s1 = m.getSpecies(0);
       assertTrue( s1 != null );
       assertTrue((  "C" == s1.getCompartment() ));
       assertTrue( m.getCompartment( "C").getSize() == 1.2 );
       assertTrue( s1.getInitialConcentration() == 2.34 );
       assertTrue( s1.isSetInitialConcentration() == true );
       d = null;
 }
 public void test_SBase_setModelHistoryL3()
 {
     SBase sb = new Species(3,1);
       sb.setMetaId("_s");
       ModelHistory mh = new  ModelHistory();
       ModelCreator mc = new  ModelCreator();
       Date date = new  Date(2005,12,30,12,15,45,1,2,0);
       mc.setFamilyName( "Keating");
       mc.setGivenName( "Sarah");
       mc.setEmail( "*****@*****.**");
       mc.setOrganisation( "UH");
       mh.addCreator(mc);
       mh.setCreatedDate(date);
       mh.setModifiedDate(date);
       int i = sb.setModelHistory(mh);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( sb.isSetModelHistory() == true );
       mh = sb.getModelHistory();
       assertTrue( mh != null );
       sb.unsetModelHistory();
       mh = sb.getModelHistory();
       assertTrue( sb.isSetModelHistory() == false );
       assertTrue( mh == null );
       mh = null;
 }
 public void test_Species()
 {
     Species s = new Species(2,4);
       assertEquals( true, s.hasRequiredElements() );
       s = null;
 }
 public void test_SBMLConvert_convertToL1_Species_Amount()
 {
     SBMLDocument d = new  SBMLDocument(2,4);
       Model m = d.createModel();
       string sid =  "C";
       Compartment c = new  Compartment(2,4);
       Species s = new  Species(2,4);
       c.setId(sid);
       m.addCompartment(c);
       s.setCompartment(sid);
       s.setInitialAmount(2.34);
       m.addSpecies(s);
       assertTrue( d.setLevelAndVersion(1,2,true) == true );
       assertTrue( s.getInitialAmount() == 2.34 );
       d = null;
 }
 public void test_Species_setInitialConcentration2()
 {
     Species c = new  Species(2,2);
       int i = c.setInitialConcentration(4);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( c.getInitialConcentration() == 4 );
       assertEquals( true, c.isSetInitialConcentration() );
       i = c.unsetInitialConcentration();
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertEquals( false, c.isSetInitialConcentration() );
       c = null;
 }
示例#27
0
 /**
    * Adds a copy of the given Species object to this Model.
    *
    * @param s the Species object 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 createSpecies()
    */
 public int addSpecies(Species s)
 {
     int ret = libsbmlPINVOKE.Model_addSpecies(swigCPtr, Species.getCPtr(s));
     return ret;
 }
 public void test_Species_setCharge3()
 {
     Species c = new  Species(2,1);
       int i = c.unsetCharge();
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertEquals( false, c.isSetCharge() );
       c = null;
 }
        public void test_Species_constructor()
        {
            SBase s;

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

              string msg = "";

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

              msg = "";

              try
              {
            s = new Species(SN99);
              }
              catch (SBMLConstructorException e)
              {
             msg = e.Message;
              }
              assertTrue(msg == ErrMsg);
        }
示例#30
0
 internal static HandleRef getCPtr(Species obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }