setId() public method

public setId ( string sid ) : int
sid string
return int
 public void test_Compartment()
 {
     Compartment c = new Compartment(2,4);
       assertEquals( false, (c.hasRequiredAttributes()) );
       c.setId("c");
       assertEquals( true, c.hasRequiredAttributes() );
       c = null;
 }
 public void test_Model_addCompartment2()
 {
     Model m = new  Model(2,2);
       Compartment c = new  Compartment(2,1);
       c.setId( "c");
       int i = m.addCompartment(c);
       assertTrue( i == libsbml.LIBSBML_VERSION_MISMATCH );
       assertTrue( m.getNumCompartments() == 0 );
       c = null;
       m = null;
 }
 public void test_Model_addCompartment1()
 {
     Model m = new  Model(2,2);
       Compartment c = new  Compartment(2,2);
       int i = m.addCompartment(c);
       assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
       c.setId( "c");
       i = m.addCompartment(c);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( m.getNumCompartments() == 1 );
       c = null;
       m = null;
 }
 public void test_internal_consistency_check_99902()
 {
     SBMLDocument d = new SBMLDocument(2,4);
       long errors;
       Compartment c = new Compartment(2,4);
       d.setLevelAndVersion(1,2,false);
       Model m = d.createModel();
       c.setCompartmentType("hh");
       c.setId("c");
       m.addCompartment(c);
       errors = d.checkInternalConsistency();
       assertTrue( errors == 1 );
       assertTrue( d.getError(0).getErrorId() == 10103 );
       d = null;
 }
 public void test_Compartment_assignmentOperator()
 {
     Compartment o1 = new Compartment(2,4);
       o1.setId("c");
       o1.setOutside("c2");
       assertTrue( o1.getId() ==  "c" );
       assertTrue( o1.getOutside() ==  "c2" );
       Compartment o2 = new Compartment(2,4);
       o2 = o1;
       assertTrue( o2.getId() ==  "c" );
       assertTrue( o2.getOutside() ==  "c2" );
       assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() );
       o2 = null;
       o1 = null;
 }
 public void test_internal_consistency_check_99903()
 {
     SBMLDocument d = new SBMLDocument(2,4);
       long errors;
       Compartment c = new Compartment(2,4);
       d.setLevelAndVersion(1,2,false);
       Model m = d.createModel();
       c.setConstant(true);
       c.setId("c");
       m.addCompartment(c);
       Rule r = m.createAssignmentRule();
       r.setVariable("c");
       r.setFormula("2*3");
       errors = d.checkInternalConsistency();
       assertTrue( errors == 3 );
       d = null;
 }
 public void test_Model_addCompartment5()
 {
     Model m = new  Model(2,2);
       Compartment c = new  Compartment(2,2);
       c.setId( "c");
       Compartment c1 = new  Compartment(2,2);
       c1.setId( "c");
       int i = m.addCompartment(c);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( m.getNumCompartments() == 1 );
       i = m.addCompartment(c1);
       assertTrue( i == libsbml.LIBSBML_DUPLICATE_OBJECT_ID );
       assertTrue( m.getNumCompartments() == 1 );
       c = null;
       c1 = null;
       m = null;
 }
 public void test_L3_Compartment_hasRequiredAttributes()
 {
     Compartment c = new  Compartment(3,1);
       assertEquals( false, c.hasRequiredAttributes() );
       c.setId( "id");
       assertEquals( false, c.hasRequiredAttributes() );
       c.setConstant(false);
       assertEquals( true, c.hasRequiredAttributes() );
       c = null;
 }
 public void test_Compartment_setId4()
 {
     Compartment c = new  Compartment(2,2);
       int i = c.setId("");
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertEquals( false, c.isSetId() );
       c = null;
 }
 public void test_Compartment_setId2()
 {
     Compartment c = new  Compartment(2,2);
       int i = c.setId( "1cell");
       assertTrue( i == libsbml.LIBSBML_INVALID_ATTRIBUTE_VALUE );
       assertEquals( false, c.isSetId() );
       c = null;
 }
Beispiel #11
0
 public void test_SBMLConvert_convertToL1_Species_Amount()
 {
     SBMLDocument d = new  SBMLDocument(2,1);
       Model m = d.createModel();
       string sid =  "C";
       Compartment c = new  Compartment(2,4);
       Species s = new  Species(2,4);
       c.setId(sid);
       m.addCompartment(c);
       s.setCompartment(sid);
       s.setInitialAmount(2.34);
       m.addSpecies(s);
       assertTrue( d.setLevelAndVersion(1,2,true) == true );
       assertTrue( s.getInitialAmount() == 2.34 );
       d = null;
 }
Beispiel #12
0
 public void test_Compartment_copyConstructor()
 {
     Compartment o1 = new Compartment(2,4);
       o1.setId("c");
       o1.setOutside("c2");
       assertTrue( o1.getId() ==  "c" );
       assertTrue( o1.getOutside() ==  "c2" );
       Compartment o2 = new Compartment(o1);
       assertTrue( o2.getId() ==  "c" );
       assertTrue( o2.getOutside() ==  "c2" );
       assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() );
       o2 = null;
       o1 = null;
 }
Beispiel #13
0
 public void test_Model_addCompartment()
 {
     Compartment c = new  Compartment(2,4);
       c.setId( "c");
       M.addCompartment(c);
       assertTrue( M.getNumCompartments() == 1 );
 }
Beispiel #14
0
 public void test_Model_getCompartmentById()
 {
     Compartment c1 = new  Compartment(2,4);
       Compartment c2 = new  Compartment(2,4);
       c1.setId( "A" );
       c2.setId( "B" );
       M.addCompartment(c1);
       M.addCompartment(c2);
       assertTrue( M.getNumCompartments() == 2 );
       assertTrue( M.getCompartment( "A" ) != c1 );
       assertTrue( M.getCompartment( "B" ) != c2 );
       assertTrue( M.getCompartment( "C" ) == null );
 }
Beispiel #15
0
 public void test_Model_getCompartment()
 {
     Compartment c1 = new  Compartment(2,4);
       Compartment c2 = new  Compartment(2,4);
       c1.setId( "A");
       c2.setId( "B");
       M.addCompartment(c1);
       M.addCompartment(c2);
       assertTrue( M.getNumCompartments() == 2 );
       c1 = M.getCompartment(0);
       c2 = M.getCompartment(1);
       assertTrue((  "A" == c1.getId() ));
       assertTrue((  "B" == c2.getId() ));
 }
 public void test_Compartment_parent_add()
 {
     Compartment c = new Compartment(2,4);
       c.setId("c");
       Model m = new Model(2,4);
       m.addCompartment(c);
       c = null;
       ListOf lo = m.getListOfCompartments();
       assertTrue( lo == m.getCompartment(0).getParentSBMLObject() );
       assertTrue( m == lo.getParentSBMLObject() );
 }
Beispiel #17
0
 public void test_SBMLConvert_convertToL1_Species_Concentration()
 {
     SBMLDocument d = new  SBMLDocument(2,1);
       Model m = d.createModel();
       string sid =  "C";
       Compartment c = new  Compartment(2,1);
       Species s = new  Species(2,1);
       c.setId(sid);
       c.setSize(1.2);
       m.addCompartment(c);
       s.setId( "s"  );
       s.setCompartment(sid);
       s.setInitialConcentration(2.34);
       m.addSpecies(s);
       assertTrue( d.setLevelAndVersion(1,2,true) == true );
       Species s1 = m.getSpecies(0);
       assertTrue( s1 != null );
       assertTrue((  "C" == s1.getCompartment() ));
       assertTrue( m.getCompartment( "C").getSize() == 1.2 );
       assertTrue( s1.getInitialConcentration() == 2.34 );
       assertTrue( s1.isSetInitialConcentration() == true );
       d = null;
 }
Beispiel #18
0
 public void test_Compartment_ancestor_add()
 {
     Compartment c = new Compartment(2,4);
       c.setId("C");
       Model m = new Model(2,4);
       m.addCompartment(c);
       c = null;
       ListOf lo = m.getListOfCompartments();
       Compartment obj = m.getCompartment(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 );
 }