public void test_Parameter_parent_create() { Model m = new Model(2,4); Parameter p = m.createParameter(); ListOf lo = m.getListOfParameters(); assertTrue( lo == m.getParameter(0).getParentSBMLObject() ); assertTrue( lo == p.getParentSBMLObject() ); assertTrue( m == lo.getParentSBMLObject() ); }
/// <summary> /// [ ParameterStruct ] /// [[ Id , Name , Value , Unit , Constant ]] /// </summary> /// <param name="aSBMLmodel"></param> /// <returns></returns> public static List<ParameterStruct> getParameter(Model aSBMLmodel) { List<ParameterStruct> list = new List<ParameterStruct>(); ListOfParameters parameters = aSBMLmodel.getListOfParameters(); for (int i = 0; i < parameters.size(); i++ ) { Parameter aParameter = aSBMLmodel.getParameter(i); string anId_Pa = aParameter.getId(); string aName_Pa = aParameter.getName(); double aValue_Pa = GetParameterValue(aParameter); string anUnit_Pa = aParameter.getUnits(); bool aConstant_Pa = aParameter.getConstant(); ParameterStruct parameter = new ParameterStruct( anId_Pa, aName_Pa, aValue_Pa, anUnit_Pa, aConstant_Pa); list.Add(parameter); } return list; }
public void test_Parameter_ancestor_create() { Model m = new Model(2,4); Parameter p = m.createParameter(); ListOf lo = m.getListOfParameters(); assertTrue( p.getAncestorOfType(libsbml.SBML_MODEL) == m ); assertTrue( p.getAncestorOfType(libsbml.SBML_LIST_OF) == lo ); assertTrue( p.getAncestorOfType(libsbml.SBML_DOCUMENT) == null ); assertTrue( p.getAncestorOfType(libsbml.SBML_EVENT) == null ); 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 ); }
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_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 ); }
public void test_ReadSBML_Parameter() { Parameter p; string s = wrapSBML_L1v2("<listOfParameters>" + " <parameter name='Km1' value='2.3' units='second'/>" + "</listOfParameters>"); D = libsbml.readSBMLFromString(s); M = D.getModel(); assertTrue( M.getNumParameters() == 1 ); p = M.getParameter(0); assertTrue(( "Km1" == p.getId() )); assertTrue(( "second" == p.getUnits() )); assertTrue( p.getValue() == 2.3 ); assertTrue( p.isSetValue() == true ); }
public void test_ReadSBML_metaid() { SBase sb; string s = wrapSBML_L2v1("<listOfFunctionDefinitions>" + " <functionDefinition metaid='fd'/>" + "</listOfFunctionDefinitions>" + "<listOfUnitDefinitions>" + " <unitDefinition metaid='ud'/>" + "</listOfUnitDefinitions>" + "<listOfCompartments>" + " <compartment metaid='c'/>" + "</listOfCompartments>" + "<listOfSpecies>" + " <species metaid='s'/>" + "</listOfSpecies>" + "<listOfParameters>" + " <parameter metaid='p'/>" + "</listOfParameters>" + "<listOfRules>" + " <rateRule metaid='rr'/>" + "</listOfRules>" + "<listOfReactions>" + " <reaction metaid='rx'/>" + "</listOfReactions>" + "<listOfEvents>" + " <event metaid='e'/>" + "</listOfEvents>"); D = libsbml.readSBMLFromString(s); M = D.getModel(); assertTrue( M != null ); sb = M.getFunctionDefinition(0); assertEquals( true, sb.isSetMetaId() ); assertTrue(( "fd" == sb.getMetaId() )); sb = M.getUnitDefinition(0); assertEquals( true, sb.isSetMetaId() ); assertTrue(( "ud" == sb.getMetaId() )); sb = M.getCompartment(0); assertEquals( true, sb.isSetMetaId() ); assertTrue(( "c" == sb.getMetaId() )); sb = M.getSpecies(0); assertEquals( true, sb.isSetMetaId() ); assertTrue(( "s" == sb.getMetaId() )); sb = M.getParameter(0); assertEquals( true, sb.isSetMetaId() ); assertTrue(( "p" == sb.getMetaId() )); sb = M.getRule(0); assertEquals( true, sb.isSetMetaId() ); assertTrue(( "rr" == sb.getMetaId() )); sb = M.getReaction(0); assertEquals( true, sb.isSetMetaId() ); assertTrue(( "rx" == sb.getMetaId() )); sb = M.getEvent(0); assertEquals( true, sb.isSetMetaId() ); assertTrue(( "e" == sb.getMetaId() )); }
public void test_ReadSBML_Parameter_L2_defaults() { Parameter p; string s = wrapSBML_L2v1("<listOfParameters> <parameter id='x'/> </listOfParameters>" ); D = libsbml.readSBMLFromString(s); M = D.getModel(); assertTrue( M.getNumParameters() == 1 ); p = M.getParameter(0); assertEquals( true, p.isSetId() ); assertEquals( false, p.isSetName() ); assertEquals( false, p.isSetValue() ); assertEquals( false, p.isSetUnits() ); assertTrue(( "x" == p.getId() )); assertTrue( p.getConstant() == true ); }
public void test_ReadSBML_Parameter_L2() { Parameter p; string s = wrapSBML_L2v1("<listOfParameters>" + " <parameter id='T' value='4.6' units='Celsius' constant='false'/>" + "</listOfParameters>"); D = libsbml.readSBMLFromString(s); M = D.getModel(); assertTrue( M.getNumParameters() == 1 ); p = M.getParameter(0); assertEquals( true, p.isSetId() ); assertEquals( false, p.isSetName() ); assertEquals( true, p.isSetValue() ); assertEquals( true, p.isSetUnits() ); assertTrue(( "T" == p.getId() )); assertTrue(( "Celsius" == p.getUnits() )); assertTrue( p.getValue() == 4.6 ); assertTrue( p.getConstant() == false ); }