本文整理汇总了C#中libsbml.ASTNode.getType方法的典型用法代码示例。如果您正苦于以下问题:C# ASTNode.getType方法的具体用法?C# ASTNode.getType怎么用?C# ASTNode.getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libsbml.ASTNode
的用法示例。
在下文中一共展示了ASTNode.getType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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 );
}
示例2: 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;
}
示例3: 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;
}
示例4: test_ASTNode_canonicalizeRelational
public void test_ASTNode_canonicalizeRelational()
{
ASTNode n = new ASTNode(libsbml.AST_FUNCTION);
n.setName( "eq");
assertTrue( n.getType() == libsbml.AST_FUNCTION );
n.canonicalize();
assertTrue( n.getType() == libsbml.AST_RELATIONAL_EQ );
n.setType(libsbml.AST_FUNCTION);
n.setName( "geq");
assertTrue( n.getType() == libsbml.AST_FUNCTION );
n.canonicalize();
assertTrue( n.getType() == libsbml.AST_RELATIONAL_GEQ );
n.setType(libsbml.AST_FUNCTION);
n.setName( "gt");
assertTrue( n.getType() == libsbml.AST_FUNCTION );
n.canonicalize();
assertTrue( n.getType() == libsbml.AST_RELATIONAL_GT );
n.setType(libsbml.AST_FUNCTION);
n.setName( "leq");
assertTrue( n.getType() == libsbml.AST_FUNCTION );
n.canonicalize();
assertTrue( n.getType() == libsbml.AST_RELATIONAL_LEQ );
n.setType(libsbml.AST_FUNCTION);
n.setName( "lt");
assertTrue( n.getType() == libsbml.AST_FUNCTION );
n.canonicalize();
assertTrue( n.getType() == libsbml.AST_RELATIONAL_LT );
n.setType(libsbml.AST_FUNCTION);
n.setName( "neq");
assertTrue( n.getType() == libsbml.AST_FUNCTION );
n.canonicalize();
assertTrue( n.getType() == libsbml.AST_RELATIONAL_NEQ );
n.setType(libsbml.AST_FUNCTION);
n = null;
}
示例5: 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;
}
示例6: test_ASTNode_setType
public void test_ASTNode_setType()
{
ASTNode node = new ASTNode();
node.setName( "foo");
assertTrue( node.getType() == libsbml.AST_NAME );
node.setType(libsbml.AST_FUNCTION);
assertTrue( node.getType() == libsbml.AST_FUNCTION );
assertTrue(( "foo" == node.getName() ));
node.setType(libsbml.AST_NAME);
assertTrue( node.getType() == libsbml.AST_NAME );
assertTrue(( "foo" == node.getName() ));
node.setType(libsbml.AST_INTEGER);
assertTrue( node.getType() == libsbml.AST_INTEGER );
node.setType(libsbml.AST_REAL);
assertTrue( node.getType() == libsbml.AST_REAL );
node.setType(libsbml.AST_UNKNOWN);
assertTrue( node.getType() == libsbml.AST_UNKNOWN );
node.setType(libsbml.AST_PLUS);
assertTrue( node.getType() == libsbml.AST_PLUS );
assertTrue( node.getCharacter() == '+' );
node.setType(libsbml.AST_MINUS);
assertTrue( node.getType() == libsbml.AST_MINUS );
assertTrue( node.getCharacter() == '-' );
node.setType(libsbml.AST_TIMES);
assertTrue( node.getType() == libsbml.AST_TIMES );
assertTrue( node.getCharacter() == '*' );
node.setType(libsbml.AST_DIVIDE);
assertTrue( node.getType() == libsbml.AST_DIVIDE );
assertTrue( node.getCharacter() == '/' );
node.setType(libsbml.AST_POWER);
assertTrue( node.getType() == libsbml.AST_POWER );
assertTrue( node.getCharacter() == '^' );
node = null;
}
示例7: 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;
}
示例8: test_element_cn_real
public void test_element_cn_real()
{
string s = wrapMathML("<cn type='real'> 12345.7 </cn>");
N = libsbml.readMathMLFromString(s);
assertTrue( N != null );
assertTrue( N.getType() == libsbml.AST_REAL );
assertTrue( N.getReal() == 12345.7 );
assertTrue( N.getNumChildren() == 0 );
}
示例9: 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 );
}
示例10: test_element_cn_integer
public void test_element_cn_integer()
{
string s = wrapMathML("<cn type='integer'> 12345 </cn>");
N = libsbml.readMathMLFromString(s);
assertTrue( N != null );
assertTrue( N.getType() == libsbml.AST_INTEGER );
assertTrue( N.getInteger() == 12345 );
assertTrue( N.getNumChildren() == 0 );
}
示例11: 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 );
}
示例12: 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 );
}
示例13: test_element_ci_surrounding_spaces_bug
public void test_element_ci_surrounding_spaces_bug()
{
string s = wrapMathML(" <ci> s </ci> ");
N = libsbml.readMathMLFromString(s);
assertTrue( N != null );
assertTrue( N.getType() == libsbml.AST_NAME );
assertTrue(( "s" == N.getName() ));
assertTrue( N.getNumChildren() == 0 );
}
示例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_setName_override
public void test_ASTNode_setName_override()
{
ASTNode node = new ASTNode(libsbml.AST_FUNCTION_SIN);
assertTrue(( "sin" == node.getName() ));
assertTrue( node.getType() == libsbml.AST_FUNCTION_SIN );
node.setName( "MySinFunc");
assertTrue(( "MySinFunc" == node.getName() ));
assertTrue( node.getType() == libsbml.AST_FUNCTION_SIN );
node.setName(null);
assertTrue(( "sin" == node.getName() ));
assertTrue( node.getType() == libsbml.AST_FUNCTION_SIN );
node = null;
}