setId() public method

public setId ( string sid ) : int
sid string
return int
示例#1
0
 public void test_KineticLaw_getParameterById()
 {
     Parameter k1 = new  Parameter(2,4);
       Parameter k2 = new  Parameter(2,4);
       k1.setId( "k1");
       k2.setId( "k2");
       k1.setValue(3.14);
       k2.setValue(2.72);
       M.addParameter(k1);
       M.addParameter(k2);
       Reaction r1 = new  Reaction(2,4);
       r1.setId( "reaction_1" );
       KineticLaw kl = new  KineticLaw(2,4);
       kl.setFormula( "k1 * X0");
       Parameter k3 = new  Parameter(2,4);
       Parameter k4 = new  Parameter(2,4);
       k3.setId( "k1");
       k4.setId( "k2");
       k3.setValue(2.72);
       k4.setValue(3.14);
       kl.addParameter(k3);
       kl.addParameter(k4);
       r1.setKineticLaw(kl);
       M.addReaction(r1);
       KineticLaw kl1 = M.getReaction(0).getKineticLaw();
       assertNotEquals(kl1.getParameter( "k1" ),k3);
       assertNotEquals(kl1.getParameter( "k1" ),k1);
       assertNotEquals(kl1.getParameter( "k2" ),k4);
       assertEquals(kl1.getParameter( "k3" ),null);
 }
 public void test_Model_addReaction5()
 {
     Model m = new  Model(2,2);
       Reaction r = new  Reaction(2,2);
       r.setId( "r");
       Reaction r1 = new  Reaction(2,2);
       r1.setId( "r");
       int i = m.addReaction(r);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( m.getNumReactions() == 1 );
       i = m.addReaction(r1);
       assertTrue( i == libsbml.LIBSBML_DUPLICATE_OBJECT_ID );
       assertTrue( m.getNumReactions() == 1 );
       r = null;
       r1 = null;
       m = null;
 }
 public void test_Model_addReaction3()
 {
     Model m = new  Model(2,2);
       Reaction r = new  Reaction(1,2);
       r.setId( "r");
       int i = m.addReaction(r);
       assertTrue( i == libsbml.LIBSBML_LEVEL_MISMATCH );
       assertTrue( m.getNumReactions() == 0 );
       r = null;
       m = null;
 }
 public void test_Model_addReaction1()
 {
     Model m = new  Model(2,2);
       Reaction r = new  Reaction(2,2);
       int i = m.addReaction(r);
       assertTrue( i == libsbml.LIBSBML_INVALID_OBJECT );
       r.setId( "r");
       i = m.addReaction(r);
       assertTrue( i == libsbml.LIBSBML_OPERATION_SUCCESS );
       assertTrue( m.getNumReactions() == 1 );
       r = null;
       m = null;
 }
 public void test_internal_consistency_check_99911_react()
 {
     SBMLDocument d = new SBMLDocument(2,4);
       long errors;
       Model m = d.createModel();
       Reaction r = new Reaction(2,4);
       d.setLevelAndVersion(2,1,false);
       r.setId("r");
       r.setSBOTerm(2);
       m.addReaction(r);
       errors = d.checkInternalConsistency();
       assertTrue( errors == 0 );
       d = null;
 }
 public void test_internal_consistency_check_99904_react()
 {
     SBMLDocument d = new SBMLDocument(2,4);
       long errors;
       Reaction r = new Reaction(2,4);
       d.setLevelAndVersion(1,2,false);
       Model m = d.createModel();
       Compartment c = m.createCompartment();
       c.setId("cc");
       r.setId("r");
       r.setMetaId("mmm");
       m.addReaction(r);
       errors = d.checkInternalConsistency();
       assertTrue( errors == 0 );
       d = null;
 }
示例#7
0
 public void test_Reaction_copyConstructor()
 {
     Reaction o1 = new Reaction(2,4);
       o1.setId("c");
       assertTrue( o1.getId() ==  "c" );
       KineticLaw kl = new KineticLaw(2,4);
       o1.setKineticLaw(kl);
       kl = null;
       assertTrue( o1.isSetKineticLaw() == true );
       assertNotEquals(o1.getKineticLaw(),null);
       Reaction o2 = new Reaction(o1);
       assertTrue( o2.getId() ==  "c" );
       assertTrue( o2.isSetKineticLaw() == true );
       assertNotEquals(o2.getKineticLaw(),null);
       assertTrue( o2.getParentSBMLObject() == o1.getParentSBMLObject() );
       o2 = null;
       o1 = null;
 }
示例#8
0
 public void test_L3_Reaction_hasRequiredAttributes()
 {
     Reaction r = new  Reaction(3,1);
       assertEquals( false, r.hasRequiredAttributes() );
       r.setId( "id");
       assertEquals( false, r.hasRequiredAttributes() );
       r.setFast(false);
       assertEquals( false, r.hasRequiredAttributes() );
       r.setReversible(false);
       assertEquals( true, r.hasRequiredAttributes() );
       r = null;
 }
示例#9
0
 public void test_Model_getSpeciesReferenceById()
 {
     Reaction r1 = new  Reaction(2,4);
       r1.setId( "r1");
       SpeciesReference sr = r1.createReactant();
       sr.setId( "s1");
       M.addReaction(r1);
       assertTrue( M.getNumReactions() == 1 );
       assertNotEquals(M.getSpeciesReference( "s1" ),sr);
 }
示例#10
0
 public void test_Model_getReactionById()
 {
     Reaction r1 = new  Reaction(2,4);
       Reaction r2 = new  Reaction(2,4);
       r1.setId( "reaction_1" );
       r2.setId( "reaction_2" );
       M.addReaction(r1);
       M.addReaction(r2);
       assertTrue( M.getNumReactions() == 2 );
       assertNotEquals(M.getReaction( "reaction_1" ),r1);
       assertNotEquals(M.getReaction( "reaction_2" ),r2);
       assertEquals(M.getReaction( "reaction_3" ),null);
 }
示例#11
0
 public void test_Model_getReaction()
 {
     Reaction r1 = new  Reaction(2,4);
       Reaction r2 = new  Reaction(2,4);
       r1.setId( "reaction_1");
       r2.setId( "reaction_2");
       M.addReaction(r1);
       M.addReaction(r2);
       assertTrue( M.getNumReactions() == 2 );
       r1 = M.getReaction(0);
       r2 = M.getReaction(1);
       assertTrue((  "reaction_1" == r1.getId() ));
       assertTrue((  "reaction_2" == r2.getId() ));
 }
示例#12
0
 public void test_Model_addReaction()
 {
     Reaction r = new  Reaction(2,4);
       r.setId( "r");
       M.addReaction(r);
       assertTrue( M.getNumReactions() == 1 );
 }
示例#13
0
 public void test_Reaction_parent_add()
 {
     Reaction ia = new Reaction(2,4);
       Model m = new Model(2,4);
       ia.setId("k");
       m.addReaction(ia);
       ia = null;
       ListOf lo = m.getListOfReactions();
       assertTrue( lo == m.getReaction(0).getParentSBMLObject() );
       assertTrue( m == lo.getParentSBMLObject() );
 }
 public void test_Reaction()
 {
     Reaction r = new Reaction(2,4);
       assertEquals( false, (r.hasRequiredAttributes()) );
       r.setId("r");
       assertEquals( true, r.hasRequiredAttributes() );
       r = null;
 }
示例#15
0
 public void test_Reaction_ancestor_add()
 {
     Reaction ia = new Reaction(2,4);
       Model m = new Model(2,4);
       ia.setId("k");
       m.addReaction(ia);
       ia = null;
       ListOf lo = m.getListOfReactions();
       Reaction obj = m.getReaction(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 );
 }