public void setUp() { S = new Species(3,1); if (S == null); { } }
public void test_ListOf_clear() { ListOf lo = new ListOf(); 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; }
public void setUp() { C = new Species(1,2); if (C == 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; }
/** * Adds the given species as a reactant with the given stoichiometry * * @param species the species to be added as reactant * * @param stoichiometry an optional parameter specifying the * stoichiometry of the product (defaulting to 1) * * @param id an optional id to be given to the species reference that will * be created. (defaulting to empty string, i.e. not set) * * @param constant an attribute specifying whether the species reference is * constant or not (defaulting to true) * * * @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_INVALID_OBJECT LIBSBML_INVALID_OBJECT@endlink * @li @link libsbml#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE@endlink * @li @link libsbml#LIBSBML_DUPLICATE_OBJECT_ID LIBSBML_DUPLICATE_OBJECT_ID@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. * * * * @note the Species object itself is NOT added to the model * * @see createProduct() */ public int addReactant(Species species, double stoichiometry, string id, bool constant) { int ret = libsbmlPINVOKE.Reaction_addReactant__SWIG_1(swigCPtr, Species.getCPtr(species), stoichiometry, id, constant); return ret; }
/** * Adds the given species as a product with the given stoichiometry * * @param species the species to be added as product * * @param stoichiometry an optional parameter specifying the * stoichiometry of the product (defaulting to 1) * * @param id an optional id to be given to the species reference that will * be created. (defaulting to empty string, i.e. not set) * * @param constant an attribute specifying whether the species reference is * constant or not (defaulting to true) * * * @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_INVALID_OBJECT LIBSBML_INVALID_OBJECT@endlink * @li @link libsbml#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE@endlink * @li @link libsbml#LIBSBML_DUPLICATE_OBJECT_ID LIBSBML_DUPLICATE_OBJECT_ID@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. * * * * @note the Species object itself is NOT added to the model * * @see createProduct() */ public int addProduct(Species species, double stoichiometry, string id) { int ret = libsbmlPINVOKE.Reaction_addProduct__SWIG_2(swigCPtr, Species.getCPtr(species), stoichiometry, id); return ret; }
public void test_Model_getNumSpeciesWithBoundaryCondition() { Species s1 = new Species(2,4); Species s2 = new Species(2,4); Species s3 = new Species(2,4); s1.setId( "s1"); s2.setId( "s2"); s3.setId( "s3"); s1.setCompartment( "c1"); s2.setCompartment( "c2"); s3.setCompartment( "c3"); s1.setBoundaryCondition(true); s2.setBoundaryCondition(false); s3.setBoundaryCondition(true); assertTrue( M.getNumSpecies() == 0 ); assertTrue( M.getNumSpeciesWithBoundaryCondition() == 0 ); M.addSpecies(s1); assertTrue( M.getNumSpecies() == 1 ); assertTrue( M.getNumSpeciesWithBoundaryCondition() == 1 ); M.addSpecies(s2); assertTrue( M.getNumSpecies() == 2 ); assertTrue( M.getNumSpeciesWithBoundaryCondition() == 1 ); M.addSpecies(s3); assertTrue( M.getNumSpecies() == 3 ); assertTrue( M.getNumSpeciesWithBoundaryCondition() == 2 ); }
public void test_L3_Species_hasRequiredAttributes() { Species s = new Species(3,1); assertEquals( false, s.hasRequiredAttributes() ); s.setId( "id"); assertEquals( false, s.hasRequiredAttributes() ); s.setCompartment( "cell"); assertEquals( false, s.hasRequiredAttributes() ); s.setHasOnlySubstanceUnits(false); assertEquals( false, s.hasRequiredAttributes() ); s.setBoundaryCondition(false); assertEquals( false, s.hasRequiredAttributes() ); s.setConstant(false); assertEquals( true, s.hasRequiredAttributes() ); s = null; }
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_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; }
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_SBMLConvert_convertToL1_Species_Amount() { SBMLDocument d = new SBMLDocument(2,1); 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_copyConstructor() { Species o1 = new Species(2,4); o1.setId("c"); o1.setSpeciesType("c1"); assertTrue( o1.getId() == "c" ); assertEquals(o1.getSpeciesType(), "c1"); Species o2 = new Species(o1); assertTrue( o2.getId() == "c" ); assertEquals(o2.getSpeciesType(), "c1"); assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() ); o2 = null; o1 = null; }
public void test_ListOf_copyConstructor() { ListOf o1 = new ListOf(); Species s = new Species(2,1); s.setId("species_1"); o1.append(s); s = null; ListOf o2 = new ListOf(o1); assertTrue( o2.size() == 1 ); assertTrue( ((Species) o2.get(0)).getId() == "species_1" ); assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() ); o2 = null; o1 = null; }
public void test_Species() { Species s = new Species(2,4); assertEquals( true, s.hasRequiredElements() ); s = null; }
public void test_Model_getSpeciesById() { Species s1 = new Species(2,4); Species s2 = new Species(2,4); s1.setId( "Glucose" ); s2.setId( "Glucose_6_P" ); s1.setCompartment( "c"); s2.setCompartment( "c"); M.addSpecies(s1); M.addSpecies(s2); assertTrue( M.getNumSpecies() == 2 ); assertTrue( M.getSpecies( "Glucose" ) != s1 ); assertTrue( M.getSpecies( "Glucose_6_P") != s2 ); assertTrue( M.getSpecies( "Glucose2" ) == null ); }
public void test_Model_getSpecies() { Species s1 = new Species(2,4); Species s2 = new Species(2,4); s1.setId( "Glucose" ); s2.setId( "Glucose_6_P" ); s1.setCompartment( "c"); s2.setCompartment( "c"); M.addSpecies(s1); M.addSpecies(s2); assertTrue( M.getNumSpecies() == 2 ); s1 = M.getSpecies(0); s2 = M.getSpecies(1); assertTrue(( "Glucose" == s1.getId() )); assertTrue(( "Glucose_6_P" == s2.getId() )); }
/** * Adds the given species as a reactant with the given stoichiometry * * @param species the species to be added as reactant * * @param stoichiometry an optional parameter specifying the * stoichiometry of the product (defaulting to 1) * * @param id an optional id to be given to the species reference that will * be created. (defaulting to empty string, i.e. not set) * * @param constant an attribute specifying whether the species reference is * constant or not (defaulting to true) * * * @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_INVALID_OBJECT LIBSBML_INVALID_OBJECT@endlink * @li @link libsbml#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE@endlink * @li @link libsbml#LIBSBML_DUPLICATE_OBJECT_ID LIBSBML_DUPLICATE_OBJECT_ID@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. * * * * @note the Species object itself is NOT added to the model * * @see createProduct() */ public int addReactant(Species species, double stoichiometry) { int ret = libsbmlPINVOKE.Reaction_addReactant__SWIG_3(swigCPtr, Species.getCPtr(species), stoichiometry); return ret; }
/** * Adds the given species as a reactant with the given stoichiometry * * @param species the species to be added as reactant * * @param stoichiometry an optional parameter specifying the * stoichiometry of the product (defaulting to 1) * * @param id an optional id to be given to the species reference that will * be created. (defaulting to empty string, i.e. not set) * * @param constant an attribute specifying whether the species reference is * constant or not (defaulting to true) * * * @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_INVALID_OBJECT LIBSBML_INVALID_OBJECT@endlink * @li @link libsbml#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE@endlink * @li @link libsbml#LIBSBML_DUPLICATE_OBJECT_ID LIBSBML_DUPLICATE_OBJECT_ID@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. * * * * @note the Species object itself is NOT added to the model * * @see createProduct() */ public int addReactant(Species species) { int ret = libsbmlPINVOKE.Reaction_addReactant__SWIG_4(swigCPtr, Species.getCPtr(species)); return ret; }
/** * 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. 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 createSpecies() */ public int addSpecies(Species s) { int ret = libsbmlPINVOKE.Model_addSpecies(swigCPtr, Species.getCPtr(s)); return ret; }
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; }
public void test_internal_consistency_check_99916_reaction() { SBMLDocument d = new SBMLDocument(2,4); long errors; Species s = new Species(2,4); d.setLevelAndVersion(1,2,false); Model m = d.createModel(); Compartment c = m.createCompartment(); c.setId("c"); Reaction r = m.createReaction(); r.setId("r"); SpeciesReference sr = r.createReactant(); s.setId("s"); s.setCompartment("c"); s.setConstant(true); sr.setSpecies("s"); m.addSpecies(s); errors = d.checkInternalConsistency(); assertTrue( errors == 0 ); d = null; }
public void test_L3_Species_createWithNS() { XMLNamespaces xmlns = new XMLNamespaces(); xmlns.add( "http://www.sbml.org", "testsbml"); SBMLNamespaces sbmlns = new SBMLNamespaces(3,1); sbmlns.addNamespaces(xmlns); Species s = new Species(sbmlns); assertTrue( s.getTypeCode() == libsbml.SBML_SPECIES ); assertTrue( s.getMetaId() == "" ); assertTrue( s.getNotes() == null ); assertTrue( s.getAnnotation() == null ); assertTrue( s.getLevel() == 3 ); assertTrue( s.getVersion() == 1 ); assertTrue( s.getNamespaces() != null ); assertTrue( s.getNamespaces().getLength() == 2 ); assertTrue( s.getId() == "" ); assertTrue( s.getName() == "" ); assertTrue( s.getCompartment() == "" ); assertEquals( true, isnan(s.getInitialAmount()) ); assertEquals( true, isnan(s.getInitialConcentration()) ); assertTrue( s.getSubstanceUnits() == "" ); assertTrue( s.getHasOnlySubstanceUnits() == false ); assertTrue( s.getBoundaryCondition() == false ); assertTrue( s.getConstant() == false ); assertTrue( s.getConversionFactor() == "" ); assertEquals( false, s.isSetId() ); assertEquals( false, s.isSetName() ); assertEquals( false, s.isSetCompartment() ); assertEquals( false, s.isSetInitialAmount() ); assertEquals( false, s.isSetInitialConcentration() ); assertEquals( false, s.isSetSubstanceUnits() ); assertEquals( false, s.isSetHasOnlySubstanceUnits() ); assertEquals( false, s.isSetBoundaryCondition() ); assertEquals( false, s.isSetConstant() ); assertEquals( false, s.isSetConversionFactor() ); s = null; }
public void tearDown() { S = null; }
public void test_internal_consistency_check_99916_rule() { SBMLDocument d = new SBMLDocument(2,4); long errors; Species s = new Species(2,4); d.setLevelAndVersion(1,2,false); Model m = d.createModel(); Compartment c = m.createCompartment(); c.setId("c"); s.setId("s"); s.setCompartment("c"); s.setConstant(true); m.addSpecies(s); Rule r = m.createAssignmentRule(); r.setVariable("s"); r.setFormula("2"); errors = d.checkInternalConsistency(); assertTrue( errors == 2 ); d = null; }
internal static HandleRef getCPtrAndDisown(Species obj) { HandleRef ptr = new HandleRef(null, IntPtr.Zero); if (obj != null) { ptr = obj.swigCPtr; obj.swigCMemOwn = false; } return ptr; }
internal static HandleRef getCPtr(Species obj) { return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; }
public void test_internal_consistency_check_99919() { SBMLDocument d = new SBMLDocument(2,4); long errors; Species s = new Species(2,4); d.setLevelAndVersion(1,2,false); Model m = d.createModel(); Compartment c = m.createCompartment(); c.setId("c"); s.setId("s"); s.setCompartment("c"); s.setHasOnlySubstanceUnits(true); m.addSpecies(s); errors = d.checkInternalConsistency(); assertTrue( errors == 0 ); d = null; }
/** * Copy constructor; creates a copy of this Species object. * * @param orig the object to copy. */ public Species(Species orig) : this(libsbmlPINVOKE.new_Species__SWIG_2(Species.getCPtr(orig)), true) { if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); }
/** * Adds the given species as a modifier to this reaction * * @param species the species to be added as modifier * * @param id an optional id to be given to the species reference that will * be created. (defaulting to empty string, i.e. not set) * * * @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_INVALID_OBJECT LIBSBML_INVALID_OBJECT@endlink * @li @link libsbml#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE@endlink * @li @link libsbml#LIBSBML_DUPLICATE_OBJECT_ID LIBSBML_DUPLICATE_OBJECT_ID@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. * * * * @note the Species object itself is NOT added to the model * * @see createModifier() */ public int addModifier(Species species) { int ret = libsbmlPINVOKE.Reaction_addModifier__SWIG_2(swigCPtr, Species.getCPtr(species)); return ret; }