equal
deleted
inserted
replaced
225 return (D) ChronoLocalDate.super.minus(amountToSubtract, unit); |
225 return (D) ChronoLocalDate.super.minus(amountToSubtract, unit); |
226 } |
226 } |
227 |
227 |
228 //----------------------------------------------------------------------- |
228 //----------------------------------------------------------------------- |
229 /** |
229 /** |
230 * Returns a copy of this date with the specified period in years added. |
230 * Returns a copy of this date with the specified number of years added. |
231 * <p> |
231 * <p> |
232 * This adds the specified period in years to the date. |
232 * This adds the specified period in years to the date. |
233 * In some cases, adding years can cause the resulting date to become invalid. |
233 * In some cases, adding years can cause the resulting date to become invalid. |
234 * If this occurs, then other fields, typically the day-of-month, will be adjusted to ensure |
234 * If this occurs, then other fields, typically the day-of-month, will be adjusted to ensure |
235 * that the result is valid. Typically this will select the last valid day of the month. |
235 * that the result is valid. Typically this will select the last valid day of the month. |
241 * @throws DateTimeException if the result exceeds the supported date range |
241 * @throws DateTimeException if the result exceeds the supported date range |
242 */ |
242 */ |
243 abstract D plusYears(long yearsToAdd); |
243 abstract D plusYears(long yearsToAdd); |
244 |
244 |
245 /** |
245 /** |
246 * Returns a copy of this date with the specified period in months added. |
246 * Returns a copy of this date with the specified number of months added. |
247 * <p> |
247 * <p> |
248 * This adds the specified period in months to the date. |
248 * This adds the specified period in months to the date. |
249 * In some cases, adding months can cause the resulting date to become invalid. |
249 * In some cases, adding months can cause the resulting date to become invalid. |
250 * If this occurs, then other fields, typically the day-of-month, will be adjusted to ensure |
250 * If this occurs, then other fields, typically the day-of-month, will be adjusted to ensure |
251 * that the result is valid. Typically this will select the last valid day of the month. |
251 * that the result is valid. Typically this will select the last valid day of the month. |
257 * @throws DateTimeException if the result exceeds the supported date range |
257 * @throws DateTimeException if the result exceeds the supported date range |
258 */ |
258 */ |
259 abstract D plusMonths(long monthsToAdd); |
259 abstract D plusMonths(long monthsToAdd); |
260 |
260 |
261 /** |
261 /** |
262 * Returns a copy of this date with the specified period in weeks added. |
262 * Returns a copy of this date with the specified number of weeks added. |
263 * <p> |
263 * <p> |
264 * This adds the specified period in weeks to the date. |
264 * This adds the specified period in weeks to the date. |
265 * In some cases, adding weeks can cause the resulting date to become invalid. |
265 * In some cases, adding weeks can cause the resulting date to become invalid. |
266 * If this occurs, then other fields will be adjusted to ensure that the result is valid. |
266 * If this occurs, then other fields will be adjusted to ensure that the result is valid. |
267 * <p> |
267 * <p> |
290 */ |
290 */ |
291 abstract D plusDays(long daysToAdd); |
291 abstract D plusDays(long daysToAdd); |
292 |
292 |
293 //----------------------------------------------------------------------- |
293 //----------------------------------------------------------------------- |
294 /** |
294 /** |
295 * Returns a copy of this date with the specified period in years subtracted. |
295 * Returns a copy of this date with the specified number of years subtracted. |
296 * <p> |
296 * <p> |
297 * This subtracts the specified period in years to the date. |
297 * This subtracts the specified period in years to the date. |
298 * In some cases, subtracting years can cause the resulting date to become invalid. |
298 * In some cases, subtracting years can cause the resulting date to become invalid. |
299 * If this occurs, then other fields, typically the day-of-month, will be adjusted to ensure |
299 * If this occurs, then other fields, typically the day-of-month, will be adjusted to ensure |
300 * that the result is valid. Typically this will select the last valid day of the month. |
300 * that the result is valid. Typically this will select the last valid day of the month. |
311 D minusYears(long yearsToSubtract) { |
311 D minusYears(long yearsToSubtract) { |
312 return (yearsToSubtract == Long.MIN_VALUE ? ((ChronoLocalDateImpl<D>)plusYears(Long.MAX_VALUE)).plusYears(1) : plusYears(-yearsToSubtract)); |
312 return (yearsToSubtract == Long.MIN_VALUE ? ((ChronoLocalDateImpl<D>)plusYears(Long.MAX_VALUE)).plusYears(1) : plusYears(-yearsToSubtract)); |
313 } |
313 } |
314 |
314 |
315 /** |
315 /** |
316 * Returns a copy of this date with the specified period in months subtracted. |
316 * Returns a copy of this date with the specified number of months subtracted. |
317 * <p> |
317 * <p> |
318 * This subtracts the specified period in months to the date. |
318 * This subtracts the specified period in months to the date. |
319 * In some cases, subtracting months can cause the resulting date to become invalid. |
319 * In some cases, subtracting months can cause the resulting date to become invalid. |
320 * If this occurs, then other fields, typically the day-of-month, will be adjusted to ensure |
320 * If this occurs, then other fields, typically the day-of-month, will be adjusted to ensure |
321 * that the result is valid. Typically this will select the last valid day of the month. |
321 * that the result is valid. Typically this will select the last valid day of the month. |
332 D minusMonths(long monthsToSubtract) { |
332 D minusMonths(long monthsToSubtract) { |
333 return (monthsToSubtract == Long.MIN_VALUE ? ((ChronoLocalDateImpl<D>)plusMonths(Long.MAX_VALUE)).plusMonths(1) : plusMonths(-monthsToSubtract)); |
333 return (monthsToSubtract == Long.MIN_VALUE ? ((ChronoLocalDateImpl<D>)plusMonths(Long.MAX_VALUE)).plusMonths(1) : plusMonths(-monthsToSubtract)); |
334 } |
334 } |
335 |
335 |
336 /** |
336 /** |
337 * Returns a copy of this date with the specified period in weeks subtracted. |
337 * Returns a copy of this date with the specified number of weeks subtracted. |
338 * <p> |
338 * <p> |
339 * This subtracts the specified period in weeks to the date. |
339 * This subtracts the specified period in weeks to the date. |
340 * In some cases, subtracting weeks can cause the resulting date to become invalid. |
340 * In some cases, subtracting weeks can cause the resulting date to become invalid. |
341 * If this occurs, then other fields will be adjusted to ensure that the result is valid. |
341 * If this occurs, then other fields will be adjusted to ensure that the result is valid. |
342 * <p> |
342 * <p> |