Package org.apache.fop.fo

Examples of org.apache.fop.fo.NumberProperty


     */
    private Property evalModulo(Number op1,
                                Number op2) throws PropertyException {
        if (op1 == null || op2 == null)
            throw new PropertyException("Non number operand to modulo");
        return new NumberProperty(op1.doubleValue() % op2.doubleValue());
    }
View Full Code Here


    public Property eval(Property[] args,
                         PropertyInfo pInfo) throws PropertyException {
        Number dbl = args[0].getNumber();
        if (dbl == null)
            throw new PropertyException("Non number operand to floor function");
        return new NumberProperty(Math.floor(dbl.doubleValue()));
    }
View Full Code Here

    throws PropertyException
  {
    Number dbl = args[0].getNumber();
    if (dbl == null)
      throw new PropertyException("Non number operand to ceiling function");
     return new NumberProperty(Math.ceil(dbl.doubleValue()));
  }
View Full Code Here

      throw new PropertyException("Non number operand to round function");
    double n = dbl.doubleValue();
    double r = Math.floor(n + 0.5);
    if (r == 0.0 && n < 0.0)
    r = -r; // round(-0.2) returns -0 not 0
    return new NumberProperty(r);
  }
View Full Code Here

      // Interpret this in context of the property or do it later?
      prop = new NCnameProperty(currentTokenValue);
      break;

    case TOK_FLOAT:
      prop = new NumberProperty(new Double(currentTokenValue));
      break;

    case TOK_INTEGER:
      prop = new NumberProperty(new Integer(currentTokenValue));
      break;

    case TOK_PERCENT:
      /* Get the length base value object from the Maker. If null, then
       * this property can't have % values. Treat it as a real number.
       */
      double pcval = new Double(currentTokenValue.substring(0,
          currentTokenValue.length()-1)).
  doubleValue()/100.0;
      // LengthBase lbase = this.propInfo.getPercentLengthBase();
      PercentBase pcBase = this.propInfo.getPercentBase();
      if (pcBase != null) {
  if (pcBase.getDimension() == 0) {
    prop = new NumberProperty(pcval * pcBase.getBaseValue());
  }
  else if (pcBase.getDimension() == 1) {
    prop = new LengthProperty(new PercentLength(pcval, pcBase));
  }
  else {
  throw new PropertyException("Illegal percent dimension value");
  }
      }
      else {
  // WARNING? Interpret as a decimal fraction, eg. 50% = .5
  prop = new NumberProperty(pcval);
      }
      break;

    case TOK_NUMERIC:
      // A number plus a valid unit name.
View Full Code Here

   */
  private Property evalModulo(Number op1, Number op2)
    throws PropertyException  {
     if (op1 == null || op2 == null)
      throw new PropertyException("Non number operand to modulo");
    return new NumberProperty(op1.doubleValue()%op2.doubleValue());
  }
View Full Code Here

    throws PropertyException
  {
    Number dbl = args[0].getNumber();
    if (dbl == null)
      throw new PropertyException("Non number operand to floor function");
     return new NumberProperty(Math.floor(dbl.doubleValue()));
  }
View Full Code Here

            // Interpret this in context of the property or do it later?
            prop = new NCnameProperty(currentTokenValue);
            break;

        case TOK_FLOAT:
            prop = new NumberProperty(new Double(currentTokenValue));
            break;

        case TOK_INTEGER:
            prop = new NumberProperty(new Integer(currentTokenValue));
            break;

        case TOK_PERCENT:
            /*
             * Get the length base value object from the Maker. If null, then
             * this property can't have % values. Treat it as a real number.
             */
            double pcval =
                new Double(currentTokenValue.substring(0, currentTokenValue.length() - 1)).doubleValue()
                / 100.0;
            // LengthBase lbase = this.propInfo.getPercentLengthBase();
            PercentBase pcBase = this.propInfo.getPercentBase();
            if (pcBase != null) {
                if (pcBase.getDimension() == 0) {
                    prop = new NumberProperty(pcval * pcBase.getBaseValue());
                } else if (pcBase.getDimension() == 1) {
                    prop = new LengthProperty(new PercentLength(pcval,
                                                                pcBase));
                } else {
                    throw new PropertyException("Illegal percent dimension value");
                }
            } else {
                // WARNING? Interpret as a decimal fraction, eg. 50% = .5
                prop = new NumberProperty(pcval);
            }
            break;

        case TOK_NUMERIC:
            // A number plus a valid unit name.
View Full Code Here

     */
    private Property evalModulo(Number op1,
                                Number op2) throws PropertyException {
        if (op1 == null || op2 == null)
            throw new PropertyException("Non number operand to modulo");
        return new NumberProperty(op1.doubleValue() % op2.doubleValue());
    }
View Full Code Here

      // Interpret this in context of the property or do it later?
      prop = new NCnameProperty(currentTokenValue);
      break;

    case TOK_FLOAT:
      prop = new NumberProperty(new Double(currentTokenValue));
      break;

    case TOK_INTEGER:
      prop = new NumberProperty(new Integer(currentTokenValue));
      break;

    case TOK_PERCENT:
      /* Get the length base value object from the Maker. If null, then
       * this property can't have % values. Treat it as a real number.
       */
      double pcval = new Double(currentTokenValue.substring(0,
          currentTokenValue.length()-1)).
  doubleValue()/100.0;
      // LengthBase lbase = this.propInfo.getPercentLengthBase();
      PercentBase pcBase = this.propInfo.getPercentBase();
      if (pcBase != null) {
  if (pcBase.getDimension() == 0) {
    prop = new NumberProperty(pcval * pcBase.getBaseValue());
  }
  else if (pcBase.getDimension() == 1) {
    prop = new LengthProperty(new PercentLength(pcval, pcBase));
  }
  else {
  throw new PropertyException("Illegal percent dimension value");
  }
      }
      else {
  // WARNING? Interpret as a decimal fraction, eg. 50% = .5
  prop = new NumberProperty(pcval);
      }
      break;

    case TOK_NUMERIC:
      // A number plus a valid unit name.
View Full Code Here

TOP

Related Classes of org.apache.fop.fo.NumberProperty

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.