本文整理汇总了C#中libsbmlcs.ASTNode.setName方法的典型用法代码示例。如果您正苦于以下问题:C# ASTNode.setName方法的具体用法?C# ASTNode.setName怎么用?C# ASTNode.setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libsbmlcs.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_Rule_setMath2
public void test_Rule_setMath2()
{
ASTNode math = new ASTNode(libsbml.AST_DIVIDE);
ASTNode a = new ASTNode();
a.setName( "a");
math.addChild(a);
int i = R.setMath(math);
assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
assertEquals( false, R.isSetMath() );
math = null;
}
示例3: 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) );
}
示例4: test_ASTNode_avogadro_bug
public void test_ASTNode_avogadro_bug()
{
double val;
ASTNode n = new ASTNode();
n.setName( "NA");
n.setType(libsbml.AST_NAME_AVOGADRO);
assertTrue(( "NA" == n.getName() ));
val = n.getReal();
assertTrue( val == 6.02214179e23 );
assertTrue( n.isConstant() == true );
n = null;
}
示例5: 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;
}
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
示例9: test_KineticLaw_setMath1
public void test_KineticLaw_setMath1()
{
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);
string formula;
ASTNode math1;
int i = kl.setMath(math);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertEquals( true, kl.isSetMath() );
math1 = kl.getMath();
assertTrue( math1 != null );
formula = libsbml.formulaToString(math1);
assertTrue( formula != null );
assertTrue(( "a * b" == formula ));
math = null;
}
示例10: 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;
}
示例11: 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 compartment
Compartment comp = model.createCompartment();
comp.setMetaId("dd");
comp.setId("s");
comp.setConstant(true);
// set dimensions
ArraysSBasePlugin compPlugin = (ArraysSBasePlugin) comp.getPlugin("arrays");
Dimension dim = compPlugin.createDimension();
dim.setId("i");
dim.setSize("n");
// create species
Species species = model.createSpecies();
species.setId("A");
species.setCompartment("s");
species.setHasOnlySubstanceUnits(false);
species.setBoundaryCondition(false);
species.setConstant(false);
ArraysSBasePlugin splugin = (ArraysSBasePlugin) species.getPlugin("arrays");
dim = splugin.createDimension();
dim.setId("i");
dim.setSize("n");
species = model.createSpecies();
species.setId("B");
species.setCompartment("s");
species.setHasOnlySubstanceUnits(false);
species.setBoundaryCondition(false);
species.setConstant(false);
splugin = (ArraysSBasePlugin) species.getPlugin("arrays");
dim = splugin.createDimension();
dim.setId("i");
dim.setSize("n");
species = model.createSpecies();
species.setId("C");
species.setCompartment("s");
species.setHasOnlySubstanceUnits(false);
species.setBoundaryCondition(false);
species.setConstant(false);
splugin = (ArraysSBasePlugin) species.getPlugin("arrays");
dim = splugin.createDimension();
dim.setId("i");
dim.setSize("n");
// create parameter
Parameter param = model.createParameter();
param.setId("n");
param.setValue(100);
param.setConstant(true);
// create reaction
Reaction reaction = model.createReaction();
reaction.setId("reaction1");
reaction.setReversible(false);
reaction.setFast(false);
ArraysSBasePlugin reactionPlugin = (ArraysSBasePlugin) reaction.getPlugin("arrays");
dim = reactionPlugin.createDimension();
dim.setId("i");
dim.setSize("n");
SpeciesReference speciesRef = reaction.createReactant();
speciesRef.setSpecies("A");
speciesRef.setConstant(false);
ArraysSBasePlugin refPlugin = (ArraysSBasePlugin) speciesRef.getPlugin("arrays");
Index index = refPlugin.createIndex();
ASTNode ast = new ASTNode(libsbml.AST_LINEAR_ALGEBRA_SELECTOR);
ASTNode ci = new ASTNode(libsbml.AST_NAME);
ci.setName("A");
ast.addChild(ci);
ci = new ASTNode(libsbml.AST_NAME);
ci.setName("i");
ast.addChild(ci);
index.setMath(ast);
speciesRef = reaction.createProduct();
speciesRef.setSpecies("C");
speciesRef.setConstant(false);
refPlugin = (ArraysSBasePlugin) speciesRef.getPlugin("arrays");
index = refPlugin.createIndex();
ast = new ASTNode(libsbml.AST_LINEAR_ALGEBRA_SELECTOR);
ci = new ASTNode(libsbml.AST_NAME);
ci.setName("C");
ast.addChild(ci);
ci = new ASTNode(libsbml.AST_NAME);
ci.setName("i");
ast.addChild(ci);
index.setMath(ast);
//.........这里部分代码省略.........
示例12: 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;
}
示例13: test_SpeciesReference_setStoichiometryMath2
public void test_SpeciesReference_setStoichiometryMath2()
{
StoichiometryMath sm = new StoichiometryMath(2,4);
ASTNode math = new ASTNode(libsbml.AST_TIMES);
ASTNode a = new ASTNode();
a.setName( "a");
math.addChild(a);
sm.setMath(math);
int i = sr.setStoichiometryMath(sm);
assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
assertEquals( true, sr.isSetStoichiometryMath() );
sm = null;
}
示例14: test_ASTNode_canonicalizeLogical
public void test_ASTNode_canonicalizeLogical()
{
ASTNode n = new ASTNode(libsbml.AST_FUNCTION);
n.setName( "and");
assertTrue( n.getType() == libsbml.AST_FUNCTION );
n.canonicalize();
assertTrue( n.getType() == libsbml.AST_LOGICAL_AND );
n.setType(libsbml.AST_FUNCTION);
n.setName( "not");
assertTrue( n.getType() == libsbml.AST_FUNCTION );
n.canonicalize();
assertTrue( n.getType() == libsbml.AST_LOGICAL_NOT );
n.setType(libsbml.AST_FUNCTION);
n.setName( "or");
assertTrue( n.getType() == libsbml.AST_FUNCTION );
n.canonicalize();
assertTrue( n.getType() == libsbml.AST_LOGICAL_OR );
n.setType(libsbml.AST_FUNCTION);
n.setName( "xor");
assertTrue( n.getType() == libsbml.AST_FUNCTION );
n.canonicalize();
assertTrue( n.getType() == libsbml.AST_LOGICAL_XOR );
n.setType(libsbml.AST_FUNCTION);
n = null;
}
示例15: 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;
}