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; }
/// <summary> /// /// </summary> /// <param name="aSpecies"></param> /// <returns></returns> public static double GetInitialAmount(Species aSpecies) { double anInitialAmount_Sp; if (aSpecies.isSetInitialAmount()) anInitialAmount_Sp = aSpecies.getInitialAmount(); else anInitialAmount_Sp = double.NaN; return anInitialAmount_Sp; }
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_setInitialAmount2() { Species c = new Species(2,2); int i = c.setInitialAmount(4); assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS ); assertTrue( c.getInitialAmount() == 4.0 ); assertEquals( true, c.isSetInitialAmount() ); i = c.unsetInitialAmount(); assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS ); assertEquals( false, c.isSetInitialAmount() ); c = null; }