當前位置: 首頁>>代碼示例>>C#>>正文


C# UnitDefinition.createUnit方法代碼示例

本文整理匯總了C#中libsbmlcs.UnitDefinition.createUnit方法的典型用法代碼示例。如果您正苦於以下問題:C# UnitDefinition.createUnit方法的具體用法?C# UnitDefinition.createUnit怎麽用?C# UnitDefinition.createUnit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在libsbmlcs.UnitDefinition的用法示例。


在下文中一共展示了UnitDefinition.createUnit方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: test_UnitDefinition_printUnits

 public void test_UnitDefinition_printUnits()
 {
     UnitDefinition ud = new  UnitDefinition(2,4);
       ud.setId( "mmls");
       Unit perTime = ud.createUnit();
       perTime.setKind(libsbml.UnitKind_forName("second"));
       perTime.setExponent(-1);
       string ud_str = UnitDefinition.printUnits(ud,false);
       assertTrue((                 "second (exponent = -1, multiplier = 1, scale = 0)" == ud_str ));
       string ud_str1 = UnitDefinition.printUnits(ud,true);
       assertTrue((  "(1 second)^-1" == ud_str1 ));
       UnitDefinition ud1 = new  UnitDefinition(2,4);
       ud1.setId( "mmls");
       Unit u = ud1.createUnit();
       u.setKind(libsbml.UNIT_KIND_KILOGRAM);
       u.setExponent(1);
       u.setScale(2);
       u.setMultiplier(3.0);
       string ud_str2 = UnitDefinition.printUnits(ud1,false);
       assertTrue((                 "kilogram (exponent = 1, multiplier = 3, scale = 2)" == ud_str2 ));
       string ud_str3 = UnitDefinition.printUnits(ud1,true);
       assertTrue((  "(300 kilogram)^1" == ud_str3 ));
 }
開發者ID:alexholehouse,項目名稱:SBMLIntegrator,代碼行數:23,代碼來源:TestUnitDefinition.cs

示例2: test_UnitDefinition

 public void test_UnitDefinition()
 {
     UnitDefinition ud = new UnitDefinition(2,4);
       assertEquals( false, (ud.hasRequiredElements()) );
       ud.createUnit();
       assertEquals( true, ud.hasRequiredElements() );
       ud = null;
 }
開發者ID:TotteKarlsson,項目名稱:roadrunner,代碼行數:8,代碼來源:TestRequiredElements.cs

示例3: test_Unit_parent_create

 public void test_Unit_parent_create()
 {
     UnitDefinition ud = new UnitDefinition(2,4);
       Unit u = ud.createUnit();
       assertTrue( ud.getNumUnits() == 1 );
       ListOf lo = ud.getListOfUnits();
       assertTrue( lo == ud.getUnit(0).getParentSBMLObject() );
       assertTrue( lo == u.getParentSBMLObject() );
       assertTrue( ud == lo.getParentSBMLObject() );
       ud = null;
 }
開發者ID:alexholehouse,項目名稱:SBMLIntegrator,代碼行數:11,代碼來源:TestSBMLParentObject.cs

示例4: test_UnitDefinition_isVariantOfSubstancePerTime_4

 public void test_UnitDefinition_isVariantOfSubstancePerTime_4()
 {
     UnitDefinition ud = new  UnitDefinition(2,2);
       Unit dim = ud.createUnit();
       dim.setKind(libsbml.UnitKind_forName("dimensionless"));
       Unit perTime = ud.createUnit();
       perTime.setKind(libsbml.UnitKind_forName("second"));
       perTime.setExponent(-1);
       Unit u = ud.createUnit();
       assertEquals( false, ud.isVariantOfSubstancePerTime() );
       u.setKind(libsbml.UNIT_KIND_KILOGRAM);
       u.setExponent(1);
       assertEquals( true, ud.isVariantOfSubstancePerTime() );
       u.setScale(-1);
       perTime.setScale(-1);
       assertEquals( true, ud.isVariantOfSubstancePerTime() );
       u.setMultiplier(2);
       assertEquals( true, ud.isVariantOfSubstancePerTime() );
       u.setOffset(3);
       assertEquals( true, ud.isVariantOfSubstancePerTime() );
       u.setExponent(-3);
       assertEquals( false, ud.isVariantOfSubstancePerTime() );
       u.setExponent(1);
       perTime.setExponent(-3);
       assertEquals( false, ud.isVariantOfSubstancePerTime() );
       perTime.setExponent(-1);
       ud.addUnit(dim);
       assertEquals( true, ud.isVariantOfSubstancePerTime() );
       ud = null;
 }
開發者ID:alexholehouse,項目名稱:SBMLIntegrator,代碼行數:30,代碼來源:TestUnitDefinition.cs

示例5: test_Unit_ancestor_create

 public void test_Unit_ancestor_create()
 {
     UnitDefinition ud = new UnitDefinition(2,4);
       Unit u = ud.createUnit();
       assertTrue( ud.getNumUnits() == 1 );
       ListOf lo = ud.getListOfUnits();
       assertTrue( u.getAncestorOfType(libsbml.SBML_UNIT_DEFINITION) == ud );
       assertTrue( u.getAncestorOfType(libsbml.SBML_LIST_OF) == lo );
       assertTrue( u.getAncestorOfType(libsbml.SBML_DOCUMENT) == null );
       assertTrue( u.getAncestorOfType(libsbml.SBML_COMPARTMENT) == null );
       Unit obj = ud.getUnit(0);
       assertTrue( obj.getAncestorOfType(libsbml.SBML_UNIT_DEFINITION) == ud );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_LIST_OF) == lo );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_COMPARTMENT) == null );
       ud = null;
 }
開發者ID:alexholehouse,項目名稱:SBMLIntegrator,代碼行數:17,代碼來源:TestAncestor.cs

示例6: 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() );
 }
開發者ID:alexholehouse,項目名稱:SBMLIntegrator,代碼行數:12,代碼來源:TestSBMLParentObject.cs

示例7: 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 );
 }
開發者ID:alexholehouse,項目名稱:SBMLIntegrator,代碼行數:15,代碼來源:TestAncestor.cs

示例8: test_Model_getUnitDefinitionById

 public void test_Model_getUnitDefinitionById()
 {
     UnitDefinition ud1 = new  UnitDefinition(2,4);
       UnitDefinition ud2 = new  UnitDefinition(2,4);
       ud1.setId( "mmls"   );
       ud2.setId( "volume" );
       ud1.createUnit();
       ud2.createUnit();
       M.addUnitDefinition(ud1);
       M.addUnitDefinition(ud2);
       assertTrue( M.getNumUnitDefinitions() == 2 );
       assertNotEquals(M.getUnitDefinition( "mmls"       ),ud1);
       assertNotEquals(M.getUnitDefinition( "volume"     ),ud2);
       assertEquals(M.getUnitDefinition( "rototillers"),null);
 }
開發者ID:TotteKarlsson,項目名稱:roadrunner,代碼行數:15,代碼來源:TestModel.cs

示例9: test_Model_getUnitDefinition

 public void test_Model_getUnitDefinition()
 {
     UnitDefinition ud1 = new  UnitDefinition(2,4);
       UnitDefinition ud2 = new  UnitDefinition(2,4);
       ud1.setId( "mmls"   );
       ud2.setId( "volume" );
       ud1.createUnit();
       ud2.createUnit();
       M.addUnitDefinition(ud1);
       M.addUnitDefinition(ud2);
       assertTrue( M.getNumUnitDefinitions() == 2 );
       ud1 = M.getUnitDefinition(0);
       ud2 = M.getUnitDefinition(1);
       assertTrue((  "mmls"    == ud1.getId() ));
       assertTrue((  "volume"  == ud2.getId() ));
 }
開發者ID:TotteKarlsson,項目名稱:roadrunner,代碼行數:16,代碼來源:TestModel.cs

示例10: test_Model_add_get_UnitDefinitions

 public void test_Model_add_get_UnitDefinitions()
 {
     UnitDefinition ud1 = new  UnitDefinition(2,4);
       UnitDefinition ud2 = new  UnitDefinition(2,4);
       ud1.setId( "ud1");
       ud2.setId( "ud2");
       ud1.createUnit();
       ud2.createUnit();
       M.addUnitDefinition(ud1);
       M.addUnitDefinition(ud2);
       assertTrue( M.getNumUnitDefinitions() == 2 );
       assertNotEquals(M.getUnitDefinition(0),ud1);
       assertNotEquals(M.getUnitDefinition(1),ud2);
       assertEquals(M.getUnitDefinition(2),null);
 }
開發者ID:TotteKarlsson,項目名稱:roadrunner,代碼行數:15,代碼來源:TestModel.cs

示例11: test_internal_consistency_check_99905_unitdef

 public void test_internal_consistency_check_99905_unitdef()
 {
     SBMLDocument d = new SBMLDocument(2,4);
       long errors;
       UnitDefinition u = new UnitDefinition(2,4);
       d.setLevelAndVersion(2,2,false);
       Model m = d.createModel();
       u.setId("ud");
       u.setSBOTerm(9);
       u.createUnit();
       m.addUnitDefinition(u);
       errors = d.checkInternalConsistency();
       assertTrue( errors == 0 );
       d = null;
 }
開發者ID:alexholehouse,項目名稱:SBMLIntegrator,代碼行數:15,代碼來源:TestInternalConsistencyChecks.cs

示例12: test_internal_consistency_check_99904_unitdef

 public void test_internal_consistency_check_99904_unitdef()
 {
     SBMLDocument d = new SBMLDocument(2,4);
       long errors;
       UnitDefinition u = new UnitDefinition(2,4);
       d.setLevelAndVersion(1,2,false);
       Model m = d.createModel();
       Compartment c = m.createCompartment();
       c.setId("cc");
       u.setId("ud");
       u.setMetaId("mmm");
       u.createUnit();
       m.addUnitDefinition(u);
       errors = d.checkInternalConsistency();
       assertTrue( errors == 0 );
       d = null;
 }
開發者ID:alexholehouse,項目名稱:SBMLIntegrator,代碼行數:17,代碼來源:TestInternalConsistencyChecks.cs

示例13: test_UnitDefinition_createUnit

 public void test_UnitDefinition_createUnit()
 {
     UnitDefinition m = new  UnitDefinition(2,2);
       Unit p = m.createUnit();
       assertTrue( m.getNumUnits() == 1 );
       assertTrue( (p).getLevel() == 2 );
       assertTrue( (p).getVersion() == 2 );
       m = null;
 }
開發者ID:0u812,項目名稱:roadrunner-backup,代碼行數:9,代碼來源:TestUnitDefinition_newSetters.cs


注:本文中的libsbmlcs.UnitDefinition.createUnit方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。