Package org.sbml.jsbml

Examples of org.sbml.jsbml.UnitDefinition


   *
   * @see org.sbml.jsbml.ASTNodeCompiler#compile(double, java.lang.String)
   */
  public ASTNodeValue compile(double real, String units) {
    ASTNodeValue v = new ASTNodeValue(real, this);
    UnitDefinition ud;
    if (Unit.Kind.isValidUnitKindString(units, level, version)) {
      ud = new UnitDefinition(level, version);
      ud.addUnit(Unit.Kind.valueOf(units.toUpperCase()));
      v.setUnits(ud);
    } else if (model != null) {
      ud = model.getUnitDefinition(units);
      if (ud != null) {
        v.setUnits(ud);
View Full Code Here


     * parameter are determined from the built-in time. The value of the d
     * parameter, when evaluated, must be numerical (i.e., a number in
     * MathML real, integer, or e-notation format) and be greater than or
     * equal to 0. (v2l4)
     */
    UnitDefinition value = x.compile(this).getUnits().clone();
    UnitDefinition time = delay.compile(this).getUnits().clone();

    if (model.getTimeUnitsInstance() != null) {
      if (!UnitDefinition.areEquivalent(model.getTimeUnitsInstance(),
          time)) {
        throw new IllegalArgumentException(
View Full Code Here

   * ASTNodeValue.
   *
   * @return
   */
  private ASTNodeValue dimensionless() {
    UnitDefinition ud = new UnitDefinition(level, version);
    ud.addUnit(Unit.Kind.DIMENSIONLESS);
    return new ASTNodeValue(ud, this);
  }
View Full Code Here

   * @see org.sbml.jsbml.ASTNodeCompiler#frac(org.sbml.jsbml.ASTNodeValue,
   * org.sbml.jsbml.ASTNodeValue)
   */
  public ASTNodeValue frac(ASTNode numerator, ASTNode denominator)
      throws SBMLException {
    UnitDefinition ud = numerator.compile(this).getUnits().clone();
    UnitDefinition denom = denominator.compile(this).getUnits().clone();
    setLevelAndVersion(ud);
    setLevelAndVersion(denom);
    ud.divideBy(denom);
    ASTNodeValue value = new ASTNodeValue(ud, this);
    value.setValue(numerator.compile(this).toDouble()
View Full Code Here

   *
   * @see org.sbml.jsbml.ASTNodeCompiler#frac(int, int)
   */
  public ASTNodeValue frac(int numerator, int denominator) {
    ASTNodeValue value = new ASTNodeValue(
        new UnitDefinition(level, version), this);
    value.setValue(((double) numerator) / ((double) denominator));
    return value;
  }
View Full Code Here

   * @see org.sbml.jsbml.ASTNodeCompiler#getConstantAvogadro(java.lang.String)
   */
  public ASTNodeValue getConstantAvogadro(String name) {
    // TODO: If there is a different value in a later SBML specification, this must be checked here.
    ASTNodeValue value = new ASTNodeValue(Maths.AVOGADRO_L3V1, this);
    UnitDefinition perMole = new UnitDefinition(level, version);
    perMole.setLevel(level);
    perMole.setId("per_mole");
    perMole.addUnit(new Unit(Kind.MOLE, -1, level, version));
    value.setUnits(perMole);
    return value;
  }
View Full Code Here

   * Creates an invalid unit definition encapsulated in an ASTNodeValue.
   *
   * @return
   */
  private ASTNodeValue invalid() {
    UnitDefinition ud = new UnitDefinition(level, version);
    ud.addUnit(new Unit(level, version));
    return new ASTNodeValue(ud, this);
  }
View Full Code Here

    ASTNodeValue compiledvalues[] = new ASTNodeValue[values.size()];
    for (ASTNode node : values) {
      compiledvalues[i++] = node.compile(this);
    }
    value.setValue(Integer.valueOf(0));
    UnitDefinition ud = new UnitDefinition(this.level, this.version);
    ud.addUnit(Unit.Kind.INVALID);
    value.setUnits(ud);

    i = 0;

    while (i < compiledvalues.length) {
View Full Code Here

    for (ASTNode node : values) {
      compiledvalues[i++] = node.compile(this);
    }

    value.setValue(Integer.valueOf(0));
    UnitDefinition ud = new UnitDefinition(this.level, this.version);
    ud.addUnit(Unit.Kind.INVALID);
    value.setUnits(ud);

    i = compiledvalues.length - 1;

    while (i >= 0) {
View Full Code Here

      throws SBMLException {
    double exp = Double.NaN, v;
    v = exponent.toDouble();
    exp = v == 0 ? 0 : 1 / v;
    if (exp == 0) {
      UnitDefinition ud = new UnitDefinition(level, version);
      ud.addUnit(Kind.DIMENSIONLESS);
      ASTNodeValue value = new ASTNodeValue(ud, this);
      value.setValue(Integer.valueOf(1));
      return value;
    }
    if (!Double.isNaN(exp)) {
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.