(Moment moment)
| 2425 | //~ Methoden ------------------------------------------------------ |
| 2426 | |
| 2427 | @Override |
| 2428 | public Moment apply(Moment moment) { |
| 2429 | |
| 2430 | Timezone timezone = ( |
| 2431 | (this.tz == null) |
| 2432 | ? Timezone.ofSystem() |
| 2433 | : this.tz); |
| 2434 | |
| 2435 | if ( |
| 2436 | moment.isLeapSecond() |
| 2437 | && isNonIsoOffset(timezone, moment) |
| 2438 | ) { |
| 2439 | throw new IllegalArgumentException( |
| 2440 | "Leap second can only be adjusted " |
| 2441 | + " with timezone-offset in full minutes: " |
| 2442 | + timezone.getOffset(moment)); |
| 2443 | } |
| 2444 | |
| 2445 | // Spezialfall feingranulare Zeitarithmetik in der UTC-Ära |
| 2446 | if (moment.isAfter(START_LS_CHECK)) { |
| 2447 | if ( |
| 2448 | (this.element == SECOND_OF_MINUTE) |
| 2449 | && (this.type == ElementOperator.OP_NEW_VALUE) |
| 2450 | && (this.extractValue() == 60) |
| 2451 | ) { |
| 2452 | if (moment.isLeapSecond()) { |
| 2453 | return moment; |
| 2454 | } else if (isNonIsoOffset(timezone, moment)) { |
| 2455 | throw new IllegalArgumentException( |
| 2456 | "Leap second can only be set " |
| 2457 | + " with timezone-offset in full minutes: " |
| 2458 | + timezone.getOffset(moment)); |
| 2459 | } else if (getMaxSecondOfMinute(moment) == 60) { |
| 2460 | return moment.plus( |
| 2461 | Math.subtractExact(60, this.extractOld(moment)), |
| 2462 | SECONDS); |
| 2463 | } else { |
| 2464 | throw new IllegalArgumentException( |
| 2465 | "Leap second invalid in context: " + moment); |
| 2466 | } |
| 2467 | } else if ( |
| 2468 | LOW_TIME_ELEMENTS.containsKey(this.element) |
| 2469 | && ((this.type == ElementOperator.OP_DECREMENT) |
| 2470 | || (this.type == ElementOperator.OP_INCREMENT) |
| 2471 | || (this.type == ElementOperator.OP_LENIENT)) |
| 2472 | ) { |
| 2473 | int step = LOW_TIME_ELEMENTS.get(this.element).intValue(); |
| 2474 | long amount = 1; |
| 2475 | |
| 2476 | if (this.type == ElementOperator.OP_DECREMENT) { |
| 2477 | amount = -1; |
| 2478 | } else if (this.type == ElementOperator.OP_LENIENT) { |
| 2479 | long oldValue = this.extractOld(moment); |
| 2480 | long newValue = this.extractValue(); |
| 2481 | amount = Math.subtractExact(newValue, oldValue); |
| 2482 | } |
| 2483 | |
| 2484 | switch (step) { |
nothing calls this directly
no test coverage detected