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


C# ASTNode.setValue方法代码示例

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


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

示例1: 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:mgaldzic,项目名称:copasi_api,代码行数:18,代码来源:TestASTNode.cs

示例2: test_ASTNode_setInteger

 public void test_ASTNode_setInteger()
 {
     ASTNode node = new  ASTNode();
       node.setName( "foo");
       assertTrue( node.getType() == libsbml.AST_NAME );
       assertTrue((  "foo" == node.getName() ));
       assertTrue( node.getCharacter() == '\0' );
       assertTrue( node.getInteger() == 0 );
       assertTrue( node.getReal() == 0 );
       assertTrue( node.getExponent() == 0 );
       assertTrue( node.getDenominator() == 1 );
       node.setValue(3.2);
       assertTrue( node.getType() == libsbml.AST_REAL );
       assertTrue( node.getInteger() == 0 );
       assertTrue( node.getName() == null );
       assertTrue( node.getCharacter() == '\0' );
       assertTrue( node.getReal() == 3.2 );
       assertTrue( node.getExponent() == 0 );
       assertTrue( node.getDenominator() == 1 );
       node.setValue(321);
       assertTrue( node.getType() == libsbml.AST_INTEGER );
       assertTrue( node.getInteger() == 321 );
       assertTrue( node.getName() == null );
       assertTrue( node.getCharacter() == '\0' );
       assertTrue( node.getReal() == 0 );
       assertTrue( node.getExponent() == 0 );
       assertTrue( node.getDenominator() == 1 );
       node = null;
 }
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:29,代码来源:TestASTNode.cs

示例3: 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:mgaldzic,项目名称:copasi_api,代码行数:33,代码来源:TestASTNode.cs

示例4: test_ASTNode_getReal

 public void test_ASTNode_getReal()
 {
     ASTNode n = new  ASTNode();
       n.setType(libsbml.AST_REAL);
       n.setValue(1.6);
       assertTrue( n.getReal() == 1.6 );
       n.setType(libsbml.AST_REAL_E);
       n.setValue(12.3,3);
       double val = Math.Abs(n.getReal() - 12300.0);
       assertTrue( val < DBL_EPSILON );
       n.setType(libsbml.AST_RATIONAL);
       n.setValue(1,2);
       assertTrue( n.getReal() == 0.5 );
       n = null;
 }
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:15,代码来源:TestASTNode.cs

示例5: test_ASTNode_units

 public void test_ASTNode_units()
 {
     ASTNode n = new  ASTNode();
       n.setType(libsbml.AST_REAL);
       n.setValue(1.6);
       int i = n.setUnits( "mole");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( n.isSetUnits() == true );
       assertTrue((  "mole" == n.getUnits() ));
       i = n.unsetUnits();
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( n.isSetUnits() == false );
       assertTrue((  "" == n.getUnits() ));
       i = n.setUnits( "1mole");
       assertTrue( i == libsbml.LIBSBML_INVALID_ATTRIBUTE_VALUE );
       assertTrue( n.isSetUnits() == false );
       n.setType(libsbml.AST_FUNCTION);
       i = n.setUnits( "mole");
       assertTrue( i == libsbml.LIBSBML_UNEXPECTED_ATTRIBUTE );
       assertTrue( n.isSetUnits() == false );
       assertTrue((  "" == n.getUnits() ));
       n = null;
 }
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:23,代码来源:TestASTNode.cs

示例6: test_ASTNode_setReal

 public void test_ASTNode_setReal()
 {
     ASTNode node = new  ASTNode();
       node.setName( "foo");
       assertTrue( node.getType() == libsbml.AST_NAME );
       node.setValue(32.1);
       assertTrue( node.getType() == libsbml.AST_REAL );
       assertTrue( node.getInteger() == 0 );
       assertTrue( node.getName() == null );
       assertTrue( node.getCharacter() == '\0' );
       assertTrue( node.getReal() == 32.1 );
       assertTrue( node.getExponent() == 0 );
       assertTrue( node.getDenominator() == 1 );
       assertTrue( node.getMantissa() == 32.1 );
       node.setValue(45,90);
       assertTrue( node.getType() == libsbml.AST_RATIONAL );
       assertTrue( node.getInteger() == 45 );
       assertTrue( node.getName() == null );
       assertTrue( node.getCharacter() == '\0' );
       assertTrue( node.getReal() == 0.5 );
       assertTrue( node.getExponent() == 0 );
       assertTrue( node.getDenominator() == 90 );
       assertTrue( node.getMantissa() == 0 );
       node.setValue(32.0,4);
       assertTrue( node.getType() == libsbml.AST_REAL_E );
       assertTrue( node.getInteger() == 0 );
       assertTrue( node.getName() == null );
       assertTrue( node.getCharacter() == '\0' );
       assertTrue( node.getReal() == 320000 );
       assertTrue( node.getExponent() == 4 );
       assertTrue( node.getDenominator() == 1 );
       assertTrue( node.getMantissa() == 32 );
       node = null;
 }
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:34,代码来源:TestASTNode.cs

示例7: test_MathMLFormatter_constant_notanumber

 public void test_MathMLFormatter_constant_notanumber()
 {
     string expected = wrapMathML("  <notanumber/>\n");
       N = new ASTNode(libsbml.AST_REAL);
       N.setValue( util_NaN() );
       S = libsbml.writeMathMLToString(N);
       assertEquals( true, equals(expected,S) );
 }
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:8,代码来源:TestWriteMathML.cs

示例8: test_MathMLFormatter_constant_infinity_neg

 public void test_MathMLFormatter_constant_infinity_neg()
 {
     string expected = wrapMathML("  <apply> <minus/> <infinity/> </apply>\n"
     );
       N = new ASTNode();
       N.setValue(- util_PosInf());
       S = libsbml.writeMathMLToString(N);
       assertEquals( true, equals(expected,S) );
 }
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:9,代码来源:TestWriteMathML.cs

示例9: test_MathMLFormatter_cn_rational

 public void test_MathMLFormatter_cn_rational()
 {
     string expected = wrapMathML("  <cn type=\"rational\"> 1 <sep/> 3 </cn>\n"
     );
       N = new ASTNode();
       N.setValue(((int) 1),3);
       S = libsbml.writeMathMLToString(N);
       assertEquals( true, equals(expected,S) );
 }
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:9,代码来源:TestWriteMathML.cs


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