本文整理汇总了C#中libsbmlcs.ASTNode.getNumChildren方法的典型用法代码示例。如果您正苦于以下问题:C# ASTNode.getNumChildren方法的具体用法?C# ASTNode.getNumChildren怎么用?C# ASTNode.getNumChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libsbmlcs.ASTNode
的用法示例。
在下文中一共展示了ASTNode.getNumChildren方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: 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 );
}
示例3: test_element_constants_notanumber
public void test_element_constants_notanumber()
{
string s = wrapMathML("<notanumber/>");
N = libsbml.readMathMLFromString(s);
assertTrue( N != null );
assertTrue( N.getType() == libsbml.AST_REAL );
assertEquals( true, isnan(N.getReal()) );
assertTrue( N.getNumChildren() == 0 );
}
示例4: test_element_csymbol_delay_1
public void test_element_csymbol_delay_1()
{
string s = wrapMathML("<csymbol encoding='text' " + "definitionURL='http://www.sbml.org/sbml/symbols/delay'> delay </csymbol>");
N = libsbml.readMathMLFromString(s);
assertTrue( N != null );
assertTrue( N.getType() == libsbml.AST_FUNCTION_DELAY );
assertTrue(( "delay" == N.getName() ));
assertTrue( N.getNumChildren() == 0 );
}
示例5: test_element_cn_rational
public void test_element_cn_rational()
{
string s = wrapMathML("<cn type='rational'> 12342 <sep/> 2342342 </cn>"
);
N = libsbml.readMathMLFromString(s);
assertTrue( N != null );
assertTrue( N.getType() == libsbml.AST_RATIONAL );
assertTrue( N.getNumerator() == 12342 );
assertTrue( N.getDenominator() == 2342342 );
assertTrue( N.getNumChildren() == 0 );
}
示例6: test_element_cn_units
public void test_element_cn_units()
{
string s = wrapMathMLUnits("<cn sbml:units=\"mole\"> 12345.7 </cn>");
N = libsbml.readMathMLFromString(s);
assertTrue( N != null );
assertTrue( N.getType() == libsbml.AST_REAL );
assertTrue( N.getReal() == 12345.7 );
assertTrue( N.getUnits() == "mole" );
assertTrue( N.getNumChildren() == 0 );
}
示例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;
}
示例8: test_element_cn_e_notation
public void test_element_cn_e_notation()
{
string s = wrapMathML("<cn type='e-notation'> 12.3 <sep/> 5 </cn>");
N = libsbml.readMathMLFromString(s);
assertTrue( N != null );
assertTrue( N.getType() == libsbml.AST_REAL_E );
assertTrue( N.getMantissa() == 12.3 );
assertTrue( N.getExponent() == 5 );
assertTrue( N.getNumChildren() == 0 );
}
示例9: test_ASTNode_deepCopy_2
public void test_ASTNode_deepCopy_2()
{
ASTNode node = new ASTNode();
ASTNode copy;
node.setName( "Foo");
assertTrue( node.getType() == libsbml.AST_NAME );
assertTrue(( "Foo" == node.getName() ));
assertTrue( node.getNumChildren() == 0 );
copy = node.deepCopy();
assertTrue( copy != node );
assertTrue( copy.getType() == libsbml.AST_NAME );
assertTrue(( "Foo" == copy.getName() ));
assertTrue( copy.getNumChildren() == 0 );
node = null;
copy = null;
}
示例10: test_ASTNode_deepCopy_4
public void test_ASTNode_deepCopy_4()
{
ASTNode node = new ASTNode(libsbml.AST_FUNCTION_ABS);
ASTNode copy;
node.setName( "ABS");
assertTrue( node.getType() == libsbml.AST_FUNCTION_ABS );
assertTrue(( "ABS" == node.getName() ));
assertTrue( node.getNumChildren() == 0 );
copy = node.deepCopy();
assertTrue( copy != node );
assertTrue( copy.getType() == libsbml.AST_FUNCTION_ABS );
assertTrue(( "ABS" == copy.getName() ));
assertTrue( copy.getNumChildren() == 0 );
node = null;
copy = null;
}
示例11: 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;
}
示例12: test_ASTNode_create
public void test_ASTNode_create()
{
ASTNode n = new ASTNode();
EventAssignment ea = new EventAssignment(2,4);
assertTrue( n.getType() == libsbml.AST_UNKNOWN );
assertTrue( n.getCharacter() == '\0' );
assertTrue( n.getName() == null );
assertTrue( n.getInteger() == 0 );
assertTrue( n.getExponent() == 0 );
assertTrue( n.getNumChildren() == 0 );
assertTrue( n.getParentSBMLObject() == null );
ea = null;
n = null;
}
示例13: 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;
}
示例14: test_element_ci_definitionURL
public void test_element_ci_definitionURL()
{
string s = wrapMathML("<ci definitionURL=\"foobar\"> x </ci>");
N = libsbml.readMathMLFromString(s);
assertTrue( N != null );
assertTrue( N.getType() == libsbml.AST_NAME );
assertTrue(( "x" == N.getName() ));
assertTrue( N.getNumChildren() == 0 );
assertTrue( N.getDefinitionURL().getValue(0) == "foobar" );
}
示例15: 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;
}