public final void changeEndTime ( LocalTime time , boolean keepDuration ) { requireNonNull ( time ) ; Interval interval = getInterval ( ) ; LocalDateTime newEndDateTime = getEndAsLocalDateTime ( ) . with ( time ) ; LocalDateTime startDateTime = getStartAsLocalDateTime ( ) ; if ( keepDuration ) { startDateTime = newEndDateTime . minus ( getDuration ( ) ) ; setInterval ( startDateTime , newEndDateTime , getZoneId ( ) ) ; } else { /* * We might have a problem if the new end time is BEFORE the current start time. */ if ( newEndDateTime . isBefore ( startDateTime . plus ( getMinimumDuration ( ) ) ) ) { interval = interval . withStartDateTime ( newEndDateTime . minus ( getMinimumDuration ( ) ) ) ; } setInterval ( interval . withEndTime ( time ) ) ; } }
Changes the end time of the entry interval .