Repository: commons-math
Updated Branches:
  refs/heads/master 1b53f09c3 -> 777af155a


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.


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/67ef6efb
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/67ef6efb
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/67ef6efb

Branch: refs/heads/master
Commit: 67ef6efb61f3c07e1359e083bbac5d90953cfe43
Parents: 6f27b4a
Author: Hang Park <hangp...@kaist.ac.kr>
Authored: Thu Jun 15 21:17:06 2017 +0900
Committer: Hang Park <hangp...@kaist.ac.kr>
Committed: Thu Jun 15 21:17:06 2017 +0900

----------------------------------------------------------------------
 .../math4/analysis/polynomials/PolynomialSplineFunction.java       | 2 +-
 .../org/apache/commons/math4/exception/util/LocalizedFormats.java  | 2 +-
 .../commons/math4/exception/util/LocalizedFormats_fr.properties    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/67ef6efb/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialSplineFunction.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialSplineFunction.java
 
b/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialSplineFunction.java
index b842a40..d7263c2 100644
--- 
a/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialSplineFunction.java
+++ 
b/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialSplineFunction.java
@@ -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);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/67ef6efb/src/main/java/org/apache/commons/math4/exception/util/LocalizedFormats.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/commons/math4/exception/util/LocalizedFormats.java 
b/src/main/java/org/apache/commons/math4/exception/util/LocalizedFormats.java
index dabe9a7..54b3efb 100644
--- 
a/src/main/java/org/apache/commons/math4/exception/util/LocalizedFormats.java
+++ 
b/src/main/java/org/apache/commons/math4/exception/util/LocalizedFormats.java
@@ -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"),

http://git-wip-us.apache.org/repos/asf/commons-math/blob/67ef6efb/src/main/resources/assets/org/apache/commons/math4/exception/util/LocalizedFormats_fr.properties
----------------------------------------------------------------------
diff --git 
a/src/main/resources/assets/org/apache/commons/math4/exception/util/LocalizedFormats_fr.properties
 
b/src/main/resources/assets/org/apache/commons/math4/exception/util/LocalizedFormats_fr.properties
index 5e0a9f1..b8a89a8 100644
--- 
a/src/main/resources/assets/org/apache/commons/math4/exception/util/LocalizedFormats_fr.properties
+++ 
b/src/main/resources/assets/org/apache/commons/math4/exception/util/LocalizedFormats_fr.properties
@@ -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

Reply via email to