Package org.sbml.jsbml

Examples of org.sbml.jsbml.Compartment


    assertEquals(M.getRule(0), ar);
  }

  @Test
  public void test_Model_createCompartment() {
    Compartment c = M.createCompartment();
    assertTrue(c != null);
    assertTrue(M.getNumCompartments() == 1);
    assertTrue(c.equals(c));
    assertTrue(M.getCompartment(0).equals(c)); // TODO : check why this is failing
  }
View Full Code Here


   * object.getNamespaces().getLength() == 2 ); object = null; }
   */

  @Test
  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(c1.getId().equals("A"));
    assertTrue(c2.getId().equals("B"));
  }
View Full Code Here

    assertTrue(c2.getId().equals("B"));
  }

  @Test
  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").equals(c1)); // would be the same in jsbml
    // assertTrue(!M.getCompartment("B").equals(c2));
View Full Code Here

    assertEquals(M.getUnitDefinition("rototillers"), null);
  }

  @Test
  public void test_Model_removeCompartment() {
    Compartment o1, o2, o3;
    o1 = M.createCompartment();
    o2 = M.createCompartment();
    o3 = M.createCompartment();
    o3.setId("test");
    assertTrue(M.removeCompartment(0).equals(o1));
View Full Code Here

    private Compartment C;
    private Event E;

    @Before public void setUp() throws Exception
    {
      C = new  Compartment(2,4);
      E = new  Event(2,4);
    }
View Full Code Here

      XMLNamespaces xmlns = new  XMLNamespaces();
      xmlns.add( "http://www.sbml.org", "testsbml");
      SBMLNamespaces sbmlns = new  SBMLNamespaces(2,1);
      sbmlns.addNamespaces(xmlns); */
     
       Compartment c = new  Compartment(2,1); // new  Compartment(sbmlns);
//      assertTrue( c.getTypeCode() == libsbml.SBML_COMPARTMENT );
      assertTrue( c.getMetaId().equals("") == true );
//      assertTrue( c.getNotes() == null );
      assertTrue( c.getAnnotation() == null );
      assertTrue( c.getLevel() == 2 );
      assertTrue( c.getVersion() == 1 );
      assertTrue( c.getNamespaces() != null );
//      assertTrue( c.getNamespaces().getLength() == 2 );
      assertTrue( c.getName().equals("") == true );
      assertTrue( c.getSpatialDimensions() == 3d );
      assertTrue( c.getConstant() == true );
      c = null;
    }
View Full Code Here

@Test public void test_read_l2v1_assignment()
  {
    SBMLReader reader = new SBMLReader();
    SBMLDocument d = null;
    Model m;
    Compartment c;
    Species s;
    Parameter gp;
    LocalParameter lp;
    AssignmentRule ar;
    Reaction r;
    SpeciesReference sr;
    KineticLaw kl;
    UnitDefinition ud;
    Reaction r1;
    ListOf<Compartment> loc;
    Compartment c1;
    ListOf<Rule> lor;
    AssignmentRule ar1;
    ListOf<Parameter> lop;
    Parameter p1;
    ListOf<Species> los;
    Species s1;
    String filename = new String( DATA_FOLDER + "/libsbml-test-data/" );
    filename += "l2v1-assignment.xml";
    try {
    d = reader.readSBML(filename);
  } catch (IOException e) {
    e.printStackTrace();
    assert(false);
  } catch (XMLStreamException e) {
    e.printStackTrace();
    assert(false);
  }

  System.out.println(" TestReadFromFile 5 : reading done.");
 
  assertTrue( d.getLevel() == 2 );
    assertTrue( d.getVersion() == 1 );
    m = d.getModel();
    assertTrue( m != null );
    assertTrue( m.getNumCompartments() == 1 );
    c = m.getCompartment(0);
    assertTrue( c != null );
    assertTrue( c.getId().equals( "cell") );
/*    ud = c.getDerivedUnitDefinition();
    assertTrue( ud.getNumUnits() == 1 );
    assertTrue( ud.getUnit(0).getKind() == Kind.LITRE );
    */
    loc = m.getListOfCompartments();
    c1 = loc.get(0);
    assertTrue( c1.equals(c) );
    c1 = loc.get("cell");
    assertTrue( c1.equals(c) );
    assertTrue( m.getNumSpecies() == 5 );
    s = m.getSpecies(0);
    assertTrue( s != null );
    assertTrue( s.getId().equals( "X0"  ) );
    assertTrue( s.getCompartment().equals( "cell") );
View Full Code Here

   */
  public EventTest() throws ParseException, XMLStreamException, SBMLException {
    SBMLDocument doc = new SBMLDocument(3, 1);
    doc.addTreeNodeChangeListener(this);
    Model model = doc.createModel("event_model");
    Compartment c = model.createCompartment("compartment");
    model.createSpecies("s1", c);
    model.createSpecies("s2", c);
    Event ev = model.createEvent();
    Trigger trigger = ev.createTrigger(false, true, ASTNode.parseFormula("3 >= 2"));
    trigger.setMath(ASTNode.geq(new ASTNode(ASTNode.Type.NAME_TIME),
View Full Code Here

public class TestCompartment {
  private Compartment C;

  @Before public void setUp() throws Exception
  {
    C = new  Compartment(2,4);
    if (C == null);
    {
    }
  }
View Full Code Here

    assertEquals( false, C.isSetOutside() );
  }

  @Test public void test_Compartment_createWith()
  {
    Compartment c = new  Compartment(2,4);
    c.setId( "A");
//    assertTrue( c.getTypeCode() == libsbml.SBML_COMPARTMENT );
    assertTrue( c.getMetaId().equals("") == true );
    assertTrue( c.getNotes() == null );
    // assertTrue( c.getAnnotation() == null );
    assertTrue( c.getName().equals("") == true );
    assertTrue( c.getSpatialDimensions() == 3d );
    assertTrue(c.getId().equals( "A"     ));
    assertTrue( c.getConstant() == true );
    assertEquals( true, c.isSetId() );
    assertEquals( false, c.isSetName() );
    c = null;
  }
View Full Code Here

TOP

Related Classes of org.sbml.jsbml.Compartment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.