本文整理汇总了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) );
}
示例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) );
}
示例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) );
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
//.........这里部分代码省略.........