addFunctionDefinition() public method

public addFunctionDefinition ( FunctionDefinition fd ) : int
fd FunctionDefinition
return int
 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_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 );
 }
示例#3
0
 public void test_Model_addFunctionDefinition3()
 {
     Model m = new  Model(2,2);
       FunctionDefinition fd = null;
       int i = m.addFunctionDefinition(fd);
       assertTrue( i == libsbml.LIBSBML_OPERATION_FAILED );
       assertTrue( m.getNumFunctionDefinitions() == 0 );
       m = null;
 }
示例#4
0
 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;
 }
示例#5
0
 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;
 }