本文整理汇总了C#中libsbml.ASTNode.setName方法的典型用法代码示例。如果您正苦于以下问题:C# ASTNode.setName方法的具体用法?C# ASTNode.setName怎么用?C# ASTNode.setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libsbml.ASTNode
的用法示例。
在下文中一共展示了ASTNode.setName方法的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_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;
}
示例3: test_SpeciesReference_setStoichiometryMath5
public void test_SpeciesReference_setStoichiometryMath5()
{
SpeciesReference sr1 = new SpeciesReference(1,2);
StoichiometryMath sm = new StoichiometryMath(2,4);
ASTNode math = new ASTNode(libsbml.AST_TIMES);
ASTNode a = new ASTNode();
ASTNode b = new ASTNode();
a.setName( "a");
b.setName( "b");
math.addChild(a);
math.addChild(b);
sm.setMath(math);
int i = sr1.setStoichiometryMath(sm);
assertTrue( i == libsbml.LIBSBML_UNEXPECTED_ATTRIBUTE );
assertEquals( false, sr1.isSetStoichiometryMath() );
sm = null;
sr1 = null;
}
示例4: test_KineticLaw_setMath2
public void test_KineticLaw_setMath2()
{
ASTNode math = new ASTNode(libsbml.AST_TIMES);
ASTNode a = new ASTNode();
a.setName( "a");
math.addChild(a);
int i = kl.setMath(math);
assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
assertEquals( false, kl.isSetMath() );
math = null;
}
示例5: 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;
}
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
示例9: 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;
}
示例10: 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;
}
示例11: test_ASTNode_setName
public void test_ASTNode_setName()
{
string name = "foo";
ASTNode node = new ASTNode();
assertTrue( node.getType() == libsbml.AST_UNKNOWN );
node.setName(name);
assertTrue( node.getType() == libsbml.AST_NAME );
assertTrue(( name == node.getName() ));
assertTrue( node.getCharacter() == '\0' );
assertTrue( node.getInteger() == 0 );
assertTrue( node.getReal() == 0 );
assertTrue( node.getExponent() == 0 );
assertTrue( node.getDenominator() == 1 );
if (node.getName() == name);
{
}
node.setName(null);
assertTrue( node.getType() == libsbml.AST_NAME );
if (node.getName() != null);
{
}
node.setType(libsbml.AST_FUNCTION_COS);
assertTrue( node.getType() == libsbml.AST_FUNCTION_COS );
assertTrue(( "cos" == node.getName() ));
assertTrue( node.getCharacter() == '\0' );
assertTrue( node.getInteger() == 0 );
assertTrue( node.getReal() == 0 );
assertTrue( node.getExponent() == 0 );
assertTrue( node.getDenominator() == 1 );
node.setType(libsbml.AST_PLUS);
node.setName(name);
assertTrue( node.getType() == libsbml.AST_NAME );
assertTrue(( name == node.getName() ));
assertTrue( node.getCharacter() == '+' );
assertTrue( node.getInteger() == 0 );
assertTrue( node.getReal() == 0 );
assertTrue( node.getExponent() == 0 );
assertTrue( node.getDenominator() == 1 );
node = null;
}
示例12: convertVariableName
/// <summary>
///
/// </summary>
/// <param name="anASTNode"></param>
/// <returns></returns>
private ASTNode convertVariableName(ASTNode anASTNode)
{
long aNumChildren = anASTNode.getNumChildren();
if ( aNumChildren == 2 )
{
this.convertVariableName( anASTNode.getLeftChild() );
this.convertVariableName( anASTNode.getRightChild() );
}
else if ( aNumChildren == 1 )
{
this.convertVariableName( anASTNode.getLeftChild() );
}
else if ( aNumChildren == 0 )
{
if ( anASTNode.isNumber() )
{
}
else
{
string aName = anASTNode.getName();
int aType = this.getVariableType( aName );
//# Species
if ( aType == libsbml.libsbml.SBML_SPECIES )
{
string variableName = this.setSpeciesToVariableReference( aName , 0);
if( variableName != "" )
{
anASTNode.setName( variableName + ".Value" );
return anASTNode;
}
}
//# Parameter
else if ( aType == libsbml.libsbml.SBML_PARAMETER )
{
string variableName = this.setParameterToVariableReference( aName , 0);
if( variableName != "" )
{
anASTNode.setName( variableName + ".Value" );
return anASTNode;
}
}
//# Compartment
else if (aType == libsbml.libsbml.SBML_COMPARTMENT)
{
string variableName = this.setCompartmentToVariableReference(aName, 0);
if( variableName != "" )
{
anASTNode.setName( variableName + ".Value" );
return anASTNode;
}
}
}
}
return anASTNode;
}
示例13: test_MathMLFormatter_csymbol_time
public void test_MathMLFormatter_csymbol_time()
{
string expected = wrapMathML(" <csymbol encoding=\"text\" " + "definitionURL=\"http://www.sbml.org/sbml/symbols/time\"> t </csymbol>\n");
N = new ASTNode(libsbml.AST_NAME_TIME);
N.setName("t");
S = libsbml.writeMathMLToString(N);
assertEquals( true, equals(expected,S) );
}
示例14: test_MathMLFormatter_csymbol_delay
public void test_MathMLFormatter_csymbol_delay()
{
string expected = wrapMathML(" <apply>\n" +
" <csymbol encoding=\"text\" definitionURL=\"http://www.sbml.org/sbml/" +
"symbols/delay\"> my_delay </csymbol>\n" +
" <ci> x </ci>\n" +
" <cn> 0.1 </cn>\n" +
" </apply>\n");
N = libsbml.parseFormula("delay(x, 0.1)");
N.setName("my_delay");
S = libsbml.writeMathMLToString(N);
assertEquals( true, equals(expected,S) );
}
示例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;
}