/** * Adds to each field of this period. * * @param years amount of years to add to this period, which must be zero if unsupported * @param months amount of months to add to this period, which must be zero if unsupported * @param weeks amount of weeks to add to this period, which must be zero if unsupported * @param days amount of days to add to this period, which must be zero if unsupported * @param hours amount of hours to add to this period, which must be zero if unsupported * @param minutes amount of minutes to add to this period, which must be zero if unsupported * @param seconds amount of seconds to add to this period, which must be zero if unsupported * @param millis amount of milliseconds to add to this period, which must be zero if unsupported * @throws IllegalArgumentException if the period being added contains a field * not supported by this period * @throws ArithmeticException if the addition exceeds the capacity of the period */ public void add(int years, int months, int weeks, int days, int hours, int minutes, int seconds, int millis) { setPeriod( FieldUtils.safeAdd(getYears(), years), FieldUtils.safeAdd(getMonths(), months), FieldUtils.safeAdd(getWeeks(), weeks), FieldUtils.safeAdd(getDays(), days), FieldUtils.safeAdd(getHours(), hours), FieldUtils.safeAdd(getMinutes(), minutes), FieldUtils.safeAdd(getSeconds(), seconds), FieldUtils.safeAdd(getMillis(), millis) ); }
/** * Adds to each field of this period. * * @param years amount of years to add to this period, which must be zero if unsupported * @param months amount of months to add to this period, which must be zero if unsupported * @param weeks amount of weeks to add to this period, which must be zero if unsupported * @param days amount of days to add to this period, which must be zero if unsupported * @param hours amount of hours to add to this period, which must be zero if unsupported * @param minutes amount of minutes to add to this period, which must be zero if unsupported * @param seconds amount of seconds to add to this period, which must be zero if unsupported * @param millis amount of milliseconds to add to this period, which must be zero if unsupported * @throws IllegalArgumentException if the period being added contains a field * not supported by this period * @throws ArithmeticException if the addition exceeds the capacity of the period */ public void add(int years, int months, int weeks, int days, int hours, int minutes, int seconds, int millis) { setPeriod( FieldUtils.safeAdd(getYears(), years), FieldUtils.safeAdd(getMonths(), months), FieldUtils.safeAdd(getWeeks(), weeks), FieldUtils.safeAdd(getDays(), days), FieldUtils.safeAdd(getHours(), hours), FieldUtils.safeAdd(getMinutes(), minutes), FieldUtils.safeAdd(getSeconds(), seconds), FieldUtils.safeAdd(getMillis(), millis) ); }
/** * Adds to each field of this period. * * @param years amount of years to add to this period, which must be zero if unsupported * @param months amount of months to add to this period, which must be zero if unsupported * @param weeks amount of weeks to add to this period, which must be zero if unsupported * @param days amount of days to add to this period, which must be zero if unsupported * @param hours amount of hours to add to this period, which must be zero if unsupported * @param minutes amount of minutes to add to this period, which must be zero if unsupported * @param seconds amount of seconds to add to this period, which must be zero if unsupported * @param millis amount of milliseconds to add to this period, which must be zero if unsupported * @throws IllegalArgumentException if the period being added contains a field * not supported by this period * @throws ArithmeticException if the addition exceeds the capacity of the period */ public void add(int years, int months, int weeks, int days, int hours, int minutes, int seconds, int millis) { setPeriod( FieldUtils.safeAdd(getYears(), years), FieldUtils.safeAdd(getMonths(), months), FieldUtils.safeAdd(getWeeks(), weeks), FieldUtils.safeAdd(getDays(), days), FieldUtils.safeAdd(getHours(), hours), FieldUtils.safeAdd(getMinutes(), minutes), FieldUtils.safeAdd(getSeconds(), seconds), FieldUtils.safeAdd(getMillis(), millis) ); }
/** * Helper method to negate a copy of period * * @param mPeriod * @return a negated copy of period */ static Period negatePeriod(Period period) { MutablePeriod mPeriod = period.toMutablePeriod(); mPeriod.setYears(-mPeriod.getYears()); mPeriod.setMonths(-mPeriod.getMonths()); mPeriod.setWeeks(-mPeriod.getWeeks()); mPeriod.setDays(-mPeriod.getDays()); mPeriod.setHours(-mPeriod.getHours()); mPeriod.setMinutes(-mPeriod.getMinutes()); mPeriod.setSeconds(-mPeriod.getSeconds()); mPeriod.setMillis(-mPeriod.getMillis()); return mPeriod.toPeriod(); }
/** * Helper method to negate a copy of period * * @param mPeriod * @return a negated copy of period */ static Period negatePeriod(Period period) { MutablePeriod mPeriod = period.toMutablePeriod(); mPeriod.setYears(-mPeriod.getYears()); mPeriod.setMonths(-mPeriod.getMonths()); mPeriod.setWeeks(-mPeriod.getWeeks()); mPeriod.setDays(-mPeriod.getDays()); mPeriod.setHours(-mPeriod.getHours()); mPeriod.setMinutes(-mPeriod.getMinutes()); mPeriod.setSeconds(-mPeriod.getSeconds()); mPeriod.setMillis(-mPeriod.getMillis()); return mPeriod.toPeriod(); }
/** * Adds to each field of this period. * * @param years amount of years to add to this period, which must be zero if unsupported * @param months amount of months to add to this period, which must be zero if unsupported * @param weeks amount of weeks to add to this period, which must be zero if unsupported * @param days amount of days to add to this period, which must be zero if unsupported * @param hours amount of hours to add to this period, which must be zero if unsupported * @param minutes amount of minutes to add to this period, which must be zero if unsupported * @param seconds amount of seconds to add to this period, which must be zero if unsupported * @param millis amount of milliseconds to add to this period, which must be zero if unsupported * @throws IllegalArgumentException if the period being added contains a field * not supported by this period * @throws ArithmeticException if the addition exceeds the capacity of the period */ public void add(int years, int months, int weeks, int days, int hours, int minutes, int seconds, int millis) { setPeriod( FieldUtils.safeAdd(getYears(), years), FieldUtils.safeAdd(getMonths(), months), FieldUtils.safeAdd(getWeeks(), weeks), FieldUtils.safeAdd(getDays(), days), FieldUtils.safeAdd(getHours(), hours), FieldUtils.safeAdd(getMinutes(), minutes), FieldUtils.safeAdd(getSeconds(), seconds), FieldUtils.safeAdd(getMillis(), millis) ); }
/** * Adds to each field of this period. * * @param years amount of years to add to this period, which must be zero if unsupported * @param months amount of months to add to this period, which must be zero if unsupported * @param weeks amount of weeks to add to this period, which must be zero if unsupported * @param days amount of days to add to this period, which must be zero if unsupported * @param hours amount of hours to add to this period, which must be zero if unsupported * @param minutes amount of minutes to add to this period, which must be zero if unsupported * @param seconds amount of seconds to add to this period, which must be zero if unsupported * @param millis amount of milliseconds to add to this period, which must be zero if unsupported * @throws IllegalArgumentException if the period being added contains a field * not supported by this period * @throws ArithmeticException if the addition exceeds the capacity of the period */ public void add(int years, int months, int weeks, int days, int hours, int minutes, int seconds, int millis) { setPeriod( FieldUtils.safeAdd(getYears(), years), FieldUtils.safeAdd(getMonths(), months), FieldUtils.safeAdd(getWeeks(), weeks), FieldUtils.safeAdd(getDays(), days), FieldUtils.safeAdd(getHours(), hours), FieldUtils.safeAdd(getMinutes(), minutes), FieldUtils.safeAdd(getSeconds(), seconds), FieldUtils.safeAdd(getMillis(), millis) ); }
/** * Adds to each field of this period. * * @param years amount of years to add to this period, which must be zero if unsupported * @param months amount of months to add to this period, which must be zero if unsupported * @param weeks amount of weeks to add to this period, which must be zero if unsupported * @param days amount of days to add to this period, which must be zero if unsupported * @param hours amount of hours to add to this period, which must be zero if unsupported * @param minutes amount of minutes to add to this period, which must be zero if unsupported * @param seconds amount of seconds to add to this period, which must be zero if unsupported * @param millis amount of milliseconds to add to this period, which must be zero if unsupported * @throws IllegalArgumentException if the period being added contains a field * not supported by this period * @throws ArithmeticException if the addition exceeds the capacity of the period */ public void add(int years, int months, int weeks, int days, int hours, int minutes, int seconds, int millis) { setPeriod( FieldUtils.safeAdd(getYears(), years), FieldUtils.safeAdd(getMonths(), months), FieldUtils.safeAdd(getWeeks(), weeks), FieldUtils.safeAdd(getDays(), days), FieldUtils.safeAdd(getHours(), hours), FieldUtils.safeAdd(getMinutes(), minutes), FieldUtils.safeAdd(getSeconds(), seconds), FieldUtils.safeAdd(getMillis(), millis) ); }
/** * Adds to each field of this period. * * @param years amount of years to add to this period, which must be zero if unsupported * @param months amount of months to add to this period, which must be zero if unsupported * @param weeks amount of weeks to add to this period, which must be zero if unsupported * @param days amount of days to add to this period, which must be zero if unsupported * @param hours amount of hours to add to this period, which must be zero if unsupported * @param minutes amount of minutes to add to this period, which must be zero if unsupported * @param seconds amount of seconds to add to this period, which must be zero if unsupported * @param millis amount of milliseconds to add to this period, which must be zero if unsupported * @throws IllegalArgumentException if the period being added contains a field * not supported by this period * @throws ArithmeticException if the addition exceeds the capacity of the period */ public void add(int years, int months, int weeks, int days, int hours, int minutes, int seconds, int millis) { setPeriod( FieldUtils.safeAdd(getYears(), years), FieldUtils.safeAdd(getMonths(), months), FieldUtils.safeAdd(getWeeks(), weeks), FieldUtils.safeAdd(getDays(), days), FieldUtils.safeAdd(getHours(), hours), FieldUtils.safeAdd(getMinutes(), minutes), FieldUtils.safeAdd(getSeconds(), seconds), FieldUtils.safeAdd(getMillis(), millis) ); }
/** * Adds to each field of this period. * * @param years amount of years to add to this period, which must be zero if unsupported * @param months amount of months to add to this period, which must be zero if unsupported * @param weeks amount of weeks to add to this period, which must be zero if unsupported * @param days amount of days to add to this period, which must be zero if unsupported * @param hours amount of hours to add to this period, which must be zero if unsupported * @param minutes amount of minutes to add to this period, which must be zero if unsupported * @param seconds amount of seconds to add to this period, which must be zero if unsupported * @param millis amount of milliseconds to add to this period, which must be zero if unsupported * @throws IllegalArgumentException if the period being added contains a field * not supported by this period * @throws ArithmeticException if the addition exceeds the capacity of the period */ public void add(int years, int months, int weeks, int days, int hours, int minutes, int seconds, int millis) { setPeriod( FieldUtils.safeAdd(getYears(), years), FieldUtils.safeAdd(getMonths(), months), FieldUtils.safeAdd(getWeeks(), weeks), FieldUtils.safeAdd(getDays(), days), FieldUtils.safeAdd(getHours(), hours), FieldUtils.safeAdd(getMinutes(), minutes), FieldUtils.safeAdd(getSeconds(), seconds), FieldUtils.safeAdd(getMillis(), millis) ); }
/** * Adds to each field of this period. * * @param years amount of years to add to this period, which must be zero if unsupported * @param months amount of months to add to this period, which must be zero if unsupported * @param weeks amount of weeks to add to this period, which must be zero if unsupported * @param days amount of days to add to this period, which must be zero if unsupported * @param hours amount of hours to add to this period, which must be zero if unsupported * @param minutes amount of minutes to add to this period, which must be zero if unsupported * @param seconds amount of seconds to add to this period, which must be zero if unsupported * @param millis amount of milliseconds to add to this period, which must be zero if unsupported * @throws IllegalArgumentException if the period being added contains a field * not supported by this period * @throws ArithmeticException if the addition exceeds the capacity of the period */ public void add(int years, int months, int weeks, int days, int hours, int minutes, int seconds, int millis) { setPeriod( FieldUtils.safeAdd(getYears(), years), FieldUtils.safeAdd(getMonths(), months), FieldUtils.safeAdd(getWeeks(), weeks), FieldUtils.safeAdd(getDays(), days), FieldUtils.safeAdd(getHours(), hours), FieldUtils.safeAdd(getMinutes(), minutes), FieldUtils.safeAdd(getSeconds(), seconds), FieldUtils.safeAdd(getMillis(), millis) ); }
/** * Adds to each field of this period. * * @param years amount of years to add to this period, which must be zero if unsupported * @param months amount of months to add to this period, which must be zero if unsupported * @param weeks amount of weeks to add to this period, which must be zero if unsupported * @param days amount of days to add to this period, which must be zero if unsupported * @param hours amount of hours to add to this period, which must be zero if unsupported * @param minutes amount of minutes to add to this period, which must be zero if unsupported * @param seconds amount of seconds to add to this period, which must be zero if unsupported * @param millis amount of milliseconds to add to this period, which must be zero if unsupported * @throws IllegalArgumentException if the period being added contains a field * not supported by this period * @throws ArithmeticException if the addition exceeds the capacity of the period */ public void add(int years, int months, int weeks, int days, int hours, int minutes, int seconds, int millis) { setPeriod( FieldUtils.safeAdd(getYears(), years), FieldUtils.safeAdd(getMonths(), months), FieldUtils.safeAdd(getWeeks(), weeks), FieldUtils.safeAdd(getDays(), days), FieldUtils.safeAdd(getHours(), hours), FieldUtils.safeAdd(getMinutes(), minutes), FieldUtils.safeAdd(getSeconds(), seconds), FieldUtils.safeAdd(getMillis(), millis) ); }
/** * Adds to each field of this period. * * @param years amount of years to add to this period, which must be zero if unsupported * @param months amount of months to add to this period, which must be zero if unsupported * @param weeks amount of weeks to add to this period, which must be zero if unsupported * @param days amount of days to add to this period, which must be zero if unsupported * @param hours amount of hours to add to this period, which must be zero if unsupported * @param minutes amount of minutes to add to this period, which must be zero if unsupported * @param seconds amount of seconds to add to this period, which must be zero if unsupported * @param millis amount of milliseconds to add to this period, which must be zero if unsupported * @throws IllegalArgumentException if the period being added contains a field * not supported by this period * @throws ArithmeticException if the addition exceeds the capacity of the period */ public void add(int years, int months, int weeks, int days, int hours, int minutes, int seconds, int millis) { setPeriod( FieldUtils.safeAdd(getYears(), years), FieldUtils.safeAdd(getMonths(), months), FieldUtils.safeAdd(getWeeks(), weeks), FieldUtils.safeAdd(getDays(), days), FieldUtils.safeAdd(getHours(), hours), FieldUtils.safeAdd(getMinutes(), minutes), FieldUtils.safeAdd(getSeconds(), seconds), FieldUtils.safeAdd(getMillis(), millis) ); }