getName() public method

public getName ( ) : string
return string
Esempio n. 1
0
 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 );
 }
Esempio n. 2
0
 public void test_element_bug_apply_ci_1()
 {
     string s = wrapMathML("<apply>" +
     "  <ci> Y </ci>" +
     "  <cn> 1 </cn>" +
     "</apply>");
       N = libsbml.readMathMLFromString(s);
       assertTrue( N != null );
       assertTrue( N.getType() == libsbml.AST_FUNCTION );
       assertTrue((  "Y" == N.getName() ));
       assertTrue( N.getNumChildren() == 1 );
       ASTNode c = N.getLeftChild();
       assertTrue( c != null );
       assertTrue( c.getType() == libsbml.AST_REAL );
       assertTrue( c.getReal() == 1 );
       assertTrue( c.getNumChildren() == 0 );
 }
Esempio n. 3
0
 public void test_element_bug_apply_ci_2()
 {
     string s = wrapMathML("<apply>" +
     "  <ci> Y </ci>" +
     "  <csymbol encoding='text' " +
     "   definitionURL='http://www.sbml.org/sbml/symbols/time'> t </csymbol>" +
     "</apply>");
       N = libsbml.readMathMLFromString(s);
       assertTrue( N != null );
       assertTrue( N.getType() == libsbml.AST_FUNCTION );
       assertTrue((  "Y" == N.getName() ));
       assertTrue( N.getNumChildren() == 1 );
       ASTNode c = N.getLeftChild();
       assertTrue( c != null );
       assertTrue( c.getType() == libsbml.AST_NAME_TIME );
       assertTrue((  "t" == c.getName() ));
       assertTrue( c.getNumChildren() == 0 );
 }
Esempio n. 4
0
 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;
 }
Esempio n. 5
0
 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;
 }
Esempio n. 6
0
 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 );
 }
Esempio n. 7
0
 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;
 }
Esempio n. 8
0
 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;
 }
Esempio n. 9
0
 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;
 }
Esempio n. 10
0
 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;
 }
Esempio n. 11
0
 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;
 }
Esempio n. 12
0
 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;
 }
Esempio n. 13
0
 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;
 }
Esempio n. 14
0
 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;
 }
Esempio n. 15
0
 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" );
 }
Esempio n. 16
0
 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;
 }
Esempio n. 17
0
 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 );
 }
Esempio n. 18
0
 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;
 }
Esempio n. 19
0
 public void test_element_csymbol_time()
 {
     string s = wrapMathML("<csymbol encoding='text' " + "definitionURL='http://www.sbml.org/sbml/symbols/time'> t </csymbol>");
       N = libsbml.readMathMLFromString(s);
       assertTrue( N != null );
       assertTrue( N.getType() == libsbml.AST_NAME_TIME );
       assertTrue((  "t" == N.getName() ));
       assertTrue( N.getNumChildren() == 0 );
 }
Esempio n. 20
0
 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;
 }