Eliminated deprecated exception.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1206618 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d7f3fee311
commit
325e797341
|
@ -20,8 +20,9 @@ import java.io.Serializable;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import org.apache.commons.math.MathRuntimeException;
|
import org.apache.commons.math.exception.MathIllegalArgumentException;
|
||||||
import org.apache.commons.math.exception.NullArgumentException;
|
import org.apache.commons.math.exception.NullArgumentException;
|
||||||
|
import org.apache.commons.math.exception.MathIllegalStateException;
|
||||||
import org.apache.commons.math.exception.util.LocalizedFormats;
|
import org.apache.commons.math.exception.util.LocalizedFormats;
|
||||||
import org.apache.commons.math.stat.descriptive.moment.GeometricMean;
|
import org.apache.commons.math.stat.descriptive.moment.GeometricMean;
|
||||||
import org.apache.commons.math.stat.descriptive.moment.Kurtosis;
|
import org.apache.commons.math.stat.descriptive.moment.Kurtosis;
|
||||||
|
@ -339,7 +340,7 @@ public class DescriptiveStatistics implements StatisticalSummary, Serializable {
|
||||||
public void setWindowSize(int windowSize) {
|
public void setWindowSize(int windowSize) {
|
||||||
if (windowSize < 1) {
|
if (windowSize < 1) {
|
||||||
if (windowSize != INFINITE_WINDOW) {
|
if (windowSize != INFINITE_WINDOW) {
|
||||||
throw MathRuntimeException.createIllegalArgumentException(
|
throw new MathIllegalArgumentException(
|
||||||
LocalizedFormats.NOT_POSITIVE_WINDOW_SIZE, windowSize);
|
LocalizedFormats.NOT_POSITIVE_WINDOW_SIZE, windowSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -407,7 +408,6 @@ public class DescriptiveStatistics implements StatisticalSummary, Serializable {
|
||||||
* @return An estimate for the pth percentile of the stored data
|
* @return An estimate for the pth percentile of the stored data
|
||||||
* @throws IllegalStateException if percentile implementation has been
|
* @throws IllegalStateException if percentile implementation has been
|
||||||
* overridden and the supplied implementation does not support setQuantile
|
* overridden and the supplied implementation does not support setQuantile
|
||||||
* values
|
|
||||||
*/
|
*/
|
||||||
public double getPercentile(double p) {
|
public double getPercentile(double p) {
|
||||||
if (percentileImpl instanceof Percentile) {
|
if (percentileImpl instanceof Percentile) {
|
||||||
|
@ -418,15 +418,15 @@ public class DescriptiveStatistics implements StatisticalSummary, Serializable {
|
||||||
new Class[] {Double.TYPE}).invoke(percentileImpl,
|
new Class[] {Double.TYPE}).invoke(percentileImpl,
|
||||||
new Object[] {Double.valueOf(p)});
|
new Object[] {Double.valueOf(p)});
|
||||||
} catch (NoSuchMethodException e1) { // Setter guard should prevent
|
} catch (NoSuchMethodException e1) { // Setter guard should prevent
|
||||||
throw MathRuntimeException.createIllegalArgumentException(
|
throw new MathIllegalStateException(
|
||||||
LocalizedFormats.PERCENTILE_IMPLEMENTATION_UNSUPPORTED_METHOD,
|
LocalizedFormats.PERCENTILE_IMPLEMENTATION_UNSUPPORTED_METHOD,
|
||||||
percentileImpl.getClass().getName(), SET_QUANTILE_METHOD_NAME);
|
percentileImpl.getClass().getName(), SET_QUANTILE_METHOD_NAME);
|
||||||
} catch (IllegalAccessException e2) {
|
} catch (IllegalAccessException e2) {
|
||||||
throw MathRuntimeException.createIllegalArgumentException(
|
throw new MathIllegalStateException(
|
||||||
LocalizedFormats.PERCENTILE_IMPLEMENTATION_CANNOT_ACCESS_METHOD,
|
LocalizedFormats.PERCENTILE_IMPLEMENTATION_CANNOT_ACCESS_METHOD,
|
||||||
SET_QUANTILE_METHOD_NAME, percentileImpl.getClass().getName());
|
SET_QUANTILE_METHOD_NAME, percentileImpl.getClass().getName());
|
||||||
} catch (InvocationTargetException e3) {
|
} catch (InvocationTargetException e3) {
|
||||||
throw MathRuntimeException.createIllegalArgumentException(e3.getCause());
|
throw new IllegalStateException(e3.getCause());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return apply(percentileImpl);
|
return apply(percentileImpl);
|
||||||
|
@ -601,15 +601,15 @@ public class DescriptiveStatistics implements StatisticalSummary, Serializable {
|
||||||
new Class[] {Double.TYPE}).invoke(percentileImpl,
|
new Class[] {Double.TYPE}).invoke(percentileImpl,
|
||||||
new Object[] {Double.valueOf(50.0d)});
|
new Object[] {Double.valueOf(50.0d)});
|
||||||
} catch (NoSuchMethodException e1) {
|
} catch (NoSuchMethodException e1) {
|
||||||
throw MathRuntimeException.createIllegalArgumentException(
|
throw new MathIllegalArgumentException(
|
||||||
LocalizedFormats.PERCENTILE_IMPLEMENTATION_UNSUPPORTED_METHOD,
|
LocalizedFormats.PERCENTILE_IMPLEMENTATION_UNSUPPORTED_METHOD,
|
||||||
percentileImpl.getClass().getName(), SET_QUANTILE_METHOD_NAME);
|
percentileImpl.getClass().getName(), SET_QUANTILE_METHOD_NAME);
|
||||||
} catch (IllegalAccessException e2) {
|
} catch (IllegalAccessException e2) {
|
||||||
throw MathRuntimeException.createIllegalArgumentException(
|
throw new MathIllegalArgumentException(
|
||||||
LocalizedFormats.PERCENTILE_IMPLEMENTATION_CANNOT_ACCESS_METHOD,
|
LocalizedFormats.PERCENTILE_IMPLEMENTATION_CANNOT_ACCESS_METHOD,
|
||||||
SET_QUANTILE_METHOD_NAME, percentileImpl.getClass().getName());
|
SET_QUANTILE_METHOD_NAME, percentileImpl.getClass().getName());
|
||||||
} catch (InvocationTargetException e3) {
|
} catch (InvocationTargetException e3) {
|
||||||
throw MathRuntimeException.createIllegalArgumentException(e3.getCause());
|
throw new IllegalArgumentException(e3.getCause());
|
||||||
}
|
}
|
||||||
this.percentileImpl = percentileImpl;
|
this.percentileImpl = percentileImpl;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue