Package javax.time

Examples of javax.time.CalendricalException


        while (iterator.hasNext() && protect < 100) {
            iterator.next().merge(this);
            protect++;
        }
        if (iterator.hasNext()) {
            throw new CalendricalException("Merge fields failed, infinite loop blocked, " +
                    "probably caused by an incorrectly implemented field rule");
        }
    }
View Full Code Here


     * @return the next year, never null
     * @throws CalendricalException if the maximum year is reached
     */
    public Year next() {
        if (year == MAX_YEAR) {
            throw new CalendricalException("Year is already at the maximum value");
        }
        return of(year + 1);
    }
View Full Code Here

     * @return the previous year, never null
     * @throws CalendricalException if the maximum year is reached
     */
    public Year previous() {
        if (year == MIN_YEAR) {
            throw new CalendricalException("Year is already at the minimum value");
        }
        return of(year - 1);
    }
View Full Code Here

        if (years == 0) {
            return this;
        }
        int result = year + years;
        if (((year ^ result) < 0 && (year ^ years) >= 0) || rule().isValidValue(result) == false) {
            throw new CalendricalException("Addition exceeds the supported year range: " + year + " + " + years);
        }
        return of(result);
    }
View Full Code Here

        if (years == 0) {
            return this;
        }
        int result = year - years;
        if (((year ^ result) < 0 && (year ^ years) < 0) || rule().isValidValue(result) == false) {
            throw new CalendricalException("Subtraction exceeds the supported year range: " + year + " + " + years);
        }
        return of(result);
    }
View Full Code Here

        long mjDays = toModifiedJulianDays();

        try {
            mjDays = MathUtils.safeAdd(mjDays, days);
        } catch (ArithmeticException ae) {
            throw new CalendricalException(this + " + " + days + " days exceeds the current capacity");
        }

        return LocalDate.fromModifiedJulianDays(mjDays);
    }
View Full Code Here

        long mjDays = toModifiedJulianDays();

        try {
            mjDays = MathUtils.safeSubtract(mjDays, days);
        } catch (ArithmeticException ae) {
            throw new CalendricalException(this + " - " + days + " days exceeds the current capacity");
        }

        return LocalDate.fromModifiedJulianDays(mjDays);
    }
View Full Code Here

     * @return the next year, never null
     * @throws CalendricalException if the maximum year is reached
     */
    public Year next() {
        if (year == MAX_YEAR) {
            throw new CalendricalException("Year is already at the maximum value");
        }
        return isoYear(year + 1);
    }
View Full Code Here

     * @return the previous year, never null
     * @throws CalendricalException if the maximum year is reached
     */
    public Year previous() {
        if (year == MIN_YEAR) {
            throw new CalendricalException("Year is already at the minimum value");
        }
        return isoYear(year - 1);
    }
View Full Code Here

        if (years == 0) {
            return this;
        }
        int result = year + years;
        if (((year ^ result) < 0 && (year ^ years) >= 0) || rule().isValidValue(result) == false) {
            throw new CalendricalException("Addition exceeds the supported year range: " + year + " + " + years);
        }
        return isoYear(result);
    }
View Full Code Here

TOP

Related Classes of javax.time.CalendricalException

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.