setCharacter() public method

public setCharacter ( char value ) : int
value char
return int
Ejemplo n.º 1
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;
 }
Ejemplo n.º 2
0
 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;
 }