addParameter() public method

public addParameter ( Parameter p ) : int
p Parameter
return int
 public void test_Model_addParameter5()
 {
     Model m = new  Model(2,2);
       Parameter p = new  Parameter(2,2);
       p.setId( "p");
       Parameter p1 = new  Parameter(2,2);
       p1.setId( "p");
       int i = m.addParameter(p);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( m.getNumParameters() == 1 );
       i = m.addParameter(p1);
       assertTrue( i == libsbml.LIBSBML_DUPLICATE_OBJECT_ID );
       assertTrue( m.getNumParameters() == 1 );
       p = null;
       p1 = null;
       m = null;
 }
 public void test_Model_addParameter4()
 {
     Model m = new  Model(2,2);
       Parameter p = null;
       int i = m.addParameter(p);
       assertTrue( i == libsbml.LIBSBML_OPERATION_FAILED );
       assertTrue( m.getNumParameters() == 0 );
       m = null;
 }
 public void test_Model_addParameter3()
 {
     Model m = new  Model(2,2);
       Parameter p = new  Parameter(1,2);
       p.setId( "p");
       int i = m.addParameter(p);
       assertTrue( i == libsbml.LIBSBML_LEVEL_MISMATCH );
       assertTrue( m.getNumParameters() == 0 );
       p = null;
       m = null;
 }
 public void test_Model_addParameter1()
 {
     Model m = new  Model(2,2);
       Parameter p = new  Parameter(2,2);
       int i = m.addParameter(p);
       assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
       p.setId( "p");
       i = m.addParameter(p);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( m.getNumParameters() == 1 );
       p = null;
       m = null;
 }
 public void test_Parameter_parent_add()
 {
     Parameter ia = new Parameter(2,4);
       Model m = new Model(2,4);
       ia.setId("p");
       m.addParameter(ia);
       ia = null;
       ListOf lo = m.getListOfParameters();
       assertTrue( lo == m.getParameter(0).getParentSBMLObject() );
       assertTrue( m == lo.getParentSBMLObject() );
 }
Example #6
0
 public void test_Parameter_ancestor_add()
 {
     Parameter ia = new Parameter(2,4);
       Model m = new Model(2,4);
       ia.setId("p");
       m.addParameter(ia);
       ia = null;
       ListOf lo = m.getListOfParameters();
       Parameter obj = m.getParameter(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 );
 }