setId() public method

public setId ( string sid ) : int
sid string
return int
 public void test_CompartmentType_parent_add()
 {
     CompartmentType ct = new CompartmentType(2,4);
       Model m = new Model(2,4);
       ct.setId("ct");
       m.addCompartmentType(ct);
       ct = null;
       ListOf lo = m.getListOfCompartmentTypes();
       assertTrue( lo == m.getCompartmentType(0).getParentSBMLObject() );
       assertTrue( m == lo.getParentSBMLObject() );
 }
 public void test_CompartmentType_copyConstructor()
 {
     CompartmentType o1 = new CompartmentType(2,4);
       o1.setId("c");
       assertTrue( o1.getId() ==  "c" );
       CompartmentType o2 = new CompartmentType(o1);
       assertTrue( o2.getId() ==  "c" );
       assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() );
       o2 = null;
       o1 = null;
 }
 public void test_CompartmentType_assignmentOperator()
 {
     CompartmentType o1 = new CompartmentType(2,4);
       o1.setId("c");
       assertTrue( o1.getId() ==  "c" );
       CompartmentType o2 = new CompartmentType(2,4);
       o2 = o1;
       assertTrue( o2.getId() ==  "c" );
       assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() );
       o2 = null;
       o1 = null;
 }
 public void test_CompartmentType_ancestor_add()
 {
     CompartmentType ct = new CompartmentType(2,4);
       Model m = new Model(2,4);
       ct.setId("ct");
       m.addCompartmentType(ct);
       ct = null;
       ListOf lo = m.getListOfCompartmentTypes();
       CompartmentType obj = m.getCompartmentType(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 );
 }
示例#5
0
 public void test_Model_addCompartmentType4()
 {
     Model m = new  Model(2,2);
       CompartmentType ct = new  CompartmentType(2,2);
       ct.setId( "ct");
       CompartmentType ct1 = new  CompartmentType(2,2);
       ct1.setId( "ct");
       int i = m.addCompartmentType(ct);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( m.getNumCompartmentTypes() == 1 );
       i = m.addCompartmentType(ct1);
       assertTrue( i == libsbml.LIBSBML_DUPLICATE_OBJECT_ID );
       assertTrue( m.getNumCompartmentTypes() == 1 );
       ct = null;
       ct1 = null;
       m = null;
 }
示例#6
0
 public void test_Model_addCompartmentType2()
 {
     Model m = new  Model(2,2);
       CompartmentType ct = new  CompartmentType(2,3);
       ct.setId( "ct");
       int i = m.addCompartmentType(ct);
       assertTrue( i == libsbml.LIBSBML_VERSION_MISMATCH );
       assertTrue( m.getNumCompartmentTypes() == 0 );
       ct = null;
       m = null;
 }
 public void test_internal_consistency_check_99908()
 {
     SBMLDocument d = new SBMLDocument(2,4);
       long errors;
       CompartmentType ct = new CompartmentType(2,4);
       Model m = d.createModel();
       d.setLevelAndVersion(2,1,false);
       ct.setId("ct");
       m.addCompartmentType(ct);
       errors = d.checkInternalConsistency();
       assertTrue( errors == 0 );
       d = null;
 }
 public void test_CompartmentType()
 {
     CompartmentType ct = new CompartmentType(2,4);
       assertEquals( false, (ct.hasRequiredAttributes()) );
       ct.setId("c");
       assertEquals( true, ct.hasRequiredAttributes() );
       ct = null;
 }