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


C# ASTNode.setValue方法代碼示例

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


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

示例1: 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:alexholehouse,項目名稱:SBMLIntegrator,代碼行數:8,代碼來源:TestWriteMathML.cs

示例2: 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:alexholehouse,項目名稱:SBMLIntegrator,代碼行數:9,代碼來源:TestWriteMathML.cs

示例3: 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:alexholehouse,項目名稱:SBMLIntegrator,代碼行數:9,代碼來源:TestWriteMathML.cs

示例4: test_ASTNode_getReal

 public void test_ASTNode_getReal()
 {
     double val;
       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);
       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:TotteKarlsson,項目名稱:roadrunner,代碼行數:16,代碼來源:TestASTNode.cs

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

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

示例7: test_ASTNode_units

 public void test_ASTNode_units()
 {
     int i;
       ASTNode n = new  ASTNode();
       n.setType(libsbml.AST_REAL);
       n.setValue(1.6);
       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:TotteKarlsson,項目名稱:roadrunner,代碼行數:24,代碼來源:TestASTNode.cs

示例8: 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:TotteKarlsson,項目名稱:roadrunner,代碼行數:34,代碼來源:TestASTNode.cs

示例9: 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:TotteKarlsson,項目名稱:roadrunner,代碼行數:29,代碼來源:TestASTNode.cs

示例10: Main

    public static void Main(string[] args)
    {
        ArraysPkgNamespaces arraysNs = new ArraysPkgNamespaces();
        SBMLDocument doc = new SBMLDocument(arraysNs);
        doc.setPackageRequired("arrays", true);
        Model model = doc.createModel();

        // create parameters
        Parameter param = model.createParameter();
        param.setId("n");
        param.setValue(10);
        param.setConstant(true);

        param = model.createParameter();
        param.setId("m");
        param.setValue(10);
        param.setConstant(true);

        param = model.createParameter();
        param.setId("x");
        param.setValue(5.7);
        param.setConstant(true);

        ArraysSBasePlugin paramPlugin = (ArraysSBasePlugin) param.getPlugin("arrays");
        Dimension dim = paramPlugin.createDimension();
        dim.setId("i");
        dim.setSize("n");

        param = model.createParameter();
        param.setId("y");
        param.setConstant(false);

        paramPlugin = (ArraysSBasePlugin) param.getPlugin("arrays");
        dim = paramPlugin.createDimension();
        dim.setId("i");
        dim.setSize("n");

        param = model.createParameter();
        param.setId("z");
        param.setConstant(false);

        paramPlugin = (ArraysSBasePlugin) param.getPlugin("arrays");
        dim = paramPlugin.createDimension();
        dim.setId("i");
        dim.setSize("n");

        // create initial assignments

        InitialAssignment assignment = model.createInitialAssignment();
        assignment.setSymbol("y");
        ASTNode ast = new ASTNode(libsbml.AST_REAL);
        ast.setValue(3.2);
        assignment.setMath(ast);

        assignment = model.createInitialAssignment();
        assignment.setSymbol("z");
        ast = new ASTNode(libsbml.AST_REAL);
        ast.setValue(5.7);
        assignment.setMath(ast);

        ArraysSBasePlugin assignmentPlugin = (ArraysSBasePlugin) assignment.getPlugin("arrays");
        dim = assignmentPlugin.createDimension();
        dim.setId("i");
        dim.setSize("m");

        Index index = assignmentPlugin.createIndex();
        ASTNode newAst = new ASTNode(libsbml.AST_FUNCTION);
        newAst.setName("selector");
        ASTNode ci = new ASTNode(libsbml.AST_NAME);
        ci.setName("z");
        newAst.addChild(ci);
        ci = new ASTNode(libsbml.AST_NAME);
        ci.setName("i");
        newAst.addChild(ci);
        index.setMath(newAst);

        assignment = model.createInitialAssignment();
        assignment.setSymbol("z");
        ast = new ASTNode(libsbml.AST_REAL);
        ast.setValue(3.2);
        assignment.setMath(ast);

        assignmentPlugin = (ArraysSBasePlugin) assignment.getPlugin("arrays");
        dim = assignmentPlugin.createDimension();
        dim.setId("i");
        dim.setSize("m");

        index = assignmentPlugin.createIndex();
        newAst = new ASTNode(libsbml.AST_LINEAR_ALGEBRA_SELECTOR);
        ci = new ASTNode(libsbml.AST_NAME);
        ci.setName("z");
        newAst.addChild(ci);
        ASTNode plus = new ASTNode(libsbml.AST_PLUS);

        ci = new ASTNode(libsbml.AST_NAME);
        ci.setName("i");
        plus.addChild(ci);
        ci = new ASTNode(libsbml.AST_NAME);
        ci.setName("m");
        plus.addChild(ci);
//.........這裏部分代碼省略.........
開發者ID:sys-bio,項目名稱:libroadrunner-deps,代碼行數:101,代碼來源:CreateArrays2.cs


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