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


C# ASTNode.addChild方法代碼示例

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


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

示例1: test_ValidASTNode_binary

 public void test_ValidASTNode_binary()
 {
     ASTNode n = new ASTNode(libsbml.AST_DIVIDE);
       assertEquals( false, (n.isWellFormedASTNode()) );
       ASTNode c = libsbml.parseFormula("c");
       n.addChild(c);
       assertEquals( false, (n.isWellFormedASTNode()) );
       ASTNode d = libsbml.parseFormula("d");
       n.addChild(d);
       assertEquals( true, n.isWellFormedASTNode() );
       n = null;
 }
開發者ID:,項目名稱:,代碼行數:12,代碼來源:

示例2: test_ValidASTNode_lambda

 public void test_ValidASTNode_lambda()
 {
     ASTNode n = new ASTNode(libsbml.AST_LAMBDA);
       assertEquals( false, (n.isWellFormedASTNode()) );
       ASTNode c = libsbml.parseFormula("c");
       n.addChild(c);
       assertEquals( true, n.isWellFormedASTNode() );
       ASTNode d = libsbml.parseFormula("d");
       n.addChild(d);
       assertEquals( true, n.isWellFormedASTNode() );
       ASTNode e = libsbml.parseFormula("e");
       n.addChild(e);
       assertEquals( true, n.isWellFormedASTNode() );
       n = null;
 }
開發者ID:alexholehouse,項目名稱:SBMLIntegrator,代碼行數:15,代碼來源:TestValidASTNode.cs

示例3: test_ASTNode_addChild1

 public void test_ASTNode_addChild1()
 {
     ASTNode node = new  ASTNode();
       ASTNode c1 = new  ASTNode();
       ASTNode c2 = new  ASTNode();
       ASTNode c1_1 = new  ASTNode();
       int i = 0;
       node.setType(libsbml.AST_LOGICAL_AND);
       c1.setName( "a");
       c2.setName( "b");
       node.addChild(c1);
       node.addChild(c2);
       assertTrue( node.getNumChildren() == 2 );
       assertTrue((  "and(a, b)" == libsbml.formulaToString(node) ));
       c1_1.setName( "d");
       i = node.addChild(c1_1);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( node.getNumChildren() == 3 );
       assertTrue((  "and(a, b, d)" == libsbml.formulaToString(node) ));
       assertTrue((  "a" == node.getChild(0).getName() ));
       assertTrue((  "b" == node.getChild(1).getName() ));
       assertTrue((  "d" == node.getChild(2).getName() ));
       node = null;
 }
開發者ID:TotteKarlsson,項目名稱:roadrunner,代碼行數:24,代碼來源:TestASTNode.cs

示例4: test_ASTNode_removeChild

 public void test_ASTNode_removeChild()
 {
     ASTNode node = new  ASTNode();
       ASTNode c1 = new  ASTNode();
       ASTNode c2 = new  ASTNode();
       int i = 0;
       node.setType(libsbml.AST_PLUS);
       c1.setName( "foo");
       c2.setName( "foo2");
       node.addChild(c1);
       node.addChild(c2);
       assertTrue( node.getNumChildren() == 2 );
       i = node.removeChild(0);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( node.getNumChildren() == 1 );
       i = node.removeChild(1);
       assertTrue( i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE );
       assertTrue( node.getNumChildren() == 1 );
       i = node.removeChild(0);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( node.getNumChildren() == 0 );
       node = null;
 }
開發者ID:TotteKarlsson,項目名稱:roadrunner,代碼行數:23,代碼來源:TestASTNode.cs

示例5: test_ASTNode_replaceChild

 public void test_ASTNode_replaceChild()
 {
     ASTNode node = new  ASTNode();
       ASTNode c1 = new  ASTNode();
       ASTNode c2 = new  ASTNode();
       ASTNode c3 = new  ASTNode();
       ASTNode newc = new  ASTNode();
       int i = 0;
       node.setType(libsbml.AST_LOGICAL_AND);
       c1.setName( "a");
       c2.setName( "b");
       c3.setName( "c");
       node.addChild(c1);
       node.addChild(c2);
       node.addChild(c3);
       assertTrue( node.getNumChildren() == 3 );
       assertTrue((  "and(a, b, c)" == libsbml.formulaToString(node) ));
       newc.setName( "d");
       i = node.replaceChild(0,newc);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( node.getNumChildren() == 3 );
       assertTrue((  "and(d, b, c)" == libsbml.formulaToString(node) ));
       i = node.replaceChild(3,newc);
       assertTrue( i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE );
       assertTrue( node.getNumChildren() == 3 );
       assertTrue((  "and(d, b, c)" == libsbml.formulaToString(node) ));
       i = node.replaceChild(1,c1);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( node.getNumChildren() == 3 );
       assertTrue((  "and(d, a, c)" == libsbml.formulaToString(node) ));
       node = null;
 }
開發者ID:TotteKarlsson,項目名稱:roadrunner,代碼行數:32,代碼來源:TestASTNode.cs

示例6: test_ASTNode_isUMinus

 public void test_ASTNode_isUMinus()
 {
     ASTNode n = new  ASTNode();
       n.setType(libsbml.AST_MINUS);
       assertTrue( n.isUMinus() == false );
       n.addChild(new  ASTNode(libsbml.AST_NAME));
       assertTrue( n.isUMinus() == true );
       n = null;
 }
開發者ID:TotteKarlsson,項目名稱:roadrunner,代碼行數:9,代碼來源:TestASTNode.cs

示例7: 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

示例8: test_ASTNode_getPrecedence

 public void test_ASTNode_getPrecedence()
 {
     ASTNode n = new  ASTNode();
       n.setType(libsbml.AST_PLUS);
       assertTrue( n.getPrecedence() == 2 );
       n.setType(libsbml.AST_MINUS);
       assertTrue( n.getPrecedence() == 2 );
       n.setType(libsbml.AST_TIMES);
       assertTrue( n.getPrecedence() == 3 );
       n.setType(libsbml.AST_DIVIDE);
       assertTrue( n.getPrecedence() == 3 );
       n.setType(libsbml.AST_POWER);
       assertTrue( n.getPrecedence() == 4 );
       n.setType(libsbml.AST_MINUS);
       n.addChild(new  ASTNode(libsbml.AST_NAME));
       assertTrue( n.isUMinus() == true );
       assertTrue( n.getPrecedence() == 5 );
       n.setType(libsbml.AST_NAME);
       assertTrue( n.getPrecedence() == 6 );
       n.setType(libsbml.AST_FUNCTION);
       assertTrue( n.getPrecedence() == 6 );
       n = null;
 }
開發者ID:TotteKarlsson,項目名稱:roadrunner,代碼行數:23,代碼來源:TestASTNode.cs

示例9: test_ASTNode_isSqrt

 public void test_ASTNode_isSqrt()
 {
     ASTNode n = new  ASTNode();
       ASTNode c;
       n.setType(libsbml.AST_FUNCTION);
       assertTrue( n.isSqrt() == false );
       n.setType(libsbml.AST_FUNCTION_ROOT);
       assertTrue( n.isSqrt() == false );
       c = new  ASTNode();
       n.addChild(c);
       c.setValue(2);
       assertTrue( n.isSqrt() == false );
       n.addChild(new  ASTNode());
       assertTrue( n.isSqrt() == true );
       c.setValue(3);
       assertTrue( n.isSqrt() == false );
       n = null;
 }
開發者ID:TotteKarlsson,項目名稱:roadrunner,代碼行數:18,代碼來源:TestASTNode.cs

示例10: createExampleEnzymaticReaction


//.........這裏部分代碼省略.........
        //
        //------------------------------------------

        ASTNode astCytosol = new ASTNode(libsbml.AST_NAME);
        astCytosol.setName("cytosol");

        ASTNode astKon = new ASTNode(libsbml.AST_NAME);
        astKon.setName("kon");

        ASTNode astKoff = new ASTNode(libsbml.AST_NAME);
        astKoff.setName("koff");

        ASTNode astE = new ASTNode(libsbml.AST_NAME);
        astE.setName("E");

        ASTNode astS = new ASTNode(libsbml.AST_NAME);
        astS.setName("S");

        ASTNode astES = new ASTNode(libsbml.AST_NAME);
        astES.setName("ES");

        //--------------------------------------------
        //
        // create node representing
        //            <apply>
        //              <times/>
        //              <ci> koff </ci>
        //              <ci> ES </ci>
        //            </apply>
        //
        //--------------------------------------------

        ASTNode astTimes1 = new ASTNode(libsbml.AST_TIMES);
        astTimes1.addChild(astKoff);
        astTimes1.addChild(astES);

        //--------------------------------------------
        //
        // create node representing
        //            <apply>
        //              <times/>
        //              <ci> kon </ci>
        //              <ci> E </ci>
        //              <ci> S </ci>
        //            </apply>
        //
        //
        // (NOTES)
        //
        //  Since there is a restriction with an ASTNode of "<times/>" operation
        //  such that the ASTNode is a binary class and thus only two operands can
        //  be directly added, the following code in this comment block is invalid
        //  because the code directly adds three <ci> ASTNodes to <times/> ASTNode.
        //
        //    ASTNode *astTimes = new ASTNode(libsbml.AST_TIMES);
        //    astTimes.addChild(astKon);
        //    astTimes.addChild(astE);
        //    astTimes.addChild(astS);
        //
        // The following valid code after this comment block creates the ASTNode
        // as a binary tree.
        //
        // Please see "Converting between ASTs and text strings" described
        // at http://sbml.org/Software/libSBML/docs/cpp-api/class_a_s_t_node.html
        // for the detailed information.
        //
開發者ID:sys-bio,項目名稱:libroadrunner-deps,代碼行數:67,代碼來源:createExampleSBML.cs

示例11: test_Rule_setMath2

 public void test_Rule_setMath2()
 {
     ASTNode math = new  ASTNode(libsbml.AST_DIVIDE);
       ASTNode a = new  ASTNode();
       a.setName( "a");
       math.addChild(a);
       int i = R.setMath(math);
       assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
       assertEquals( false, R.isSetMath() );
       math = null;
 }
開發者ID:0u812,項目名稱:roadrunner-backup,代碼行數:11,代碼來源:TestRule_newSetters.cs

示例12: 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

示例13: test_ValidASTNode_root

 public void test_ValidASTNode_root()
 {
     ASTNode n = new ASTNode(libsbml.AST_FUNCTION_ROOT);
       assertEquals( false, (n.isWellFormedASTNode()) );
       ASTNode c = libsbml.parseFormula("c");
       n.addChild(c);
       assertEquals( true, n.isWellFormedASTNode() );
       ASTNode d = libsbml.parseFormula("3");
       n.addChild(d);
       assertEquals( true, n.isWellFormedASTNode() );
       ASTNode e = libsbml.parseFormula("3");
       n.addChild(e);
       assertEquals( false, (n.isWellFormedASTNode()) );
       n = null;
 }
開發者ID:,項目名稱:,代碼行數:15,代碼來源:

示例14: test_SpeciesReference_setStoichiometryMath2

 public void test_SpeciesReference_setStoichiometryMath2()
 {
     StoichiometryMath sm = new  StoichiometryMath(2,4);
       ASTNode math = new  ASTNode(libsbml.AST_TIMES);
       ASTNode a = new  ASTNode();
       a.setName( "a");
       math.addChild(a);
       sm.setMath(math);
       int i = sr.setStoichiometryMath(sm);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertEquals( true, sr.isSetStoichiometryMath() );
       sm = null;
 }
開發者ID:0u812,項目名稱:roadrunner-backup,代碼行數:13,代碼來源:TestSpeciesReference_newSetters.cs

示例15: test_KineticLaw_setMath2

 public void test_KineticLaw_setMath2()
 {
     ASTNode math = new  ASTNode(libsbml.AST_TIMES);
       ASTNode a = new  ASTNode();
       a.setName( "a");
       math.addChild(a);
       int i = kl.setMath(math);
       assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
       assertEquals( false, kl.isSetMath() );
       math = null;
 }
開發者ID:alexholehouse,項目名稱:SBMLIntegrator,代碼行數:11,代碼來源:TestKineticLaw_newSetters.cs


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