This is an automated email from the ASF dual-hosted git repository. aherbert pushed a commit to branch complex-gsoc-2022 in repository https://gitbox.apache.org/repos/asf/commons-numbers.git
commit 93ce2777c6f7f2b500d98a8c2d156993a9dd77d1 Author: aherbert <aherb...@apache.org> AuthorDate: Thu Jul 28 10:41:54 2022 +0100 Javadoc updates Add references to TestUtils helper methods. Finish end of sentence in functional interface javadoc. Correct divideImaginary code example. --- .../org/apache/commons/numbers/complex/ComplexFunctions.java | 2 +- .../apache/commons/numbers/complex/ComplexScalarFunction.java | 9 +++++---- .../test/java/org/apache/commons/numbers/complex/TestUtils.java | 8 ++++++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/ComplexFunctions.java b/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/ComplexFunctions.java index 1917aa1b..938ab9eb 100644 --- a/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/ComplexFunctions.java +++ b/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/ComplexFunctions.java @@ -909,7 +909,7 @@ public final class ComplexFunctions { * In this case the divide method using a zero-valued Complex will produce the same result * as dividing by a real-only zero. The output from dividing by imaginary zero will create * infinite and NaN values in the same component parts as the output from - * {@code divide(real, imaginary, Complex.ZERO, action).multiplyImaginary(real, imaginary, 1, action)}, however the sign + * {@code divide(real, imaginary, 0, 0, (x, y) -> multiplyImaginary(x, y, 1, action))}, however the sign * of some infinite values may be negated. * * @param real Real part \( a \) of the complex number \( (a +ib) \). diff --git a/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/ComplexScalarFunction.java b/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/ComplexScalarFunction.java index b339f5a3..40d2ac18 100644 --- a/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/ComplexScalarFunction.java +++ b/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/ComplexScalarFunction.java @@ -18,10 +18,11 @@ package org.apache.commons.numbers.complex; /** - * Represents a binary operation on a Cartesian form of a complex number \( a + ib \) - * and a {@code double} scalar operand, where \( a \) and \( b \) are real numbers represented as two {@code double} - * The operation creates a complex number result; the result is supplied to a terminating consumer function - * which may return an object representation of the complex result. + * Represents a binary operation on a Cartesian form of a complex number \( a + ib \) and + * a {@code double} scalar operand, where \( a \) and \( b \) are real numbers represented + * as two {@code double} parts. The operation creates a complex number result; the result + * is supplied to a terminating consumer function which may return an object + * representation of the complex result. * * <p>This is a functional interface whose functional method is * {@link #apply(double, double, double, ComplexSink)}. diff --git a/commons-numbers-complex/src/test/java/org/apache/commons/numbers/complex/TestUtils.java b/commons-numbers-complex/src/test/java/org/apache/commons/numbers/complex/TestUtils.java index ad50560e..be6ab717 100644 --- a/commons-numbers-complex/src/test/java/org/apache/commons/numbers/complex/TestUtils.java +++ b/commons-numbers-complex/src/test/java/org/apache/commons/numbers/complex/TestUtils.java @@ -534,10 +534,12 @@ public final class TestUtils { * * @param real Real part \( a \) of the complex number \( (a +ib) \). * @param imaginary Imaginary part \( b \) of the complex number \( (a +ib) \). - * @param minuend Value the complex number is to be subtracted from. + * @param minuend Real value the complex number is to be subtracted from. * @param action Consumer for the subtraction result. * @param <R> the return type of the supplied action. * @return the object returned by the supplied action. + * @see Complex#subtractFrom(double) + * @see ComplexFunctions#realSubtract(double, double, double, ComplexSink) */ public static <R> R subtractFrom(double real, double imaginary, double minuend, ComplexSink<R> action) { // Call the equivalent static API function @@ -555,10 +557,12 @@ public final class TestUtils { * * @param real Real part \( a \) of the complex number \( (a +ib) \). * @param imaginary Imaginary part \( b \) of the complex number \( (a +ib) \). - * @param minuend Value the complex number is to be subtracted from. + * @param minuend Imaginary value the complex number is to be subtracted from. * @param action Consumer for the subtraction result. * @param <R> the return type of the supplied action. * @return the object returned by the supplied action. + * @see Complex#subtractFromImaginary(double) + * @see ComplexFunctions#imaginarySubtract(double, double, double, ComplexSink) */ public static <R> R subtractFromImaginary(double real, double imaginary, double minuend, ComplexSink<R> action) { // Call the equivalent static API function