MCPcopy Create free account
hub / github.com/MenoData/Time4J / replaceFraction

Method replaceFraction

base/src/main/java/net/time4j/Duration.java:3178–3195  ·  view source on GitHub ↗
(
        long amount,
        U unit
    )

Source from the content-addressed store, hash-verified

3176
3177 // optional
3178 private static <U extends IsoUnit> Item<U> replaceFraction(
3179 long amount,
3180 U unit
3181 ) {
3182
3183 if (unit.equals(MILLIS)) {
3184 amount = MathUtils.safeMultiply(amount, MIO);
3185 unit = cast(NANOS);
3186 } else if (unit.equals(MICROS)) {
3187 amount = MathUtils.safeMultiply(amount, 1000L);
3188 unit = cast(NANOS);
3189 } else {
3190 return null;
3191 }
3192
3193 return Item.of(amount, unit);
3194
3195 }
3196
3197 private static <U extends IsoUnit> Duration<U> merge(
3198 Duration<U> duration,

Callers 3

plusMethod · 0.95
withMethod · 0.95
mergeMethod · 0.95

Calls 4

safeMultiplyMethod · 0.95
castMethod · 0.95
ofMethod · 0.95
equalsMethod · 0.45

Tested by

no test coverage detected