Package org.sbml.jsbml

Examples of org.sbml.jsbml.UnitDefinition


   * @return
   * @throws SBMLException
   */
  private ASTNodeValue root(double rootExponent, ASTNodeValue radiant)
      throws SBMLException {
    UnitDefinition ud = radiant.getUnits().clone();
    for (Unit u : ud.getListOfUnits()) {
      if ((((u.getExponent() / rootExponent) % 1d) != 0d) && !u.isDimensionless() && !u.isInvalid()) {
            new UnitException(String.format(
                "Cannot perform power or root operation due to incompatibility with a unit exponent. Given are %s and %s.",
                StringTools.toString(u.getExponent()), StringTools.toString(rootExponent)));
      }
View Full Code Here


   * (non-Javadoc)
   *
   * @see org.sbml.jsbml.ASTNodeCompiler#symbolTime(java.lang.String)
   */
  public ASTNodeValue symbolTime(String time) {
    UnitDefinition ud = UnitDefinition.time(level, version);
    if ((ud == null) && (model != null)) {
      ud = model.getTimeUnitsInstance();
      if (ud == null) {
        ud = model.getUnitDefinition(time);
      }
View Full Code Here

   * (non-Javadoc)
   *
   * @see org.sbml.jsbml.ASTNodeCompiler#times(org.sbml.jsbml.ASTNodeValue[])
   */
  public ASTNodeValue times(List<ASTNode> values) throws SBMLException {
    UnitDefinition ud = new UnitDefinition(level, version);
    UnitDefinition v;
    double d = 1d;

    for (ASTNode value : values) {
      ASTNodeValue av = value.compile(this);
      v = av.getUnits().clone();
View Full Code Here

   *
   * @return
   */
  public UnitDefinition getUnits() {
    if (!isSetUnit()) {
      unitDef = new UnitDefinition(level, version);
      unitDef.createUnit();
    }
    return unitDef;
  }
View Full Code Here

    assertEquals(ud.getUnit(0), u);
  }

  @Test
  public void test_Model_createUnitDefinition() {
    UnitDefinition ud = M.createUnitDefinition();
    assertTrue(ud != null);
    assertTrue(M.getNumUnitDefinitions() == 1);
    assertEquals(M.getUnitDefinition(0), ud);
  }
View Full Code Here

    assertTrue(M.getSpecies("Glucose2") == null);
  }

  @Test
  public void test_Model_getUnitDefinition() {
    UnitDefinition ud1 = new UnitDefinition(2, 4);
    UnitDefinition ud2 = new UnitDefinition(2, 4);
    ud1.setId("mmls");
    ud2.setId("volume");
    ud1.createUnit(Kind.LITRE);
    ud2.createUnit(Kind.LITRE);
    M.addUnitDefinition(ud1);
    M.addUnitDefinition(ud2);
    assertTrue(M.getNumUnitDefinitions() == 2);
    ud1 = M.getUnitDefinition(0);
    ud2 = M.getUnitDefinition(1);
    assertTrue(ud1.getId().equals("mmls"));
    assertTrue(ud2.getId().equals("volume"));
  }
View Full Code Here

    assertTrue(ud2.getId().equals("volume"));
  }

  @Test
  public void test_Model_getUnitDefinitionById() {
    UnitDefinition ud1 = new UnitDefinition(2, 4);
    UnitDefinition ud2 = new UnitDefinition(2, 4);
    ud1.setId("mmls");
    ud2.setId("volume");
    ud1.createUnit(Kind.LITRE);
    ud2.createUnit(Kind.LITRE);
    M.addUnitDefinition(ud1);
    M.addUnitDefinition(ud2);
    assertTrue(M.getNumUnitDefinitions() == 2);
    // assertNotEquals(M.getUnitDefinition("mmls"), ud1);
    // assertNotEquals(M.getUnitDefinition("volume"), ud2);
View Full Code Here

    o3 = null;
  }

  @Test
  public void test_Model_removeUnitDefinition() {
    UnitDefinition o1, o2, o3;
    o1 = M.createUnitDefinition();
    o2 = M.createUnitDefinition();
    o3 = M.createUnitDefinition();
    o3.setId("test");
    assertTrue(M.removeUnitDefinition(0).equals(o1));
View Full Code Here

    LocalParameter lp;
    AssignmentRule ar;
    Reaction r;
    SpeciesReference sr;
    KineticLaw kl;
    UnitDefinition ud;
    Reaction r1;
    ListOf<Compartment> loc;
    Compartment c1;
    ListOf<Rule> lor;
    AssignmentRule ar1;
View Full Code Here

    assertEquals(M.getFunctionDefinition(-2), null);
  }

  @Test
  public void test_Model_add_get_UnitDefinitions() {
    UnitDefinition ud1 = new UnitDefinition(2, 4);
    UnitDefinition ud2 = new UnitDefinition(2, 4);
    ud1.setId("ud1");
    ud2.setId("ud2");
    ud1.createUnit(Kind.LITRE);
    ud2.createUnit(Kind.METRE);
    M.addUnitDefinition(ud1);
    M.addUnitDefinition(ud2);
    assertTrue(M.getNumUnitDefinitions() == 2);
    // assertTrue(!M.getUnitDefinition(0).equals(ud1)); // would be the same in jsbml
    // assertTrue(!M.getUnitDefinition(1).equals(ud2));
View Full Code Here

TOP

Related Classes of org.sbml.jsbml.UnitDefinition

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.