MATH-1419: Invalid usage of exception in PolynomialSplineFunction

Fix order of parameter for NumberIsTooSmallException when length of
knots is less than 2 in the constructor of PolynomialSplineFunction to
be fit with the definition of the exception. Moreover, boundedIsAllowed
value is changed to true since 2 is also allowed value.

Change the error message format for this exception appropriately in
English and French.

Since this does not affect any error during using the library, but to
make the code more concrete, following definition strictly is important
things to implement functionalities.
This commit is contained in:
Hang Park 2017-06-15 21:17:06 +09:00
parent 6f27b4ae8f
commit 67ef6efb61
3 changed files with 3 additions and 3 deletions

View File

@ -105,7 +105,7 @@ public class PolynomialSplineFunction implements UnivariateDifferentiableFunctio
}
if (knots.length < 2) {
throw new NumberIsTooSmallException(LocalizedFormats.NOT_ENOUGH_POINTS_IN_SPLINE_PARTITION,
2, knots.length, false);
knots.length, 2, true);
}
if (knots.length - 1 != polynomials.length) {
throw new DimensionMismatchException(polynomials.length, knots.length);

View File

@ -199,7 +199,7 @@ public enum LocalizedFormats implements Localizable {
NOT_DECREASING_NUMBER_OF_POINTS("points {0} and {1} are not decreasing ({2} < {3})"),
NOT_DECREASING_SEQUENCE("points {3} and {2} are not decreasing ({1} < {0})"), /* keep */
NOT_ENOUGH_DATA_FOR_NUMBER_OF_PREDICTORS("not enough data ({0} rows) for this many predictors ({1} predictors)"),
NOT_ENOUGH_POINTS_IN_SPLINE_PARTITION("spline partition must have at least {0} points, got {1}"),
NOT_ENOUGH_POINTS_IN_SPLINE_PARTITION("spline partition must have at least {1} points, got {0}"),
NOT_INCREASING_NUMBER_OF_POINTS("points {0} and {1} are not increasing ({2} > {3})"),
NOT_INCREASING_SEQUENCE("points {3} and {2} are not increasing ({1} > {0})"), /* keep */
NOT_MULTIPLICATION_COMPATIBLE_MATRICES("{0}x{1} and {2}x{3} matrices are not multiplication compatible"),

View File

@ -172,7 +172,7 @@ NOT_CONVEX_HYPERPLANES = les hyperplans ne d\u00e9finissent pas une r\u00e9gion
NOT_DECREASING_NUMBER_OF_POINTS = les points {0} et {1} ne sont pas d\u00e9croissants ({2} < {3})
NOT_DECREASING_SEQUENCE = les points {3} et {2} ne sont pas d\u00e9croissants ({1} < {0})
NOT_ENOUGH_DATA_FOR_NUMBER_OF_PREDICTORS = pas assez de donn\u00e9es ({0} lignes) pour {1} pr\u00e9dicteurs
NOT_ENOUGH_POINTS_IN_SPLINE_PARTITION = une partition spline n\u00e9cessite au moins {0} points, seuls {1} ont \u00e9t\u00e9 fournis
NOT_ENOUGH_POINTS_IN_SPLINE_PARTITION = une partition spline n\u00e9cessite au moins {1} points, seuls {0} ont \u00e9t\u00e9 fournis
NOT_INCREASING_NUMBER_OF_POINTS = les points {0} et {1} ne sont pas croissants ({2} > {3})
NOT_INCREASING_SEQUENCE = les points {3} et {2} ne sont pas croissants ({1} > {0})
NOT_MULTIPLICATION_COMPATIBLE_MATRICES = les dimensions {0}x{1} et {2}x{3} sont incompatibles pour la multiplication matricielle