Explicit boxing and unboxing

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1504729 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2013-07-18 23:54:52 +00:00
parent dafa441cca
commit aa9293caed
8 changed files with 14 additions and 10 deletions

View File

@ -41,7 +41,7 @@ public class DimensionMismatchException extends MathIllegalNumberException {
public DimensionMismatchException(Localizable specific,
int wrong,
int expected) {
super(specific, wrong, expected);
super(specific, Integer.valueOf(wrong), Integer.valueOf(expected));
dimension = expected;
}

View File

@ -30,6 +30,10 @@ import org.apache.commons.math3.exception.util.Localizable;
public class MathIllegalNumberException extends MathIllegalArgumentException {
/** Serializable version Id. */
private static final long serialVersionUID = -7447085893598031110L;
/** Helper to avoid boxing warnings. @since 3.3 */
protected static final Integer INTEGER_ZERO = Integer.valueOf(0);
/** Requested. */
private final Number argument;

View File

@ -79,13 +79,13 @@ public class MultiDimensionMismatchException extends MathIllegalArgumentExceptio
* @return the wrong dimension stored at {@code index}.
*/
public int getWrongDimension(int index) {
return wrong[index];
return wrong[index].intValue();
}
/**
* @param index Dimension index.
* @return the expected dimension stored at {@code index}.
*/
public int getExpectedDimension(int index) {
return expected[index];
return expected[index].intValue();
}
}

View File

@ -84,7 +84,7 @@ public class NonMonotonicSequenceException extends MathIllegalNumberException {
(strict ?
LocalizedFormats.NOT_STRICTLY_DECREASING_SEQUENCE :
LocalizedFormats.NOT_DECREASING_SEQUENCE),
wrong, previous, index, index - 1);
wrong, previous, Integer.valueOf(index), Integer.valueOf(index - 1));
this.direction = direction;
this.strict = strict;

View File

@ -32,7 +32,7 @@ public class NotANumberException extends MathIllegalNumberException {
* Construct the exception.
*/
public NotANumberException() {
super(LocalizedFormats.NAN_NOT_ALLOWED, Double.NaN);
super(LocalizedFormats.NAN_NOT_ALLOWED, Double.valueOf(Double.NaN));
}
}

View File

@ -34,7 +34,7 @@ public class NotPositiveException extends NumberIsTooSmallException {
* @param value Argument.
*/
public NotPositiveException(Number value) {
super(value, 0, true);
super(value, INTEGER_ZERO, true);
}
/**
* Construct the exception with a specific context.
@ -44,6 +44,6 @@ public class NotPositiveException extends NumberIsTooSmallException {
*/
public NotPositiveException(Localizable specific,
Number value) {
super(specific, value, 0, true);
super(specific, value, INTEGER_ZERO, true);
}
}

View File

@ -35,7 +35,7 @@ public class NotStrictlyPositiveException extends NumberIsTooSmallException {
* @param value Argument.
*/
public NotStrictlyPositiveException(Number value) {
super(value, 0, false);
super(value, INTEGER_ZERO, false);
}
/**
* Construct the exception with a specific context.
@ -45,6 +45,6 @@ public class NotStrictlyPositiveException extends NumberIsTooSmallException {
*/
public NotStrictlyPositiveException(Localizable specific,
Number value) {
super(specific, value, 0, false);
super(specific, value, INTEGER_ZERO, false);
}
}

View File

@ -44,6 +44,6 @@ public class ZeroException extends MathIllegalNumberException {
* @param arguments Arguments.
*/
public ZeroException(Localizable specific, Object ... arguments) {
super(specific, 0, arguments);
super(specific, INTEGER_ZERO, arguments);
}
}