Package org.apache.fop.fo.properties

Examples of org.apache.fop.fo.properties.NumberProperty$PositiveIntegerMaker


            // 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;
            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 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.
            int numLen = currentTokenValue.length() - currentUnitLength;
            String unitPart = currentTokenValue.substring(numLen);
            Double numPart = new Double(currentTokenValue.substring(0,
                    numLen));
            if (unitPart.equals(RELUNIT)) {
                prop = (Property) NumericOp.multiply(new NumberProperty(numPart.doubleValue()),
                                    propInfo.currentFontSize());
            } else {
                prop = new FixedLength(numPart.doubleValue(), unitPart);
            }
            break;
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

        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

                         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

                         PropertyInfo pInfo) 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

                    TableBody parent = (TableBody) fo.getParent();
                    if (!parent.previousCellEndedRow()) {
                        parent.resetColumnIndex();
                    }
                }
                return new NumberProperty(((TableFObj) fo.getParent())
                                            .getCurrentColumnIndex());
            } else {
                throw new PropertyException(
                        "column-number property is only allowed"
                        + " on fo:table-cell or fo:table-column, not on "
View Full Code Here

                if (columnIndex <= 0) {
                    fo.getLogger().warn("Specified negative or zero value for "
                            + "column-number on " + fo.getName() + ": "
                            + columnIndex + " forced to "
                            + parent.getCurrentColumnIndex());
                    return new NumberProperty(parent.getCurrentColumnIndex());
                }
               
                double tmpIndex = p.getNumeric().getNumericValue();
                if (tmpIndex - columnIndex > 0.0) {
                    columnIndex = (int) Math.round(tmpIndex);
                    fo.getLogger().warn("Rounding specified column-number of "
                            + tmpIndex + " to " + columnIndex);
                    return new NumberProperty(columnIndex);
                }
                       
                /* if column-number was explicitly specified, force the
                 * parent's current column index to the specified value,
                 * so that the updated index will be the correct initial
View Full Code Here

                         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

                         PropertyInfo pInfo) 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

            // 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;
            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 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.
            int numLen = currentTokenValue.length() - currentUnitLength;
            String unitPart = currentTokenValue.substring(numLen);
            Double numPart = new Double(currentTokenValue.substring(0,
                    numLen));
            if (unitPart.equals(RELUNIT)) {
                prop = (Property) NumericOp.multiply(new NumberProperty(numPart.doubleValue()),
                                    propInfo.currentFontSize());
            } else {
                prop = new FixedLength(numPart.doubleValue(), unitPart);
            }
            break;
View Full Code Here

TOP

Related Classes of org.apache.fop.fo.properties.NumberProperty$PositiveIntegerMaker

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.