Remove spurious "throws" clause.

This commit is contained in:
Gilles Sadowski 2021-12-31 00:53:17 +01:00
parent 8904e6263a
commit 83fb6ef292
6 changed files with 8 additions and 19 deletions

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.commons.math4.legacy.ml.distance; package org.apache.commons.math4.legacy.ml.distance;
import org.apache.commons.math4.legacy.exception.DimensionMismatchException;
import org.apache.commons.math4.core.jdkmath.JdkMath; import org.apache.commons.math4.core.jdkmath.JdkMath;
import org.apache.commons.math4.legacy.core.MathArrays; import org.apache.commons.math4.legacy.core.MathArrays;
@ -28,8 +27,7 @@ import org.apache.commons.math4.legacy.core.MathArrays;
public class CanberraDistance implements DistanceMeasure { public class CanberraDistance implements DistanceMeasure {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public double compute(double[] a, double[] b) public double compute(double[] a, double[] b) {
throws DimensionMismatchException {
MathArrays.checkEqualLength(a, b); MathArrays.checkEqualLength(a, b);
double sum = 0; double sum = 0;
for (int i = 0; i < a.length; i++) { for (int i = 0; i < a.length; i++) {

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.commons.math4.legacy.ml.distance; package org.apache.commons.math4.legacy.ml.distance;
import org.apache.commons.math4.legacy.exception.DimensionMismatchException;
import org.apache.commons.math4.legacy.core.MathArrays; import org.apache.commons.math4.legacy.core.MathArrays;
/** /**
@ -27,8 +26,7 @@ import org.apache.commons.math4.legacy.core.MathArrays;
public class ChebyshevDistance implements DistanceMeasure { public class ChebyshevDistance implements DistanceMeasure {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public double compute(double[] a, double[] b) public double compute(double[] a, double[] b) {
throws DimensionMismatchException {
return MathArrays.distanceInf(a, b); return MathArrays.distanceInf(a, b);
} }
} }

View File

@ -16,8 +16,6 @@
*/ */
package org.apache.commons.math4.legacy.ml.distance; package org.apache.commons.math4.legacy.ml.distance;
import org.apache.commons.math4.legacy.exception.DimensionMismatchException;
/** /**
* Interface for distance measures of n-dimensional vectors. * Interface for distance measures of n-dimensional vectors.
* *
@ -33,7 +31,8 @@ public interface DistanceMeasure {
* @param a the first vector * @param a the first vector
* @param b the second vector * @param b the second vector
* @return the distance between the two vectors * @return the distance between the two vectors
* @throws DimensionMismatchException if the array lengths differ. * @throws org.apache.commons.math4.legacy.exception.DimensionMismatchException
* if the array lengths differ.
*/ */
double compute(double[] a, double[] b) throws DimensionMismatchException; double compute(double[] a, double[] b);
} }

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.commons.math4.legacy.ml.distance; package org.apache.commons.math4.legacy.ml.distance;
import org.apache.commons.math4.legacy.exception.DimensionMismatchException;
import org.apache.commons.math4.core.jdkmath.JdkMath; import org.apache.commons.math4.core.jdkmath.JdkMath;
import org.apache.commons.math4.legacy.core.MathArrays; import org.apache.commons.math4.legacy.core.MathArrays;
@ -30,8 +29,7 @@ import org.apache.commons.math4.legacy.core.MathArrays;
public class EarthMoversDistance implements DistanceMeasure { public class EarthMoversDistance implements DistanceMeasure {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public double compute(double[] a, double[] b) public double compute(double[] a, double[] b) {
throws DimensionMismatchException {
MathArrays.checkEqualLength(a, b); MathArrays.checkEqualLength(a, b);
double lastDistance = 0; double lastDistance = 0;
double totalDistance = 0; double totalDistance = 0;

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.commons.math4.legacy.ml.distance; package org.apache.commons.math4.legacy.ml.distance;
import org.apache.commons.math4.legacy.exception.DimensionMismatchException;
import org.apache.commons.math4.legacy.core.MathArrays; import org.apache.commons.math4.legacy.core.MathArrays;
/** /**
@ -27,8 +26,7 @@ import org.apache.commons.math4.legacy.core.MathArrays;
public class EuclideanDistance implements DistanceMeasure { public class EuclideanDistance implements DistanceMeasure {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public double compute(double[] a, double[] b) public double compute(double[] a, double[] b) {
throws DimensionMismatchException {
return MathArrays.distance(a, b); return MathArrays.distance(a, b);
} }
} }

View File

@ -16,7 +16,6 @@
*/ */
package org.apache.commons.math4.legacy.ml.distance; package org.apache.commons.math4.legacy.ml.distance;
import org.apache.commons.math4.legacy.exception.DimensionMismatchException;
import org.apache.commons.math4.legacy.core.MathArrays; import org.apache.commons.math4.legacy.core.MathArrays;
/** /**
@ -27,8 +26,7 @@ import org.apache.commons.math4.legacy.core.MathArrays;
public class ManhattanDistance implements DistanceMeasure { public class ManhattanDistance implements DistanceMeasure {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public double compute(double[] a, double[] b) public double compute(double[] a, double[] b) {
throws DimensionMismatchException {
return MathArrays.distance1(a, b); return MathArrays.distance1(a, b);
} }
} }