setId() public method

public setId ( string sid ) : int
sid string
return int
 public void test_FunctionDefinition_createWith()
 {
     ASTNode math = libsbml.parseFormula("lambda(x, x^3)");
       FunctionDefinition fd = new  FunctionDefinition(2,4);
       fd.setId( "pow3");
       fd.setMath(math);
       ASTNode math1;
       string formula;
       assertTrue( fd.getTypeCode() == libsbml.SBML_FUNCTION_DEFINITION );
       assertTrue( fd.getMetaId() == "" );
       assertTrue( fd.getNotes() == null );
       assertTrue( fd.getAnnotation() == null );
       assertTrue( fd.getName() == "" );
       math1 = fd.getMath();
       assertTrue( math1 != null );
       formula = libsbml.formulaToString(math1);
       assertTrue( formula != null );
       assertTrue((  "lambda(x, x^3)" == formula ));
       assertTrue( fd.getMath() != math );
       assertEquals( true, fd.isSetMath() );
       assertTrue((  "pow3" == fd.getId() ));
       assertEquals( true, fd.isSetId() );
       math = null;
       fd = null;
 }
 public void test_Model_addFunctionDefinition4()
 {
     Model m = new  Model(2,2);
       FunctionDefinition fd = new  FunctionDefinition(2,2);
       fd.setId( "fd");
       fd.setMath(libsbml.parseFormula("fd"));
       FunctionDefinition fd1 = new  FunctionDefinition(2,2);
       fd1.setId( "fd");
       fd1.setMath(libsbml.parseFormula("fd"));
       int i = m.addFunctionDefinition(fd);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( m.getNumFunctionDefinitions() == 1 );
       i = m.addFunctionDefinition(fd1);
       assertTrue( i == libsbml.LIBSBML_DUPLICATE_OBJECT_ID );
       assertTrue( m.getNumFunctionDefinitions() == 1 );
       fd = null;
       fd1 = null;
       m = null;
 }
 public void test_Model_addFunctionDefinition2()
 {
     Model m = new  Model(2,2);
       FunctionDefinition fd = new  FunctionDefinition(2,1);
       fd.setId( "fd");
       fd.setMath(libsbml.parseFormula("fd"));
       int i = m.addFunctionDefinition(fd);
       assertTrue( i == libsbml.LIBSBML_VERSION_MISMATCH );
       assertTrue( m.getNumFunctionDefinitions() == 0 );
       fd = null;
       m = null;
 }
示例#4
0
 public void test_WriteSBML_FunctionDefinition_withSBO()
 {
     string expected = "<functionDefinition id=\"pow3\" sboTerm=\"SBO:0000064\">\n" +
     "  <math xmlns=\"http://www.w3.org/1998/Math/MathML\">\n" +
     "    <lambda>\n" +
     "      <bvar>\n" +
     "        <ci> x </ci>\n" +
     "      </bvar>\n" +
     "      <apply>\n" +
     "        <power/>\n" +
     "        <ci> x </ci>\n" +
     "        <cn type=\"integer\"> 3 </cn>\n" +
     "      </apply>\n" +
     "    </lambda>\n" +
     "  </math>\n" +
     "</functionDefinition>";
       FunctionDefinition fd = new FunctionDefinition ( 2,4 );
       fd.setId("pow3");
       fd.setMath(libsbml.parseFormula("lambda(x, x^3)"));
       fd.setSBOTerm(64);
       assertEquals( true, equals(expected,fd.toSBML()) );
 }
示例#5
0
 public void test_FunctionDefinition_copyConstructor()
 {
     FunctionDefinition o1 = new FunctionDefinition(2,4);
       o1.setId("c");
       assertTrue( o1.getId() ==  "c" );
       ASTNode node = new ASTNode(libsbml.AST_CONSTANT_PI);
       o1.setMath(node);
       node = null;
       assertTrue( o1.getMath() != null );
       FunctionDefinition o2 = new FunctionDefinition(o1);
       assertTrue( o2.getId() ==  "c" );
       assertTrue( o2.getMath() != null );
       assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() );
       o2 = null;
       o1 = null;
 }
 public void test_internal_consistency_check_99911_fd()
 {
     SBMLDocument d = new SBMLDocument(2,4);
       long errors;
       Model m = d.createModel();
       FunctionDefinition fd = new FunctionDefinition(2,4);
       d.setLevelAndVersion(2,1,false);
       fd.setId("fd");
       fd.setSBOTerm(2);
       m.addFunctionDefinition(fd);
       errors = d.checkInternalConsistency();
       assertTrue( errors == 0 );
       d = null;
 }
示例#7
0
 public void test_Model_getFunctionDefinitionById()
 {
     FunctionDefinition fd1 = new  FunctionDefinition(2,4);
       FunctionDefinition fd2 = new  FunctionDefinition(2,4);
       fd1.setId( "sin" );
       fd2.setId( "cos" );
       fd1.setMath(libsbml.parseFormula("2"));
       fd2.setMath(libsbml.parseFormula("2"));
       M.addFunctionDefinition(fd1);
       M.addFunctionDefinition(fd2);
       assertTrue( M.getNumFunctionDefinitions() == 2 );
       assertNotEquals(M.getFunctionDefinition( "sin" ),fd1);
       assertNotEquals(M.getFunctionDefinition( "cos" ),fd2);
       assertEquals(M.getFunctionDefinition( "tan" ),null);
 }
示例#8
0
 public void test_Model_add_get_FunctionDefinitions()
 {
     FunctionDefinition fd1 = new  FunctionDefinition(2,4);
       FunctionDefinition fd2 = new  FunctionDefinition(2,4);
       fd1.setId( "fd1");
       fd2.setId( "fd2");
       fd1.setMath(libsbml.parseFormula("2"));
       fd2.setMath(libsbml.parseFormula("2"));
       M.addFunctionDefinition(fd1);
       M.addFunctionDefinition(fd2);
       assertTrue( M.getNumFunctionDefinitions() == 2 );
       assertNotEquals(M.getFunctionDefinition(0),fd1);
       assertNotEquals(M.getFunctionDefinition(1),fd2);
       assertEquals(M.getFunctionDefinition(2),null);
 }
 public void test_FunctionDefinition_parent_add()
 {
     FunctionDefinition fd = new FunctionDefinition(2,4);
       Model m = new Model(2,4);
       fd.setId("fd");
       fd.setMath(libsbml.parseFormula("l"));
       m.addFunctionDefinition(fd);
       fd = null;
       ListOf lo = m.getListOfFunctionDefinitions();
       assertTrue( lo == m.getFunctionDefinition(0).getParentSBMLObject() );
       assertTrue( m == lo.getParentSBMLObject() );
 }
 public void test_FunctionDefinition()
 {
     FunctionDefinition fd = new FunctionDefinition(2,4);
       assertEquals( false, (fd.hasRequiredAttributes()) );
       fd.setId("fd");
       assertEquals( true, fd.hasRequiredAttributes() );
       fd = null;
 }
示例#11
0
 public void test_FunctionDefinition_ancestor_add()
 {
     FunctionDefinition fd = new FunctionDefinition(2,4);
       Model m = new Model(2,4);
       fd.setId("fd");
       fd.setMath(libsbml.parseFormula("l"));
       m.addFunctionDefinition(fd);
       fd = null;
       ListOf lo = m.getListOfFunctionDefinitions();
       FunctionDefinition obj = m.getFunctionDefinition(0);
       assertTrue( obj.getAncestorOfType(libsbml.SBML_MODEL) == m );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_LIST_OF) == lo );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_DOCUMENT) == null );
       assertTrue( obj.getAncestorOfType(libsbml.SBML_EVENT) == null );
 }