Times implements Degrees<T> { @Override public Number resolve(final InnerProduct<T> product) { return this.angle.resolve(product).doubleValue() * this.multiple.doubleValue(); } Times(final Degrees<T> angle, final Number multiple); @Override Number resolve(final InnerProduct<T> product);  }
@Test public void resolvesAngleTimes() { final Degrees<Object> first = new Degrees.Default<>(Math.random()); final Degrees<Object> second = new Degrees.Default<>(Math.random()); final Degrees<Object> third = new Degrees.Default<>(Math.random()); final InnerProduct<Object> pdt = new MkProduct<>(); final double factor = Math.random(); final double error = 1.e-6; MatcherAssert.assertThat( new Times<>(first, factor).resolve(pdt).doubleValue(), Matchers.closeTo(first.resolve(pdt).doubleValue() * factor, error) ); MatcherAssert.assertThat( new Times<>(second, factor).resolve(pdt).doubleValue(), Matchers.closeTo(second.resolve(pdt).doubleValue() * factor, error) ); MatcherAssert.assertThat( new Times<>(third, factor).resolve(pdt).doubleValue(), Matchers.closeTo(third.resolve(pdt).doubleValue() * factor, error) ); }