Updated throws declarations for transform package.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1382906 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Luc Maisonobe 2012-09-10 14:48:03 +00:00
parent b883dcbc08
commit 22bcab04fe
2 changed files with 20 additions and 10 deletions

View File

@ -94,7 +94,8 @@ public class FastCosineTransformer implements RealTransformer, Serializable {
* @throws MathIllegalArgumentException if the length of the data array is
* not a power of two plus one
*/
public double[] transform(final double[] f, final TransformType type) {
public double[] transform(final double[] f, final TransformType type)
throws MathIllegalArgumentException {
if (type == TransformType.FORWARD) {
if (normalization == DctNormalization.ORTHOGONAL_DCT_I) {
final double s = FastMath.sqrt(2.0 / (f.length - 1));
@ -124,7 +125,7 @@ public class FastCosineTransformer implements RealTransformer, Serializable {
*/
public double[] transform(final UnivariateFunction f,
final double min, final double max, final int n,
final TransformType type) {
final TransformType type) throws MathIllegalArgumentException {
final double[] data = FunctionUtils.sample(f, min, max, n);
return transform(data, type);

View File

@ -17,6 +17,9 @@
package org.apache.commons.math3.transform;
import org.apache.commons.math3.analysis.UnivariateFunction;
import org.apache.commons.math3.exception.MathIllegalArgumentException;
import org.apache.commons.math3.exception.NonMonotonicSequenceException;
import org.apache.commons.math3.exception.NotStrictlyPositiveException;
/**
* <p>Interface for one-dimensional data sets transformations producing real
@ -39,8 +42,11 @@ public interface RealTransformer {
* @param f the real data array to be transformed (signal)
* @param type the type of transform (forward, inverse) to be performed
* @return the real transformed array (spectrum)
* @throws MathIllegalArgumentException if the array cannot be transformed
* with the given type (this may be for example due to array size, which is
* constrained in some transforms)
*/
double[] transform(double[] f, TransformType type);
double[] transform(double[] f, TransformType type) throws MathIllegalArgumentException;
/**
* Returns the (forward, inverse) transform of the specified real function,
@ -52,12 +58,15 @@ public interface RealTransformer {
* @param n the number of sample points
* @param type the type of transform (forward, inverse) to be performed
* @return the real transformed array
* @throws org.apache.commons.math3.exception.NonMonotonicSequenceException
* if the lower bound is greater than, or equal to the upper bound
* @throws org.apache.commons.math3.exception.NotStrictlyPositiveException
* if the number of sample points is negative
* @throws NonMonotonicSequenceException if the lower bound is greater than,
* or equal to the upper bound
* @throws NotStrictlyPositiveException if the number of sample points is negative
* @throws MathIllegalArgumentException if the sample cannot be transformed
* with the given type (this may be for example due to sample size, which is
* constrained in some transforms)
*/
double[] transform(UnivariateFunction f,
double min, double max, int n,
TransformType type);
double[] transform(UnivariateFunction f, double min, double max, int n,
TransformType type)
throws NonMonotonicSequenceException, NotStrictlyPositiveException, MathIllegalArgumentException;
}