Package com.volantis.xml.expression.atomic.numeric

Examples of com.volantis.xml.expression.atomic.numeric.SimpleIntValue


        return new SimpleDoubleValue(this, value);
    }

    // javadoc inherited
    public IntValue createIntValue(int value) {
        return new SimpleIntValue(this, value);
    }
View Full Code Here


     * Verify that when the value retrieved from the repository is non null and
     * valid, the function evaluates to it wrapped in a SimpleIntValue
     */
    public void testExecuteValueWithValidRepositoryValue() {
        doTestExecute("128", VALID_DEFAULT,
                new SimpleIntValue(exprFactory, 128));

    }
View Full Code Here

     * Verify that when the value retrieved from the repository is non null and
     * valid, the function evaluates to it.
     */
    public void testExecuteValueWithValidRepositoryValue() {
        doTestExecute(VALID_PIXEL_HEIGHT, VALID_PIXEL_WIDTH,
                VALID_INT_DEFAULT, new SimpleIntValue(exprFactory, VALID_HEIGHT),
                DIAspectRatioFunction.AspectRatioOutputFormat.HEIGHT);
    }
View Full Code Here

     * Verify that when the value retrieved from the repository is non null and
     * valid, the function evaluates to it.
     */
    public void testExecuteValueWithValidRepositoryValue() {
        doTestExecute(VALID_PIXEL_HEIGHT, VALID_PIXEL_WIDTH,
                VALID_INT_DEFAULT, new SimpleIntValue(exprFactory, VALID_WIDTH),
                DIAspectRatioFunction.AspectRatioOutputFormat.WIDTH);
    }
View Full Code Here

    /**
     * Verify that when the value retrieved from the repository is non null and
     * valid, the function evaluates to it wrapped in a SimpleIntValue
     */
    public void testExecuteValueWithValidRepositoryValue() {
        doTestExecute("32", VALID_DEFAULT, new SimpleIntValue(exprFactory, 32));

    }
View Full Code Here

                    String ratio = "" + (width/gcd) + SEPARATOR + (height/gcd);
                    // return the whole ratio as a string value
                    value = new SimpleStringValue(factory, ratio);
                } else if (outputFormat == AspectRatioOutputFormat.WIDTH) {
                    // return the ratio component as a int value
                    value = new SimpleIntValue(factory, width/gcd);
                } else if (outputFormat == AspectRatioOutputFormat.HEIGHT) {
                    // return the ratio component as a int value
                    value = new SimpleIntValue(factory, height/gcd);
                }
            } catch (NumberFormatException e) {
                // log it but return continue
                String badValue = "One of " + heightInPixels + " or " +
                        widthInPixels;
                String policyNames = "One of "+
                        DevicePolicyConstants.ACTUAL_HEIGHT_IN_PIXELS +
                        " or " + DevicePolicyConstants.ACTUAL_WIDTH_IN_PIXELS;
                LOGGER.info("function-bad-parameter-value",
                        new Object[] {badValue, policyNames});
            }
        }

        if (value == null) {
            // No value could be retrieved from the repository, so verify that
            // the default value is of the correct type.
            if (outputFormat == AspectRatioOutputFormat.RATIO) {
                if (defaultValue instanceof StringValue) {
                    value = defaultValue;
                } else {
                    if (defaultValue != null) {
                        // log the fact that the default was present but wrong
                        LOGGER.info("function-bad-default-value", "StringValue");
                    }
                    value = new SimpleStringValue(factory, "");
                }
            } else if (outputFormat == AspectRatioOutputFormat.WIDTH ||
                    outputFormat == AspectRatioOutputFormat.HEIGHT ) {
                if (defaultValue instanceof IntValue) {
                    value = defaultValue;
                } else {
                    if (defaultValue != null) {
                        // log the fact that the default was present but wrong
                        LOGGER.info("function-bad-default-value", "IntValue");
                    }
                    value = new SimpleIntValue(factory, 0);
                }
            }
        }
        return value;
    }
View Full Code Here

            } else {
                if (defaultValue != null) {
                    // Log that the default value was present but incorrect type
                    LOGGER.info("function-bad-default-value", "NumericValue");
                }
                value = new SimpleIntValue(factory, 0);
            }
        }
        return value;
    }
View Full Code Here

        if (pixelDepth != null) {
            try {
                int depth = Integer.parseInt(pixelDepth);
                // the repository may return -1 if the value cannot be found
                if (depth != -1) {
                    value = new SimpleIntValue(factory, depth);
                }
            } catch (NumberFormatException e) {
                // thrown because the value from the repository couldn't be
                // parsed into a number. Log it but continue.
                LOGGER.info("function-bad-parameter-value", new Object[] {
                    pixelDepth, DevicePolicyConstants.PIXEL_DEPTH});
            }
        }

        if (value == null) {
            // No value could be retrieved from the repository, so verify that
            // the default value is of the correct type
            if (defaultValue instanceof NumericValue) {
                value = defaultValue;
            } else {
                if (defaultValue != null) {
                    // Log that the default value was present but incorrect type
                    LOGGER.info("function-bad-default-value", "NumericValue");
                }
                value = new SimpleIntValue(factory, 0);
            }
        }

        return value;
    }
View Full Code Here

            } else {
                if (defaultValue != null) {
                    // log the fact that the default was present but wrong type
                    LOGGER.info("function-bad-default-value", "NumericValue");
                }
                value = new SimpleIntValue(factory, 0);
            }
        }

        return value;
    }
View Full Code Here

TOP

Related Classes of com.volantis.xml.expression.atomic.numeric.SimpleIntValue

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.