本文整理汇总了C#中libsbml.ASTNode类的典型用法代码示例。如果您正苦于以下问题:C# ASTNode类的具体用法?C# ASTNode怎么用?C# ASTNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ASTNode类属于libsbml命名空间,在下文中一共展示了ASTNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: test_EventAssignment_setMath2
public void test_EventAssignment_setMath2()
{
ASTNode math = new ASTNode(libsbml.AST_TIMES);
int i = E.setMath(math);
assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
assertEquals( false, E.isSetMath() );
math = null;
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:8,代码来源:TestEventAssignment_newSetters.cs
示例2: test_Constraint_setMath2
public void test_Constraint_setMath2()
{
ASTNode math = new ASTNode(libsbml.AST_TIMES);
int i = C.setMath(math);
assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
assertEquals( false, C.isSetMath() );
math = null;
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:8,代码来源:TestConstraint_newSetters.cs
示例3: test_ASTNode_addSemanticsAnnotation
public void test_ASTNode_addSemanticsAnnotation()
{
XMLNode ann = new XMLNode();
ASTNode node = new ASTNode();
int i = 0;
i = node.addSemanticsAnnotation(ann);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue( node.getNumSemanticsAnnotations() == 1 );
i = node.addSemanticsAnnotation(null);
assertTrue( i == libsbml.LIBSBML_OPERATION_FAILED );
assertTrue( node.getNumSemanticsAnnotations() == 1 );
node = null;
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:13,代码来源:TestASTNode.cs
示例4: 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;
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:24,代码来源:TestASTNode.cs
示例5: test_ASTNode_removeChild
public void test_ASTNode_removeChild()
{
ASTNode node = new ASTNode();
ASTNode c1 = new ASTNode();
ASTNode c2 = new ASTNode();
int i = 0;
node.setType(libsbml.AST_PLUS);
c1.setName( "foo");
c2.setName( "foo2");
node.addChild(c1);
node.addChild(c2);
assertTrue( node.getNumChildren() == 2 );
i = node.removeChild(0);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue( node.getNumChildren() == 1 );
i = node.removeChild(1);
assertTrue( i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE );
assertTrue( node.getNumChildren() == 1 );
i = node.removeChild(0);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue( node.getNumChildren() == 0 );
node = null;
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:23,代码来源:TestASTNode.cs
示例6: 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;
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:12,代码来源:TestASTNode.cs
示例7: 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
示例8: replaceSIDWithFunction
/**
* Replace all nodes with the name 'id' from the child 'math' object with the provided function.
*
*/
/* libsbml-internal */
public new void replaceSIDWithFunction(string id, ASTNode function)
{
libsbmlPINVOKE.Priority_replaceSIDWithFunction(swigCPtr, id, ASTNode.getCPtr(function));
}
开发者ID:kirichoi,项目名称:roadrunner,代码行数:9,代码来源:Priority.cs
示例9: 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;
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:14,代码来源:TestASTNode.cs
示例10: test_ASTNode_canonicalizeConstants
public void test_ASTNode_canonicalizeConstants()
{
ASTNode n = new ASTNode();
n.setName( "ExponentialE");
assertEquals( true, n.isName() );
n.canonicalize();
assertTrue( n.getType() == libsbml.AST_CONSTANT_E );
n.setType(libsbml.AST_NAME);
n.setName( "False");
assertEquals( true, n.isName() );
n.canonicalize();
assertTrue( n.getType() == libsbml.AST_CONSTANT_FALSE );
n.setType(libsbml.AST_NAME);
n.setName( "Pi");
assertEquals( true, n.isName() );
n.canonicalize();
assertTrue( n.getType() == libsbml.AST_CONSTANT_PI );
n.setType(libsbml.AST_NAME);
n.setName( "True");
assertEquals( true, n.isName() );
n.canonicalize();
assertTrue( n.getType() == libsbml.AST_CONSTANT_TRUE );
n.setType(libsbml.AST_NAME);
n.setName( "Foo");
assertEquals( true, n.isName() );
n.canonicalize();
assertEquals( true, n.isName() );
n = null;
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:29,代码来源:TestASTNode.cs
示例11: test_ASTNode_setCharacter
public void test_ASTNode_setCharacter()
{
ASTNode node = new ASTNode();
node.setName( "foo");
assertTrue( node.getType() == libsbml.AST_NAME );
assertTrue( node.getCharacter() == '\0' );
assertTrue(( "foo" == node.getName() ));
assertTrue( node.getInteger() == 0 );
assertTrue( node.getReal() == 0 );
assertTrue( node.getExponent() == 0 );
assertTrue( node.getDenominator() == 1 );
node.setCharacter( '+');
assertTrue( node.getType() == libsbml.AST_PLUS );
assertTrue( node.getCharacter() == '+' );
assertTrue( node.getName() == null );
assertTrue( node.getInteger() == 0 );
assertTrue( node.getReal() == 0 );
assertTrue( node.getExponent() == 0 );
assertTrue( node.getDenominator() == 1 );
node.setCharacter( '-');
assertTrue( node.getType() == libsbml.AST_MINUS );
assertTrue( node.getCharacter() == '-' );
assertTrue( node.getName() == null );
assertTrue( node.getInteger() == 0 );
assertTrue( node.getReal() == 0 );
assertTrue( node.getExponent() == 0 );
assertTrue( node.getDenominator() == 1 );
node.setCharacter( '*');
assertTrue( node.getType() == libsbml.AST_TIMES );
assertTrue( node.getCharacter() == '*' );
assertTrue( node.getName() == null );
assertTrue( node.getInteger() == 0 );
assertTrue( node.getReal() == 0 );
assertTrue( node.getExponent() == 0 );
assertTrue( node.getDenominator() == 1 );
node.setCharacter( '/');
assertTrue( node.getType() == libsbml.AST_DIVIDE );
assertTrue( node.getCharacter() == '/' );
assertTrue( node.getName() == null );
assertTrue( node.getInteger() == 0 );
assertTrue( node.getReal() == 0 );
assertTrue( node.getExponent() == 0 );
assertTrue( node.getDenominator() == 1 );
node.setCharacter( '^');
assertTrue( node.getType() == libsbml.AST_POWER );
assertTrue( node.getCharacter() == '^' );
assertTrue( node.getName() == null );
assertTrue( node.getInteger() == 0 );
assertTrue( node.getReal() == 0 );
assertTrue( node.getExponent() == 0 );
assertTrue( node.getDenominator() == 1 );
node.setCharacter( '$');
assertTrue( node.getType() == libsbml.AST_UNKNOWN );
assertTrue( node.getCharacter() == '$' );
assertTrue( node.getName() == null );
assertTrue( node.getInteger() == 0 );
assertTrue( node.getReal() == 0 );
assertTrue( node.getExponent() == 0 );
assertTrue( node.getDenominator() == 1 );
node = null;
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:61,代码来源:TestASTNode.cs
示例12: test_ASTNode_getPrecedence
public void test_ASTNode_getPrecedence()
{
ASTNode n = new ASTNode();
n.setType(libsbml.AST_PLUS);
assertTrue( n.getPrecedence() == 2 );
n.setType(libsbml.AST_MINUS);
assertTrue( n.getPrecedence() == 2 );
n.setType(libsbml.AST_TIMES);
assertTrue( n.getPrecedence() == 3 );
n.setType(libsbml.AST_DIVIDE);
assertTrue( n.getPrecedence() == 3 );
n.setType(libsbml.AST_POWER);
assertTrue( n.getPrecedence() == 4 );
n.setType(libsbml.AST_MINUS);
n.addChild(new ASTNode(libsbml.AST_NAME));
assertTrue( n.isUMinus() == true );
assertTrue( n.getPrecedence() == 5 );
n.setType(libsbml.AST_NAME);
assertTrue( n.getPrecedence() == 6 );
n.setType(libsbml.AST_FUNCTION);
assertTrue( n.getPrecedence() == 6 );
n = null;
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:23,代码来源:TestASTNode.cs
示例13: test_ASTNode_getName
public void test_ASTNode_getName()
{
ASTNode n = new ASTNode();
n.setName( "foo");
assertTrue(( "foo" == n.getName() ));
n.setType(libsbml.AST_NAME_TIME);
assertTrue(( "foo" == n.getName() ));
n.setName(null);
assertTrue( n.getName() == null );
n.setType(libsbml.AST_CONSTANT_E);
assertTrue(( "exponentiale" == n.getName() ));
n.setType(libsbml.AST_CONSTANT_FALSE);
assertTrue(( "false" == n.getName() ));
n.setType(libsbml.AST_CONSTANT_PI);
assertTrue(( "pi" == n.getName() ));
n.setType(libsbml.AST_CONSTANT_TRUE);
assertTrue(( "true" == n.getName() ));
n.setType(libsbml.AST_LAMBDA);
assertTrue(( "lambda" == n.getName() ));
n.setType(libsbml.AST_FUNCTION);
n.setName( "f");
assertTrue(( "f" == n.getName() ));
n.setType(libsbml.AST_FUNCTION_DELAY);
assertTrue(( "f" == n.getName() ));
n.setName(null);
assertTrue(( "delay" == n.getName() ));
n.setType(libsbml.AST_FUNCTION);
assertTrue( n.getName() == null );
n.setType(libsbml.AST_FUNCTION_ABS);
assertTrue(( "abs" == n.getName() ));
n.setType(libsbml.AST_FUNCTION_ARCCOS);
assertTrue(( "arccos" == n.getName() ));
n.setType(libsbml.AST_FUNCTION_TAN);
assertTrue(( "tan" == n.getName() ));
n.setType(libsbml.AST_FUNCTION_TANH);
assertTrue(( "tanh" == n.getName() ));
n.setType(libsbml.AST_LOGICAL_AND);
assertTrue(( "and" == n.getName() ));
n.setType(libsbml.AST_LOGICAL_NOT);
assertTrue(( "not" == n.getName() ));
n.setType(libsbml.AST_LOGICAL_OR);
assertTrue(( "or" == n.getName() ));
n.setType(libsbml.AST_LOGICAL_XOR);
assertTrue(( "xor" == n.getName() ));
n.setType(libsbml.AST_RELATIONAL_EQ);
assertTrue(( "eq" == n.getName() ));
n.setType(libsbml.AST_RELATIONAL_GEQ);
assertTrue(( "geq" == n.getName() ));
n.setType(libsbml.AST_RELATIONAL_LT);
assertTrue(( "lt" == n.getName() ));
n.setType(libsbml.AST_RELATIONAL_NEQ);
assertTrue(( "neq" == n.getName() ));
n = null;
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:54,代码来源:TestASTNode.cs
示例14: test_ASTNode_freeName
public void test_ASTNode_freeName()
{
ASTNode node = new ASTNode();
int i = 0;
i = node.setName( "a");
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue(( "a" == libsbml.formulaToString(node) ));
assertTrue(( "a" == node.getName() ));
i = node.freeName();
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue( node.getName() == null );
i = node.freeName();
assertTrue( i == libsbml.LIBSBML_UNEXPECTED_ATTRIBUTE );
assertTrue( node.getName() == null );
node.setType(libsbml.AST_UNKNOWN);
i = node.freeName();
assertTrue( i == libsbml.LIBSBML_UNEXPECTED_ATTRIBUTE );
assertTrue( node.getName() == null );
node = null;
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:20,代码来源:TestASTNode.cs
示例15: 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;
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:16,代码来源:TestASTNode.cs
示例16: 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;
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:16,代码来源:TestASTNode.cs
示例17: 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;
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:38,代码来源:TestASTNode.cs
示例18: test_ASTNode_avogadro
public void test_ASTNode_avogadro()
{
ASTNode n = new ASTNode();
n.setType(libsbml.AST_NAME_AVOGADRO);
n.setName( "NA");
assertTrue(( "NA" == n.getName() ));
double val = n.getReal();
assertTrue( val == 6.02214179e23 );
n = null;
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:10,代码来源:TestASTNode.cs
示例19: test_ASTNode_replaceChild
public void test_ASTNode_replaceChild()
{
ASTNode node = new ASTNode();
ASTNode c1 = new ASTNode();
ASTNode c2 = new ASTNode();
ASTNode c3 = new ASTNode();
ASTNode newc = new ASTNode();
int i = 0;
node.setType(libsbml.AST_LOGICAL_AND);
c1.setName( "a");
c2.setName( "b");
c3.setName( "c");
node.addChild(c1);
node.addChild(c2);
node.addChild(c3);
assertTrue( node.getNumChildren() == 3 );
assertTrue(( "and(a, b, c)" == libsbml.formulaToString(node) ));
newc.setName( "d");
i = node.replaceChild(0,newc);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue( node.getNumChildren() == 3 );
assertTrue(( "and(d, b, c)" == libsbml.formulaToString(node) ));
i = node.replaceChild(3,newc);
assertTrue( i == libsbml.LIBSBML_INDEX_EXCEEDS_SIZE );
assertTrue( node.getNumChildren() == 3 );
assertTrue(( "and(d, b, c)" == libsbml.formulaToString(node) ));
i = node.replaceChild(1,c1);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertTrue( node.getNumChildren() == 3 );
assertTrue(( "and(d, a, c)" == libsbml.formulaToString(node) ));
node = null;
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:32,代码来源:TestASTNode.cs
示例20: 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
注:本文中的libsbml.ASTNode类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论