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;
 }
Esempio n. 2
0
 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;
 }
Esempio n. 3
0
 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_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;
 }
Esempio n. 5
0
 public void test_Compartment_createWith()
 {
     Compartment c = new  Compartment(2,4);
       c.setId( "A");
       assertTrue( c.getTypeCode() == libsbml.SBML_COMPARTMENT );
       assertTrue( c.getMetaId() == "" );
       assertTrue( c.getNotes() == null );
       assertTrue( c.getAnnotation() == null );
       assertTrue( c.getName() == "" );
       assertTrue( c.getSpatialDimensions() == 3 );
       assertTrue((  "A"      == c.getId() ));
       assertTrue( c.getConstant() == true );
       assertEquals( true, c.isSetId() );
       assertEquals( false, c.isSetName() );
       c = null;
 }
Esempio n. 6
0
 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;
 }
Esempio n. 7
0
 public void test_Model_addCompartment()
 {
     Compartment c = new  Compartment(2,4);
       c.setId( "c");
       M.addCompartment(c);
       assertTrue( M.getNumCompartments() == 1 );
 }
Esempio n. 8
0
 public void test_Compartment_initDefaults()
 {
     Compartment c = new  Compartment(2,4);
       c.setId( "A");
       c.initDefaults();
       assertTrue((  "A" == c.getId() ));
       assertTrue( c.getName() == "" );
       assertTrue( c.getUnits() == "" );
       assertTrue( c.getOutside() == "" );
       assertTrue( c.getSpatialDimensions() == 3 );
       assertTrue( c.getVolume() == 1.0 );
       assertTrue( c.getConstant() == true );
       assertEquals( true, c.isSetId() );
       assertEquals( false, c.isSetName() );
       assertEquals( false, c.isSetSize() );
       assertEquals( false, c.isSetVolume() );
       assertEquals( false, c.isSetUnits() );
       assertEquals( false, c.isSetOutside() );
       assertEquals( true, c.isSetSpatialDimensions() );
       assertEquals( true, c.isSetConstant() );
       c = null;
 }
 public void test_SBMLConvert_convertToL1_Species_Amount()
 {
     SBMLDocument d = new  SBMLDocument(2,4);
       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;
 }
 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_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;
 }
 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_SyncAnnotation_stringChangesMetaid()
        {
            Compartment c = new  Compartment(3,1);
              c.setMetaId("_000005");
              c.setId("A");

              string addedAnn =
            "  <annotation>\n" +
            "    <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:vCard=\"http://www.w3.org/2001/vcard-rdf/3.0#\" xmlns:bqbiol=\"http://biomodels.net/biology-qualifiers/\" xmlns:bqmodel=\"http://biomodels.net/model-qualifiers/\">\n" +
            "      <rdf:Description rdf:about=\"#_000003\">\n" +
            "        <dc:creator>\n" +
            "          <rdf:Bag>\n" +
            "            <rdf:li rdf:parseType=\"Resource\">\n" +
            "              <vCard:N rdf:parseType=\"Resource\">\n" +
            "                <vCard:Family>Le Novere</vCard:Family>\n" +
            "                <vCard:Given>Nicolas</vCard:Given>\n" +
            "              </vCard:N>\n" +
            "              <vCard:EMAIL>[email protected]</vCard:EMAIL>\n" +
            "              <vCard:ORG rdf:parseType=\"Resource\">\n" +
            "                <vCard:Orgname>EMBL-EBI</vCard:Orgname>\n" +
            "              </vCard:ORG>\n" +
            "            </rdf:li>\n" +
            "          </rdf:Bag>\n" +
            "        </dc:creator>\n" +
            "        <dcterms:created rdf:parseType=\"Resource\">\n" +
            "          <dcterms:W3CDTF>2005-02-02T14:56:11Z</dcterms:W3CDTF>\n" +
            "        </dcterms:created>\n" +
            "        <dcterms:modified rdf:parseType=\"Resource\">\n" +
            "          <dcterms:W3CDTF>2006-05-30T10:46:02Z</dcterms:W3CDTF>\n" +
            "        </dcterms:modified>\n" +
            "        <bqbiol:is>\n" +
            "          <rdf:Bag>\n" +
            "            <rdf:li rdf:resource=\"http://www.geneontology.org/#GO:0007274\"/>\n" +
            "          </rdf:Bag>\n" +
            "        </bqbiol:is>\n" +
            "      </rdf:Description>\n" +
            "    </rdf:RDF>\n" +
            "  </annotation>";

              c.setAnnotation(addedAnn);

              string expected =
            "<compartment metaid=\"_000005\" id=\"A\">\n" +
            "  <annotation>\n" +
            "    <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:vCard=\"http://www.w3.org/2001/vcard-rdf/3.0#\" xmlns:bqbiol=\"http://biomodels.net/biology-qualifiers/\" xmlns:bqmodel=\"http://biomodels.net/model-qualifiers/\">\n" +
            "      <rdf:Description rdf:about=\"#_000005\">\n" +
            "        <dc:creator>\n" +
            "          <rdf:Bag>\n" +
            "            <rdf:li rdf:parseType=\"Resource\">\n" +
            "              <vCard:N rdf:parseType=\"Resource\">\n" +
            "                <vCard:Family>Le Novere</vCard:Family>\n" +
            "                <vCard:Given>Nicolas</vCard:Given>\n" +
            "              </vCard:N>\n" +
            "              <vCard:EMAIL>[email protected]</vCard:EMAIL>\n" +
            "              <vCard:ORG rdf:parseType=\"Resource\">\n" +
            "                <vCard:Orgname>EMBL-EBI</vCard:Orgname>\n" +
            "              </vCard:ORG>\n" +
            "            </rdf:li>\n" +
            "          </rdf:Bag>\n" +
            "        </dc:creator>\n" +
            "        <dcterms:created rdf:parseType=\"Resource\">\n" +
            "          <dcterms:W3CDTF>2005-02-02T14:56:11Z</dcterms:W3CDTF>\n" +
            "        </dcterms:created>\n" +
            "        <dcterms:modified rdf:parseType=\"Resource\">\n" +
            "          <dcterms:W3CDTF>2006-05-30T10:46:02Z</dcterms:W3CDTF>\n" +
            "        </dcterms:modified>\n" +
            "        <bqbiol:is>\n" +
            "          <rdf:Bag>\n" +
            "            <rdf:li rdf:resource=\"http://www.geneontology.org/#GO:0007274\"/>\n" +
            "          </rdf:Bag>\n" +
            "        </bqbiol:is>\n" +
            "      </rdf:Description>\n" +
            "    </rdf:RDF>\n" +
            "  </annotation>\n" +
            "</compartment>";

              assertEquals( true, equals(expected,c.toSBML()) );
        }
        public void test_SyncAnnotation_stringChangesMetaid2()
        {
            Compartment c = new Compartment(2, 3);
              c.setMetaId("_000005");
              c.setId("A");

              string addedAnn =
            "  <annotation>\n" +
            "    <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:vCard=\"http://www.w3.org/2001/vcard-rdf/3.0#\" xmlns:bqbiol=\"http://biomodels.net/biology-qualifiers/\" xmlns:bqmodel=\"http://biomodels.net/model-qualifiers/\">\n" +
            "      <rdf:Description rdf:about=\"#_000003\">\n" +
            "        <bqbiol:is>\n" +
            "          <rdf:Bag>\n" +
            "            <rdf:li rdf:resource=\"http://www.geneontology.org/#GO:0007274\"/>\n" +
            "          </rdf:Bag>\n" +
            "        </bqbiol:is>\n" +
            "      </rdf:Description>\n" +
            "    </rdf:RDF>\n" +
            "  </annotation>";

              c.setAnnotation(addedAnn);

              string expected =
            "<compartment metaid=\"_000005\" id=\"A\">\n" +
            "  <annotation>\n" +
            "    <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:vCard=\"http://www.w3.org/2001/vcard-rdf/3.0#\" xmlns:bqbiol=\"http://biomodels.net/biology-qualifiers/\" xmlns:bqmodel=\"http://biomodels.net/model-qualifiers/\">\n" +
            "      <rdf:Description rdf:about=\"#_000005\">\n" +
            "        <bqbiol:is>\n" +
            "          <rdf:Bag>\n" +
            "            <rdf:li rdf:resource=\"http://www.geneontology.org/#GO:0007274\"/>\n" +
            "          </rdf:Bag>\n" +
            "        </bqbiol:is>\n" +
            "      </rdf:Description>\n" +
            "    </rdf:RDF>\n" +
            "  </annotation>\n" +
            "</compartment>";

              assertEquals(true, equals(expected, c.toSBML()));
        }
Esempio n. 16
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 );
 }
 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() );
 }
 public void test_internal_consistency_check_99904()
 {
     SBMLDocument d = new SBMLDocument(2,4);
       long errors;
       Compartment c = new Compartment(2,4);
       d.setLevelAndVersion(1,2,false);
       Model m = d.createModel();
       c.setId("c");
       c.setMetaId("mmm");
       m.addCompartment(c);
       errors = d.checkInternalConsistency();
       assertTrue( errors == 1 );
       assertTrue( d.getError(0).getErrorId() == 10103 );
       d = null;
 }
 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;
 }
Esempio n. 20
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() ));
 }
Esempio n. 21
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 );
 }
Esempio n. 22
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;
 }