本文整理汇总了C#中libsbml.Model.addUnitDefinition方法的典型用法代码示例。如果您正苦于以下问题:C# Model.addUnitDefinition方法的具体用法?C# Model.addUnitDefinition怎么用?C# Model.addUnitDefinition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libsbml.Model
的用法示例。
在下文中一共展示了Model.addUnitDefinition方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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_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;
}
示例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_SBMLDocument_setLevelAndVersion_Error
public void test_SBMLDocument_setLevelAndVersion_Error()
{
SBMLDocument d = new SBMLDocument();
d.setLevelAndVersion(2,1,true);
Model m1 = new Model(2,1);
Unit u = new Unit(2,1);
u.setKind(libsbml.UnitKind_forName("mole"));
u.setOffset(3.2);
UnitDefinition ud = new UnitDefinition(2,1);
ud.setId( "ud");
ud.addUnit(u);
m1.addUnitDefinition(ud);
d.setModel(m1);
assertTrue( d.setLevelAndVersion(2,2,true) == false );
assertTrue( d.setLevelAndVersion(2,3,true) == false );
assertTrue( d.setLevelAndVersion(1,2,true) == false );
assertTrue( d.setLevelAndVersion(1,1,true) == false );
d = null;
}
示例5: test_UnitDefinition_parent_add
public void test_UnitDefinition_parent_add()
{
UnitDefinition ia = new UnitDefinition(2,4);
Model m = new Model(2,4);
ia.setId("u");
ia.createUnit();
m.addUnitDefinition(ia);
ia = null;
ListOf lo = m.getListOfUnitDefinitions();
assertTrue( lo == m.getUnitDefinition(0).getParentSBMLObject() );
assertTrue( m == lo.getParentSBMLObject() );
}
示例6: test_UnitDefinition_ancestor_add
public void test_UnitDefinition_ancestor_add()
{
UnitDefinition ia = new UnitDefinition(2,4);
Model m = new Model(2,4);
ia.setId("u");
ia.createUnit();
m.addUnitDefinition(ia);
ia = null;
ListOf lo = m.getListOfUnitDefinitions();
UnitDefinition obj = m.getUnitDefinition(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 );
}