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:
parent
dafa441cca
commit
aa9293caed
|
@ -41,7 +41,7 @@ public class DimensionMismatchException extends MathIllegalNumberException {
|
||||||
public DimensionMismatchException(Localizable specific,
|
public DimensionMismatchException(Localizable specific,
|
||||||
int wrong,
|
int wrong,
|
||||||
int expected) {
|
int expected) {
|
||||||
super(specific, wrong, expected);
|
super(specific, Integer.valueOf(wrong), Integer.valueOf(expected));
|
||||||
dimension = expected;
|
dimension = expected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,10 @@ import org.apache.commons.math3.exception.util.Localizable;
|
||||||
public class MathIllegalNumberException extends MathIllegalArgumentException {
|
public class MathIllegalNumberException extends MathIllegalArgumentException {
|
||||||
/** Serializable version Id. */
|
/** Serializable version Id. */
|
||||||
private static final long serialVersionUID = -7447085893598031110L;
|
private static final long serialVersionUID = -7447085893598031110L;
|
||||||
|
|
||||||
|
/** Helper to avoid boxing warnings. @since 3.3 */
|
||||||
|
protected static final Integer INTEGER_ZERO = Integer.valueOf(0);
|
||||||
|
|
||||||
/** Requested. */
|
/** Requested. */
|
||||||
private final Number argument;
|
private final Number argument;
|
||||||
|
|
||||||
|
|
|
@ -79,13 +79,13 @@ public class MultiDimensionMismatchException extends MathIllegalArgumentExceptio
|
||||||
* @return the wrong dimension stored at {@code index}.
|
* @return the wrong dimension stored at {@code index}.
|
||||||
*/
|
*/
|
||||||
public int getWrongDimension(int index) {
|
public int getWrongDimension(int index) {
|
||||||
return wrong[index];
|
return wrong[index].intValue();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param index Dimension index.
|
* @param index Dimension index.
|
||||||
* @return the expected dimension stored at {@code index}.
|
* @return the expected dimension stored at {@code index}.
|
||||||
*/
|
*/
|
||||||
public int getExpectedDimension(int index) {
|
public int getExpectedDimension(int index) {
|
||||||
return expected[index];
|
return expected[index].intValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class NonMonotonicSequenceException extends MathIllegalNumberException {
|
||||||
(strict ?
|
(strict ?
|
||||||
LocalizedFormats.NOT_STRICTLY_DECREASING_SEQUENCE :
|
LocalizedFormats.NOT_STRICTLY_DECREASING_SEQUENCE :
|
||||||
LocalizedFormats.NOT_DECREASING_SEQUENCE),
|
LocalizedFormats.NOT_DECREASING_SEQUENCE),
|
||||||
wrong, previous, index, index - 1);
|
wrong, previous, Integer.valueOf(index), Integer.valueOf(index - 1));
|
||||||
|
|
||||||
this.direction = direction;
|
this.direction = direction;
|
||||||
this.strict = strict;
|
this.strict = strict;
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class NotANumberException extends MathIllegalNumberException {
|
||||||
* Construct the exception.
|
* Construct the exception.
|
||||||
*/
|
*/
|
||||||
public NotANumberException() {
|
public NotANumberException() {
|
||||||
super(LocalizedFormats.NAN_NOT_ALLOWED, Double.NaN);
|
super(LocalizedFormats.NAN_NOT_ALLOWED, Double.valueOf(Double.NaN));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class NotPositiveException extends NumberIsTooSmallException {
|
||||||
* @param value Argument.
|
* @param value Argument.
|
||||||
*/
|
*/
|
||||||
public NotPositiveException(Number value) {
|
public NotPositiveException(Number value) {
|
||||||
super(value, 0, true);
|
super(value, INTEGER_ZERO, true);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Construct the exception with a specific context.
|
* Construct the exception with a specific context.
|
||||||
|
@ -44,6 +44,6 @@ public class NotPositiveException extends NumberIsTooSmallException {
|
||||||
*/
|
*/
|
||||||
public NotPositiveException(Localizable specific,
|
public NotPositiveException(Localizable specific,
|
||||||
Number value) {
|
Number value) {
|
||||||
super(specific, value, 0, true);
|
super(specific, value, INTEGER_ZERO, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class NotStrictlyPositiveException extends NumberIsTooSmallException {
|
||||||
* @param value Argument.
|
* @param value Argument.
|
||||||
*/
|
*/
|
||||||
public NotStrictlyPositiveException(Number value) {
|
public NotStrictlyPositiveException(Number value) {
|
||||||
super(value, 0, false);
|
super(value, INTEGER_ZERO, false);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Construct the exception with a specific context.
|
* Construct the exception with a specific context.
|
||||||
|
@ -45,6 +45,6 @@ public class NotStrictlyPositiveException extends NumberIsTooSmallException {
|
||||||
*/
|
*/
|
||||||
public NotStrictlyPositiveException(Localizable specific,
|
public NotStrictlyPositiveException(Localizable specific,
|
||||||
Number value) {
|
Number value) {
|
||||||
super(specific, value, 0, false);
|
super(specific, value, INTEGER_ZERO, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,6 @@ public class ZeroException extends MathIllegalNumberException {
|
||||||
* @param arguments Arguments.
|
* @param arguments Arguments.
|
||||||
*/
|
*/
|
||||||
public ZeroException(Localizable specific, Object ... arguments) {
|
public ZeroException(Localizable specific, Object ... arguments) {
|
||||||
super(specific, 0, arguments);
|
super(specific, INTEGER_ZERO, arguments);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue