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


C# Model.getListOfRules方法代碼示例

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


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

示例1: test_AssignmentRule_parent_create

 public void test_AssignmentRule_parent_create()
 {
     Model m = new Model(2,4);
       AssignmentRule r = m.createAssignmentRule();
       ListOf lo = m.getListOfRules();
       assertTrue( lo == m.getRule(0).getParentSBMLObject() );
       assertTrue( lo == r.getParentSBMLObject() );
       assertTrue( m == lo.getParentSBMLObject() );
 }
開發者ID:mgaldzic,項目名稱:copasi_api,代碼行數:9,代碼來源:TestSBMLParentObject.cs

示例2: test_AssignmentRule_ancestor_create

 public void test_AssignmentRule_ancestor_create()
 {
     Model m = new Model(2,4);
       AssignmentRule r = m.createAssignmentRule();
       ListOf lo = m.getListOfRules();
       assertTrue( r.getAncestorOfType(libsbml.SBML_MODEL) == m );
       assertTrue( r.getAncestorOfType(libsbml.SBML_LIST_OF) == lo );
       assertTrue( r.getAncestorOfType(libsbml.SBML_DOCUMENT) == null );
       assertTrue( r.getAncestorOfType(libsbml.SBML_EVENT) == null );
       Rule obj = m.getRule(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:mgaldzic,項目名稱:copasi_api,代碼行數:15,代碼來源:TestAncestor.cs

示例3: getRule

        /// <summary>
        /// [ RuleStruct ]
        /// [[ RuleType, Formula, Variable ]]
        /// </summary>
        /// <param name="aSBMLmodel"></param>
        /// <returns></returns>
        public static List<RuleStruct> getRule(Model aSBMLmodel)
        {
            List<RuleStruct> list = new List<RuleStruct>();

            ListOfRules rules = aSBMLmodel.getListOfRules();
            for (int i = 0; i < rules.size(); i++ )
            {
                Rule aRule = aSBMLmodel.getRule(i);

                int aRuleType = aRule.getTypeCode();
                string aFormula = aRule.getFormula();
                string aVariable = null;

                if ( aRuleType == libsbml.libsbml.SBML_ALGEBRAIC_RULE )
                    aVariable = "";
                else if (aRuleType == libsbml.libsbml.SBML_ASSIGNMENT_RULE ||
                       aRuleType == libsbml.libsbml.SBML_RATE_RULE)
                    aVariable = aRule.getVariable();
                //else if (aRuleType == libsbml.libsbml.SBML_SPECIES_CONCENTRATION_RULE)
                //    aVariable = aRule.getSpecies();
                //else if (aRuleType == libsbml.libsbml.SBML_COMPARTMENT_VOLUME_RULE)
                //    aVariable = aRule.getCompartment();
                // ToDo: LibSBML3.2C#で呼び出せない。どうするか検討する。
                else if (aRuleType == libsbml.libsbml.SBML_PARAMETER_RULE)
                    aVariable = aRule.getName();
                else
                    throw new EcellException(" The type of Rule must be Algebraic, Assignment or Rate Rule");

                RuleStruct rule = new RuleStruct(
                    aRuleType,
                    aFormula,
                    aVariable );

                list.Add(rule);
            }

            return list;
        }
開發者ID:ecell,項目名稱:ecell3-ide,代碼行數:44,代碼來源:SbmlFunctions.cs

示例4: test_Rule_parent_add

 public void test_Rule_parent_add()
 {
     Rule ia = new RateRule(2,4);
       ia.setVariable("a");
       ia.setMath(libsbml.parseFormula("9"));
       Model m = new Model(2,4);
       m.addRule(ia);
       ia = null;
       ListOf lo = m.getListOfRules();
       assertTrue( lo == m.getRule(0).getParentSBMLObject() );
       assertTrue( m == lo.getParentSBMLObject() );
 }
開發者ID:mgaldzic,項目名稱:copasi_api,代碼行數:12,代碼來源:TestSBMLParentObject.cs

示例5: test_Rule_ancestor_add

 public void test_Rule_ancestor_add()
 {
     Rule ia = new RateRule(2,4);
       ia.setVariable("a");
       ia.setMath(libsbml.parseFormula("9"));
       Model m = new Model(2,4);
       m.addRule(ia);
       ia = null;
       ListOf lo = m.getListOfRules();
       Rule obj = m.getRule(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:mgaldzic,項目名稱:copasi_api,代碼行數:15,代碼來源:TestAncestor.cs

示例6: test_ReadSBML_metaid_ListOf

 public void test_ReadSBML_metaid_ListOf()
 {
     SBase sb;
       string s = wrapSBML_L2v1("<listOfFunctionDefinitions metaid='lofd'/>" +
     "<listOfUnitDefinitions     metaid='loud'/>" +
     "<listOfCompartments        metaid='loc'/>" +
     "<listOfSpecies             metaid='los'/>" +
     "<listOfParameters          metaid='lop'/>" +
     "<listOfRules               metaid='lor'/>" +
     "<listOfReactions           metaid='lorx'/>" +
     "<listOfEvents              metaid='loe'/>");
       D = libsbml.readSBMLFromString(s);
       M = D.getModel();
       assertTrue( M != null );
       sb = M.getListOfFunctionDefinitions();
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "lofd" == sb.getMetaId() ));
       sb = M.getListOfUnitDefinitions();
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "loud" == sb.getMetaId() ));
       sb = M.getListOfCompartments();
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "loc" == sb.getMetaId() ));
       sb = M.getListOfSpecies();
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "los" == sb.getMetaId() ));
       sb = M.getListOfParameters();
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "lop" == sb.getMetaId() ));
       sb = M.getListOfRules();
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "lor" == sb.getMetaId() ));
       sb = M.getListOfReactions();
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "lorx" == sb.getMetaId() ));
       sb = M.getListOfEvents();
       assertEquals( true, sb.isSetMetaId() );
       assertTrue((  "loe" == sb.getMetaId() ));
 }
開發者ID:mgaldzic,項目名稱:copasi_api,代碼行數:39,代碼來源:TestReadSBML.cs


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