本文整理汇总了C#中libsbml.Model.getNumUnitDefinitions方法的典型用法代码示例。如果您正苦于以下问题:C# Model.getNumUnitDefinitions方法的具体用法?C# Model.getNumUnitDefinitions怎么用?C# Model.getNumUnitDefinitions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libsbml.Model
的用法示例。
在下文中一共展示了Model.getNumUnitDefinitions方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: test_Model_addUnitDefinition5
public void test_Model_addUnitDefinition5()
{
Model m = new Model(2,2);
UnitDefinition ud = new UnitDefinition(2,2);
ud.setId( "ud");
ud.createUnit();
UnitDefinition ud1 = new UnitDefinition(2,2);
ud1.setId( "ud");
ud1.createUnit();
int i = m.addUnitDefinition(ud);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue( m.getNumUnitDefinitions() == 1 );
i = m.addUnitDefinition(ud1);
assertTrue( i == libsbml.LIBSBML_DUPLICATE_OBJECT_ID );
assertTrue( m.getNumUnitDefinitions() == 1 );
ud = null;
ud1 = null;
m = null;
}
示例2: test_Model_createUnitDefinition
public void test_Model_createUnitDefinition()
{
Model m = new Model(2,2);
UnitDefinition p = m.createUnitDefinition();
assertTrue( m.getNumUnitDefinitions() == 1 );
assertTrue( (p).getLevel() == 2 );
assertTrue( (p).getVersion() == 2 );
m = null;
}
示例3: test_Model_addUnitDefinition3
public void test_Model_addUnitDefinition3()
{
Model m = new Model(2,2);
UnitDefinition ud = new UnitDefinition(1,2);
ud.createUnit();
ud.setId( "ud");
int i = m.addUnitDefinition(ud);
assertTrue( i == libsbml.LIBSBML_LEVEL_MISMATCH );
assertTrue( m.getNumUnitDefinitions() == 0 );
ud = null;
m = null;
}
示例4: test_Model_addUnitDefinition4
public void test_Model_addUnitDefinition4()
{
Model m = new Model(2,2);
UnitDefinition ud = null;
int i = m.addUnitDefinition(ud);
assertTrue( i == libsbml.LIBSBML_OPERATION_FAILED );
assertTrue( m.getNumUnitDefinitions() == 0 );
m = null;
}
示例5: test_ReadSBML_Unit_L2
public void test_ReadSBML_Unit_L2()
{
Unit u;
UnitDefinition ud;
string s = wrapSBML_L2v1("<listOfUnitDefinitions>" +
" <unitDefinition id='Fahrenheit'>" +
" <listOfUnits>" +
" <unit kind='Celsius' multiplier='1.8' offset='32'/>" +
" </listOfUnits>" +
" </unitDefinition>" +
"</listOfUnitDefinitions>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue( M.getNumUnitDefinitions() == 1 );
ud = M.getUnitDefinition(0);
assertEquals( true, ud.isSetId() );
assertTrue(( "Fahrenheit" == ud.getId() ));
assertTrue( ud.getNumUnits() == 1 );
u = ud.getUnit(0);
assertTrue( u.getKind() == libsbml.UNIT_KIND_CELSIUS );
assertTrue( u.getExponent() == 1 );
assertTrue( u.getScale() == 0 );
assertTrue( u.getMultiplier() == 1.8 );
assertTrue( u.getOffset() == 32 );
}
示例6: test_ReadSBML_Unit_defaults_L1_L2
public void test_ReadSBML_Unit_defaults_L1_L2()
{
Unit u;
UnitDefinition ud;
string s = wrapSBML_L1v2("<listOfUnitDefinitions>" +
" <unitDefinition name='bogomips'>" +
" <listOfUnits> <unit kind='second'/> </listOfUnits>" +
" </unitDefinition>" +
"</listOfUnitDefinitions>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue( M.getNumUnitDefinitions() == 1 );
ud = M.getUnitDefinition(0);
assertTrue(( "bogomips" == ud.getId() ));
assertTrue( ud.getNumUnits() == 1 );
u = ud.getUnit(0);
assertTrue( u.getKind() == libsbml.UNIT_KIND_SECOND );
assertTrue( u.getExponent() == 1 );
assertTrue( u.getScale() == 0 );
assertTrue( u.getMultiplier() == 1.0 );
assertTrue( u.getOffset() == 0.0 );
}
示例7: test_ReadSBML_UnitDefinition_L2
public void test_ReadSBML_UnitDefinition_L2()
{
UnitDefinition ud;
string s = wrapSBML_L2v1("<listOfUnitDefinitions>" +
" <unitDefinition id='mmls' name='mmol/ls'/>" +
"</listOfUnitDefinitions>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue( M.getNumUnitDefinitions() == 1 );
ud = M.getUnitDefinition(0);
assertEquals( true, ud.isSetId() );
assertEquals( true, ud.isSetName() );
assertTrue(( "mmls" == ud.getId() ));
assertTrue(( "mmol/ls" == ud.getName() ));
}
示例8: test_ReadSBML_UnitDefinition
public void test_ReadSBML_UnitDefinition()
{
UnitDefinition ud;
string s = wrapSBML_L1v2("<listOfUnitDefinitions>" +
" <unitDefinition name='mmls'/>" +
"</listOfUnitDefinitions>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue( M.getNumUnitDefinitions() == 1 );
ud = M.getUnitDefinition(0);
assertTrue(( "mmls" == ud.getId() ));
}
示例9: test_ReadSBML_Unit
public void test_ReadSBML_Unit()
{
Unit u;
UnitDefinition ud;
string s = wrapSBML_L1v2("<listOfUnitDefinitions>" +
" <unitDefinition name='substance'>" +
" <listOfUnits> <unit kind='mole' scale='-3'/> </listOfUnits>" +
" </unitDefinition>" +
"</listOfUnitDefinitions>");
D = libsbml.readSBMLFromString(s);
M = D.getModel();
assertTrue( M.getNumUnitDefinitions() == 1 );
ud = M.getUnitDefinition(0);
assertTrue(( "substance" == ud.getId() ));
assertTrue( ud.getNumUnits() == 1 );
u = ud.getUnit(0);
assertTrue( u.getKind() == libsbml.UNIT_KIND_MOLE );
assertTrue( u.getExponent() == 1 );
assertTrue( u.getScale() == -3 );
}