当前位置: 首页>>代码示例>>C#>>正文


C# ASTNode.getLeftChild方法代码示例

本文整理汇总了C#中libsbmlcs.ASTNode.getLeftChild方法的典型用法代码示例。如果您正苦于以下问题:C# ASTNode.getLeftChild方法的具体用法?C# ASTNode.getLeftChild怎么用?C# ASTNode.getLeftChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在libsbmlcs.ASTNode的用法示例。


在下文中一共展示了ASTNode.getLeftChild方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: createExampleInvolvingUnits


//.........这里部分代码省略.........
        //
        //  <math xmlns=\"http://www.w3.org/1998/Math/MathML\">
        //   <apply>
        //     <times/>
        //     <apply>
        //       <divide/>
        //       <apply>
        //         <times/>
        //           <ci> vm </ci>
        //           <ci> s1 </ci>
        //       </apply>
        //       <apply>
        //         <plus/>
        //           <ci> km </ci>
        //           <ci> s1 </ci>
        //       </apply>
        //     </apply>
        //     <ci> cell </ci>
        //    </apply>
        //  </math>
        //---------------------------------------------------------------------------

        //
        // In the following code, ASTNode objects, which construct an ASTNode tree
        // of the above math, are created and added in the order of preorder traversal
        // of the tree (i.e. the order corresponds to the nested structure of the above
        // MathML elements), and thus the following code maybe a bit more efficient but
        // maybe a bit difficult to read.
        //

        ASTNode astMath = new ASTNode(libsbml.AST_TIMES);

        astMath.addChild(new ASTNode(libsbml.AST_DIVIDE));
        ASTNode astDivide = astMath.getLeftChild();

        astDivide.addChild(new ASTNode(libsbml.AST_TIMES));
        ASTNode astTimes = astDivide.getLeftChild();

        astTimes.addChild(new ASTNode(libsbml.AST_NAME));
        astTimes.getLeftChild().setName("vm");

        astTimes.addChild(new ASTNode(libsbml.AST_NAME));
        astTimes.getRightChild().setName("s1");

        astDivide.addChild(new ASTNode(libsbml.AST_PLUS));
        ASTNode astPlus = astDivide.getRightChild();

        astPlus.addChild(new ASTNode(libsbml.AST_NAME));
        astPlus.getLeftChild().setName("km");

        astPlus.addChild(new ASTNode(libsbml.AST_NAME));
        astPlus.getRightChild().setName("s1");

        astMath.addChild(new ASTNode(libsbml.AST_NAME));
        astMath.getRightChild().setName("cell");

        //---------------------------------------------
        //
        // set the Math element
        //
        //------------------------------------------------

        kl.setMath(astMath);

        //---------------------------------------------------------------------------
        // (Reaction2) Creates a Reaction object ("v2").
开发者ID:sys-bio,项目名称:libroadrunner-deps,代码行数:67,代码来源:createExampleSBML.cs

示例2: test_element_bug_csymbol_1

 public void test_element_bug_csymbol_1()
 {
     string s = wrapMathML("<apply>" +
     "  <gt/>" +
     "  <csymbol encoding='text' " +
     "    definitionURL='http://www.sbml.org/sbml/symbols/time'>time</csymbol>" +
     "  <cn>5000</cn>" +
     "</apply>");
       N = libsbml.readMathMLFromString(s);
       assertTrue( N != null );
       assertTrue( N.getType() == libsbml.AST_RELATIONAL_GT );
       assertTrue( N.getNumChildren() == 2 );
       ASTNode c = N.getLeftChild();
       assertTrue( c != null );
       assertTrue( c.getType() == libsbml.AST_NAME_TIME );
       assertTrue((  "time" == c.getName() ));
       assertTrue( c.getNumChildren() == 0 );
       c = N.getRightChild();
       assertTrue( c != null );
       assertTrue( c.getType() == libsbml.AST_REAL );
       assertTrue( c.getReal() == 5000 );
       assertTrue( c.getNumChildren() == 0 );
 }
开发者ID:TotteKarlsson,项目名称:roadrunner,代码行数:23,代码来源:TestReadMathML.cs

示例3: test_element_bug_csymbol_delay_1

 public void test_element_bug_csymbol_delay_1()
 {
     string s = wrapMathML("<apply>" +
     "  <csymbol encoding='text' definitionURL='http://www.sbml.org/sbml/" +
     "symbols/delay'> my_delay </csymbol>" +
     "  <ci> x </ci>" +
     "  <cn> 0.1 </cn>" +
     "</apply>\n");
       N = libsbml.readMathMLFromString(s);
       assertTrue( N != null );
       assertTrue( N.getType() == libsbml.AST_FUNCTION_DELAY );
       assertTrue((  "my_delay" == N.getName() ));
       assertTrue( N.getNumChildren() == 2 );
       ASTNode c = N.getLeftChild();
       assertTrue( c != null );
       assertTrue( c.getType() == libsbml.AST_NAME );
       assertTrue((  "x" == c.getName() ));
       assertTrue( c.getNumChildren() == 0 );
       c = N.getRightChild();
       assertTrue( c != null );
       assertTrue( c.getType() == libsbml.AST_REAL );
       assertTrue( c.getReal() == 0.1 );
       assertTrue( c.getNumChildren() == 0 );
 }
开发者ID:TotteKarlsson,项目名称:roadrunner,代码行数:24,代码来源:TestReadMathML.cs

示例4: test_element_bug_apply_ci_1

 public void test_element_bug_apply_ci_1()
 {
     string s = wrapMathML("<apply>" +
     "  <ci> Y </ci>" +
     "  <cn> 1 </cn>" +
     "</apply>");
       N = libsbml.readMathMLFromString(s);
       assertTrue( N != null );
       assertTrue( N.getType() == libsbml.AST_FUNCTION );
       assertTrue((  "Y" == N.getName() ));
       assertTrue( N.getNumChildren() == 1 );
       ASTNode c = N.getLeftChild();
       assertTrue( c != null );
       assertTrue( c.getType() == libsbml.AST_REAL );
       assertTrue( c.getReal() == 1 );
       assertTrue( c.getNumChildren() == 0 );
 }
开发者ID:TotteKarlsson,项目名称:roadrunner,代码行数:17,代码来源:TestReadMathML.cs

示例5: test_element_bug_apply_ci_2

 public void test_element_bug_apply_ci_2()
 {
     string s = wrapMathML("<apply>" +
     "  <ci> Y </ci>" +
     "  <csymbol encoding='text' " +
     "   definitionURL='http://www.sbml.org/sbml/symbols/time'> t </csymbol>" +
     "</apply>");
       N = libsbml.readMathMLFromString(s);
       assertTrue( N != null );
       assertTrue( N.getType() == libsbml.AST_FUNCTION );
       assertTrue((  "Y" == N.getName() ));
       assertTrue( N.getNumChildren() == 1 );
       ASTNode c = N.getLeftChild();
       assertTrue( c != null );
       assertTrue( c.getType() == libsbml.AST_NAME_TIME );
       assertTrue((  "t" == c.getName() ));
       assertTrue( c.getNumChildren() == 0 );
 }
开发者ID:TotteKarlsson,项目名称:roadrunner,代码行数:18,代码来源:TestReadMathML.cs

示例6: test_ASTNode_one_child

 public void test_ASTNode_one_child()
 {
     ASTNode node = new  ASTNode();
       ASTNode child = new  ASTNode();
       node.addChild(child);
       assertTrue( node.getNumChildren() == 1 );
       assertTrue( node.getLeftChild() == child );
       assertTrue( node.getRightChild() == null );
       assertTrue( node.getChild(0) == child );
       assertTrue( node.getChild(1) == null );
       node = null;
 }
开发者ID:TotteKarlsson,项目名称:roadrunner,代码行数:12,代码来源:TestASTNode.cs

示例7: test_ASTNode_no_children

 public void test_ASTNode_no_children()
 {
     ASTNode node = new  ASTNode();
       assertTrue( node.getNumChildren() == 0 );
       assertTrue( node.getLeftChild() == null );
       assertTrue( node.getRightChild() == null );
       assertTrue( node.getChild(0) == null );
       node = null;
 }
开发者ID:TotteKarlsson,项目名称:roadrunner,代码行数:9,代码来源:TestASTNode.cs

示例8: test_ASTNode_deepCopy_1

 public void test_ASTNode_deepCopy_1()
 {
     ASTNode node = new  ASTNode();
       ASTNode child, copy;
       node.setCharacter( '+');
       node.addChild(new  ASTNode());
       node.addChild(new  ASTNode());
       node.getLeftChild().setValue(1);
       node.getRightChild().setValue(2);
       assertTrue( node.getType() == libsbml.AST_PLUS );
       assertTrue( node.getCharacter() == '+' );
       assertTrue( node.getNumChildren() == 2 );
       child = node.getLeftChild();
       assertTrue( child.getType() == libsbml.AST_INTEGER );
       assertTrue( child.getInteger() == 1 );
       assertTrue( child.getNumChildren() == 0 );
       child = node.getRightChild();
       assertTrue( child.getType() == libsbml.AST_INTEGER );
       assertTrue( child.getInteger() == 2 );
       assertTrue( child.getNumChildren() == 0 );
       copy = node.deepCopy();
       assertTrue( copy != node );
       assertTrue( copy.getType() == libsbml.AST_PLUS );
       assertTrue( copy.getCharacter() == '+' );
       assertTrue( copy.getNumChildren() == 2 );
       child = copy.getLeftChild();
       assertTrue( child != node.getLeftChild() );
       assertTrue( child.getType() == libsbml.AST_INTEGER );
       assertTrue( child.getInteger() == 1 );
       assertTrue( child.getNumChildren() == 0 );
       child = copy.getRightChild();
       assertTrue( child != node.getRightChild() );
       assertTrue( child.getType() == libsbml.AST_INTEGER );
       assertTrue( child.getInteger() == 2 );
       assertTrue( child.getNumChildren() == 0 );
       node = null;
       copy = null;
 }
开发者ID:TotteKarlsson,项目名称:roadrunner,代码行数:38,代码来源:TestASTNode.cs

示例9: test_ASTNode_children

 public void test_ASTNode_children()
 {
     ASTNode parent = new  ASTNode();
       ASTNode left = new  ASTNode();
       ASTNode right = new  ASTNode();
       ASTNode right2 = new  ASTNode();
       parent.setType(libsbml.AST_PLUS);
       left.setValue(1);
       right.setValue(2);
       right2.setValue(3);
       parent.addChild(left);
       parent.addChild(right);
       assertTrue( parent.getNumChildren() == 2 );
       assertTrue( left.getNumChildren() == 0 );
       assertTrue( right.getNumChildren() == 0 );
       assertTrue( parent.getLeftChild() == left );
       assertTrue( parent.getRightChild() == right );
       assertTrue( parent.getChild(0) == left );
       assertTrue( parent.getChild(1) == right );
       assertTrue( parent.getChild(2) == null );
       parent.addChild(right2);
       assertTrue( parent.getNumChildren() == 3 );
       assertTrue( left.getNumChildren() == 0 );
       assertTrue( right.getNumChildren() == 0 );
       assertTrue( right2.getNumChildren() == 0 );
       assertTrue( parent.getLeftChild() == left );
       assertTrue( parent.getRightChild() == right2 );
       assertTrue( parent.getChild(0) == left );
       assertTrue( parent.getChild(1) == right );
       assertTrue( parent.getChild(2) == right2 );
       assertTrue( parent.getChild(3) == null );
       parent = null;
 }
开发者ID:TotteKarlsson,项目名称:roadrunner,代码行数:33,代码来源:TestASTNode.cs

示例10: test_ASTNode_canonicalizeFunctionsL1

 public void test_ASTNode_canonicalizeFunctionsL1()
 {
     ASTNode n = new  ASTNode(libsbml.AST_FUNCTION);
       ASTNode c;
       n.setName( "acos");
       assertTrue( n.getType() == libsbml.AST_FUNCTION );
       n.canonicalize();
       assertTrue( n.getType() == libsbml.AST_FUNCTION_ARCCOS );
       n.setType(libsbml.AST_FUNCTION);
       n.setName( "asin");
       assertTrue( n.getType() == libsbml.AST_FUNCTION );
       n.canonicalize();
       assertTrue( n.getType() == libsbml.AST_FUNCTION_ARCSIN );
       n.setType(libsbml.AST_FUNCTION);
       n.setName( "atan");
       assertTrue( n.getType() == libsbml.AST_FUNCTION );
       n.canonicalize();
       assertTrue( n.getType() == libsbml.AST_FUNCTION_ARCTAN );
       n.setType(libsbml.AST_FUNCTION);
       n.setName( "ceil");
       assertTrue( n.getType() == libsbml.AST_FUNCTION );
       n.canonicalize();
       assertTrue( n.getType() == libsbml.AST_FUNCTION_CEILING );
       n.setType(libsbml.AST_FUNCTION);
       n.setName( "pow");
       assertTrue( n.getType() == libsbml.AST_FUNCTION );
       n.canonicalize();
       assertTrue( n.getType() == libsbml.AST_FUNCTION_POWER );
       n = null;
       n = new  ASTNode(libsbml.AST_FUNCTION);
       n.setName( "log");
       c = new  ASTNode();
       c.setName( "x");
       n.addChild(c);
       assertTrue( n.getType() == libsbml.AST_FUNCTION );
       assertTrue( n.getNumChildren() == 1 );
       n.canonicalize();
       assertTrue( n.getType() == libsbml.AST_FUNCTION_LN );
       assertTrue( n.getNumChildren() == 1 );
       n.setType(libsbml.AST_FUNCTION);
       c = new  ASTNode();
       c.setName( "y");
       n.addChild(c);
       assertTrue( n.getType() == libsbml.AST_FUNCTION );
       assertTrue( n.getNumChildren() == 2 );
       n.canonicalize();
       assertTrue( n.getType() == libsbml.AST_FUNCTION_LOG );
       n = null;
       n = new  ASTNode(libsbml.AST_FUNCTION);
       n.setName( "log10");
       c = new  ASTNode();
       c.setName( "x");
       n.addChild(c);
       assertTrue( n.getType() == libsbml.AST_FUNCTION );
       assertTrue( n.getNumChildren() == 1 );
       n.canonicalize();
       assertTrue( n.getType() == libsbml.AST_FUNCTION_LOG );
       assertTrue( n.getNumChildren() == 2 );
       c = n.getLeftChild();
       assertTrue( c.getType() == libsbml.AST_INTEGER );
       assertTrue( c.getInteger() == 10 );
       c = n.getRightChild();
       assertTrue( c.getType() == libsbml.AST_NAME );
       assertTrue((  "x" == c.getName() ));
       n = null;
       n = new  ASTNode(libsbml.AST_FUNCTION);
       n.setName( "sqr");
       c = new  ASTNode();
       c.setName( "x");
       n.addChild(c);
       assertTrue( n.getType() == libsbml.AST_FUNCTION );
       assertTrue( n.getNumChildren() == 1 );
       n.canonicalize();
       assertTrue( n.getType() == libsbml.AST_FUNCTION_POWER );
       assertTrue( n.getNumChildren() == 2 );
       c = n.getLeftChild();
       assertTrue( c.getType() == libsbml.AST_NAME );
       assertTrue((  "x" == c.getName() ));
       c = n.getRightChild();
       assertTrue( c.getType() == libsbml.AST_INTEGER );
       assertTrue( c.getInteger() == 2 );
       n = null;
       n = new  ASTNode(libsbml.AST_FUNCTION);
       n.setName( "sqrt");
       c = new  ASTNode();
       c.setName( "x");
       n.addChild(c);
       assertTrue( n.getType() == libsbml.AST_FUNCTION );
       assertTrue( n.getNumChildren() == 1 );
       n.canonicalize();
       assertTrue( n.getType() == libsbml.AST_FUNCTION_ROOT );
       assertTrue( n.getNumChildren() == 2 );
       c = n.getLeftChild();
       assertTrue( c.getType() == libsbml.AST_INTEGER );
       assertTrue( c.getInteger() == 2 );
       c = n.getRightChild();
       assertTrue( c.getType() == libsbml.AST_NAME );
       assertTrue((  "x" == c.getName() ));
       n = null;
 }
开发者ID:TotteKarlsson,项目名称:roadrunner,代码行数:100,代码来源:TestASTNode.cs


注:本文中的libsbmlcs.ASTNode.getLeftChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。