Liefert die chronologische Regel zur angegebenen Zeiteinheit. @param unit time unit @return unit rule or null if not registered
(U unit)
| 553 | * @return unit rule or {@code null} if not registered |
| 554 | */ |
| 555 | UnitRule<T> getRule(U unit) { |
| 556 | |
| 557 | if (unit == null) { |
| 558 | throw new NullPointerException("Missing chronological unit."); |
| 559 | } |
| 560 | |
| 561 | UnitRule<T> rule = this.unitRules.get(unit); |
| 562 | |
| 563 | if (rule == null) { |
| 564 | if (unit instanceof BasicUnit) { |
| 565 | rule = BasicUnit.class.cast(unit).derive(this); |
| 566 | } |
| 567 | if (rule == null) { |
| 568 | throw new RuleNotFoundException(this, unit); |
| 569 | } |
| 570 | } |
| 571 | |
| 572 | return rule; |
| 573 | |
| 574 | } |
| 575 | |
| 576 | private static <U> double getLength( |
| 577 | Map<U, Double> unitLengths, |