Package org.sbml.jsbml

Examples of org.sbml.jsbml.Species


    assertEquals(M.getReaction(0), r);
  }

  @Test
  public void test_Model_createSpecies() {
    Species s = M.createSpecies();
    assertTrue(s != null);
    assertTrue(M.getNumSpecies() == 1);
    assertTrue(M.getSpecies(0).equals(s) == true);
  }
View Full Code Here


    assertEquals(M.getFunctionDefinition("tan"), null);
  }

  @Test
  public void test_Model_getNumSpeciesWithBoundaryCondition() {
    Species s1 = new Species(2, 4);
    Species s2 = new Species(2, 4);
    Species s3 = new Species(2, 4);
    s1.setId("s1");
    s2.setId("s2");
    s3.setId("s3");
    s1.setCompartment("c1");
    s2.setCompartment("c2");
    s3.setCompartment("c3");
    s1.setBoundaryCondition(true);
    s2.setBoundaryCondition(false);
    s3.setBoundaryCondition(true);
    assertTrue(M.getNumSpecies() == 0);
    assertTrue(M.getNumSpeciesWithBoundaryCondition() == 0);
    M.addSpecies(s1);
    assertTrue(M.getNumSpecies() == 1);
    assertTrue(M.getNumSpeciesWithBoundaryCondition() == 1);
View Full Code Here

    assertTrue(pr.getFormula().equals("k3/k2"));
  }

  @Test
  public void test_Model_getSpecies() {
    Species s1 = new Species(2, 4);
    Species s2 = new Species(2, 4);
    s1.setId("Glucose");
    s2.setId("Glucose_6_P");
    s1.setCompartment("c");
    s2.setCompartment("c");
    M.addSpecies(s1);
    M.addSpecies(s2);
    assertTrue(M.getNumSpecies() == 2);
    s1 = M.getSpecies(0);
    s2 = M.getSpecies(1);
    assertTrue(s1.getId().equals("Glucose"));
    assertTrue(s2.getId().equals("Glucose_6_P"));
  }
View Full Code Here

    assertTrue(s2.getId().equals("Glucose_6_P"));
  }

  @Test
  public void test_Model_getSpeciesById() {
    Species s1 = new Species(2, 4);
    Species s2 = new Species(2, 4);
    s1.setId("Glucose");
    s2.setId("Glucose_6_P");
    s1.setCompartment("c");
    s2.setCompartment("c");
    M.addSpecies(s1);
    M.addSpecies(s2);
    assertTrue(M.getNumSpecies() == 2);
    // assertTrue(M.getSpecies("Glucose").equals(s1) != true);
    // assertTrue(M.getSpecies("Glucose_6_P").equals(s2) != true);
View Full Code Here

    o3 = null;
  }

  @Test
  public void test_Model_removeSpecies() {
    Species o1, o2, o3;
    o1 = M.createSpecies();
    o2 = M.createSpecies();
    o3 = M.createSpecies();
    o3.setId("test");
    assertTrue(M.removeSpecies(0).equals(o1));
View Full Code Here

  {
    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") );
    assertTrue( s.getInitialConcentration() == 1.0 );
    los = m.getListOfSpecies();
    s1 = los.get(0);
    assertTrue( s1.equals(s) );
    s1 = los.get("X0");
    assertTrue( s1.equals(s) );
    s = m.getSpecies(1);
    assertTrue( s != null );
    assertTrue( s.getId().equals( "X1"  ) );
    assertTrue( s.getCompartment().equals( "cell") );
    assertTrue( s.getInitialConcentration() == 0.0 );
View Full Code Here

  private Species S;

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

 
  @SuppressWarnings("deprecation")
@Test public void test_Species_setSpatialSizeUnits()
  {
    Species s = new  Species(2,1);
    String units =  "volume";;
    s.setSpatialSizeUnits(units);
    assertTrue(s.getSpatialSizeUnits().equals(units));
    assertEquals( true, s.isSetSpatialSizeUnits() );
    if (s.getSpatialSizeUnits() == units);
    {
    }
    s.setSpatialSizeUnits(s.getSpatialSizeUnits());
    assertTrue(s.getSpatialSizeUnits().equals(units));
    s.setSpatialSizeUnits("");
    assertEquals( false, s.isSetSpatialSizeUnits() );
    if (s.getSpatialSizeUnits() != null);
    {
    }
    s = null;
  }
View Full Code Here

   * (non-Javadoc)
   * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#compile(org.sbml.jsbml.CallableSBase)
   */
  public ASTNodeValue compile(CallableSBase variable) {
    if (variable instanceof Species) {
      Species species = (Species) variable;
      Compartment c = species.getCompartmentInstance();
      boolean concentration = !species.getHasOnlySubstanceUnits()
          && (0 < c.getSpatialDimensions());
      StringBuffer value = new StringBuffer();
      if (concentration) {
        value.append('[');
      }
View Full Code Here

   */
  public void setSpatial(boolean isSpatial) {
    spatial = Boolean.valueOf(isSpatial);

    // Check if the compartment of the Species has a child of CompartmentMapping
    Species species = getExtendedSBase();
    Compartment compartment = species.getCompartmentInstance();

    if (compartment != null) {
      SpatialCompartmentPlugin spatialCompartment = (SpatialCompartmentPlugin) compartment.getExtension(SpatialConstants.namespaceURI);

      boolean cmSet = spatialCompartment.isSetCompartmentMapping();
View Full Code Here

TOP

Related Classes of org.sbml.jsbml.Species

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.