Hilfsobjekt für Standard-Normalisierungen einer Dauer. @author Meno Hochschild @since 3.1
| 41 | * @since 3.1 |
| 42 | */ |
| 43 | class StdNormalizer<U extends IsoUnit> |
| 44 | implements Normalizer<U>, Comparator<TimeSpan.Item<? extends ChronoUnit>> { |
| 45 | |
| 46 | //~ Statische Felder/Initialisierungen -------------------------------- |
| 47 | |
| 48 | private static final int MIO = 1_000_000; |
| 49 | private static final int MRD = 1_000_000_000; |
| 50 | |
| 51 | //~ Instanzvariablen -------------------------------------------------- |
| 52 | |
| 53 | private final boolean mixed; |
| 54 | |
| 55 | //~ Konstruktoren ----------------------------------------------------- |
| 56 | |
| 57 | private StdNormalizer(boolean mixed) { |
| 58 | super(); |
| 59 | |
| 60 | this.mixed = mixed; |
| 61 | |
| 62 | } |
| 63 | |
| 64 | //~ Methoden ---------------------------------------------------------- |
| 65 | |
| 66 | static StdNormalizer<IsoUnit> ofMixedUnits() { |
| 67 | |
| 68 | return new StdNormalizer<>(true); |
| 69 | |
| 70 | } |
| 71 | |
| 72 | static StdNormalizer<CalendarUnit> ofCalendarUnits() { |
| 73 | |
| 74 | return new StdNormalizer<>(false); |
| 75 | |
| 76 | } |
| 77 | |
| 78 | static StdNormalizer<ClockUnit> ofClockUnits() { |
| 79 | |
| 80 | return new StdNormalizer<>(false); |
| 81 | |
| 82 | } |
| 83 | |
| 84 | static Comparator<TimeSpan.Item<? extends ChronoUnit>> comparator() { |
| 85 | |
| 86 | return new StdNormalizer<>(false); |
| 87 | |
| 88 | } |
| 89 | |
| 90 | @Override |
| 91 | public int compare( |
| 92 | TimeSpan.Item<? extends ChronoUnit> o1, |
| 93 | TimeSpan.Item<? extends ChronoUnit> o2 |
| 94 | ) { |
| 95 | |
| 96 | return compare(o1.getUnit(), o2.getUnit()); |
| 97 | |
| 98 | } |
| 99 | |
| 100 | @SuppressWarnings("unchecked") |
nothing calls this directly
no outgoing calls
no test coverage detected