Package org.foray.fotree

Examples of org.foray.fotree.PropertyException


     * @throws PropertyException For an invalid {@code units} specifier.
     */
    public DtTime(final double quantity, final byte units)
            throws PropertyException {
        if (units < 1 || units > 2) {
            throw new PropertyException("Invalid TimeDT unit ID.");
        }
        this.quantity = quantity;
        this.units = units;
    }
View Full Code Here


     * operation is illegal.
     */
    public ExprUnaryOper(final ExprUnary operand1, final byte operation)
            throws PropertyException {
        if (! (operand1.canEvalNumeric())) {
            throw new PropertyException("UnaryExpr: Non-numeric operand: "
                    + operand1.toString());
        }
        this.operand1 = operand1;
        if (operation != Expr.OPERATION_NEGATION) {
            throw new PropertyException("UnaryExpr: Illegal Operator: "
                    + operation);
        }
        this.operation = operation;
    }
View Full Code Here

     */
    public ExprMultiplicativeOper(final ExprMultiplicative operand1,
            final ExprUnary operand2, final byte operation)
            throws PropertyException {
        if (! (operand1.canEvalNumeric())) {
            throw new PropertyException(this.getClass().getName()
                    + ": Non-numeric operand: " + operand1.toString());
        }
        this.operand1 = operand1;
        if (! (operand2.canEvalNumeric())) {
            throw new PropertyException(this.getClass().getName()
                    + "Non-numeric operand: " + operand2.toString());
        }
        this.operand2 = operand2;
        /*
         * For Modulo Expressions, the unitPower of the two operands must
         * be equal. See XSL-FO Specification 1.0, Section 5.9.6.
         */
        if (operation == Expr.OPERATION_MOD
                && operand1.getUnitPower()
                != operand2.getUnitPower()) {
            throw new PropertyException("Modulo Operator: Unit powers differ: "
                    + operand1.toString() + ", " + operand2.toString());
        }
        if (operation != Expr.OPERATION_MULTIPLY
                && operation != Expr.OPERATION_DIVIDE
                && operation != Expr.OPERATION_MOD) {
            throw new PropertyException("MultiplicativeExpr: Illegal Operator: "
                    + operation);
        }
        this.operation = operation;
    }
View Full Code Here

     */
    public ExprAdditiveOper(final ExprAdditive operand1,
            final ExprMultiplicative operand2,
            final byte operation) throws PropertyException {
        if (! (operand1.canEvalNumeric())) {
            throw new PropertyException("AdditiveExpr: Non-numeric operand: "
                    + operand1.toString());
        }
        this.operand1 = operand1;
        if (! (operand2.canEvalNumeric())) {
            throw new PropertyException("AdditiveExpr: Non-numeric operand: "
                    + operand2.toString());
        }
        this.operand2 = operand2;
        /*
         * For Additive Expressions, the unitPower of the two operands must
         * be equal. See XSL-FO Specification 1.0, Section 5.9.6.
         */
        if (operand1.getUnitPower()
                != operand2.getUnitPower()) {
            throw new PropertyException("AdditiveExpr: Unit powers differ: "
                    + operand1.toString() + ", " + operand2.toString());
        }
        if (operation != Expr.OPERATION_ADD
                && operation != Expr.OPERATION_SUBTRACT) {
            throw new PropertyException("AdditiveExpr: Illegal Operator: "
                    + operation);
        }
        this.operation = operation;
    }
View Full Code Here

         * been converted to reals. */
        final double colorVal = numeric.evalNumeric()
                / WKConstants.MAX_8_BIT_UNSIGNED_INT;
        if (colorVal < 0.0
                || colorVal > WKConstants.MAX_8_BIT_UNSIGNED_INT) {
            throw new PropertyException("Arguments to rgb-icc() must normalize "
                    + "to the range 0 to 1");
        }
    }
View Full Code Here

     * @throws PropertyException For illegal {@code units} value.
     */
    public DtAngle(final float value, final byte units)
            throws PropertyException {
        if (! validUnits(units)) {
            throw new PropertyException("Illegal angle unit ID: " + units);
        }
        this.value = value;
        this.unitID = units;
    }
View Full Code Here

            final PropertyType propertyType) throws PropertyException {
        super();
        if (arguments == null
                || arguments.length < 1
                || arguments.length > 2) {
            throw new PropertyException("Function " + this.getFunctionName()
                    + " must have either one or two arguments.");
        }
        if (arguments[0] instanceof DtName) {
            this.systemFontName = (DtName) arguments[0];
        } else {
            throw new PropertyException("First argument of function "
                    + this.getFunctionName() + " must be the name of a system"
                    + " font.");
        }
        if (arguments.length > 1) {
            if (arguments[1] instanceof DtName) {
                final DtName name = (DtName) arguments[1];
                final FoProperty foProperty = FoProperty.xslValueOf(
                        name.getValue());
                if (foProperty == null) {
                    throw new PropertyException("Not a valid property in the "
                            + "fo: namespace: " + name.getValue());
                }
                this.propertyType = foProperty;
            } else {
                throw new PropertyException("Second argument of "
                        + this.getFunctionName() + " must be the name of a "
                        + "system font characteristic.");
            }
        } else {
            if (propertyType instanceof FoProperty) {
                this.propertyType = (FoProperty) propertyType;
            } else {
                throw new PropertyException("Function " + this.getFunctionName()
                        + " is valid only for properties in the fo: "
                        + "namespace.");
            }
        }
    }
View Full Code Here

        final DtName name = validateNoneOrOneName(arguments);
        if (name == null) {
            if (propertyType instanceof FoProperty) {
                this.operand1 = (FoProperty) propertyType;
            } else {
                throw new PropertyException("Function " + this.getFunctionName()
                        + " is valid only for properties in the fo: "
                        + "namespace.");
            }
        } else {
            final FoProperty foProperty = FoProperty.xslValueOf(
                    name.getValue());
            if (foProperty == null) {
                throw new PropertyException("Not a valid property in the fo: "
                        + "namespace: " + name.getValue());
            }
            this.operand1 = foProperty;
        }
    }
View Full Code Here

            final PropertyValue rightOffset,
            final PropertyValue bottomOffset, final PropertyValue leftOffset)
            throws PropertyException {
        if (! validOffset(topOffset) || ! validOffset(rightOffset)
                || ! validOffset(bottomOffset) || ! validOffset(leftOffset)) {
            throw new PropertyException("Invalid RectangleDT parameter.");
        }
        this.topOffset = topOffset;
        this.rightOffset = rightOffset;
        this.bottomOffset = bottomOffset;
        this.leftOffset = leftOffset;
View Full Code Here

     * integer.
     */
    public void setWithinLine(final PropertyValue newWithinLine)
            throws PropertyException {
        if (! newWithinLine.canEvalInteger()) {
            throw new PropertyException("keep.within-line must evaluate to an "
                    + "integer.");
        }
        this.withinLine = newWithinLine;
    }
View Full Code Here

TOP

Related Classes of org.foray.fotree.PropertyException

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.