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

Method multipliedBy

base/src/main/java/net/time4j/MachineTime.java:798–822  ·  view source on GitHub ↗
(long factor)

Source from the content-addressed store, hash-verified

796 * @return changed copy of this duration
797 */
798 public MachineTime<U> multipliedBy(long factor) {
799
800 if (factor == 1) {
801 return this;
802 } else if (factor == 0) {
803 if (this.scale == POSIX) {
804 return cast(POSIX_ZERO);
805 } else {
806 return cast(UTC_ZERO);
807 }
808 }
809
810 BigDecimal value =
811 this.toBigDecimal().multiply(BigDecimal.valueOf(factor));
812 MachineTime<?> mt;
813
814 if (this.scale == POSIX) {
815 mt = MachineTime.ofPosixSeconds(value);
816 } else {
817 mt = MachineTime.ofSISeconds(value);
818 }
819
820 return cast(mt);
821
822 }
823
824 /**
825 * <p>Multiplies this duration with given decimal factor. </p>

Callers

nothing calls this directly

Calls 6

castMethod · 0.95
toBigDecimalMethod · 0.95
ofPosixSecondsMethod · 0.95
ofSISecondsMethod · 0.95
isFiniteMethod · 0.65
valueOfMethod · 0.45

Tested by

no test coverage detected