You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2015/08/17 13:29:27 UTC
[1/2] [math] MATH-1256
Repository: commons-math
Updated Branches:
refs/heads/MATH_3_X 860434148 -> aea9cfb34
MATH-1256
Boundary check.
Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/eb8727f9
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/eb8727f9
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/eb8727f9
Branch: refs/heads/MATH_3_X
Commit: eb8727f9c64f286d44bbcc1d19f96408ea5a385c
Parents: 93cf7f1
Author: Gilles <er...@apache.org>
Authored: Mon Aug 17 13:27:40 2015 +0200
Committer: Gilles <er...@apache.org>
Committed: Mon Aug 17 13:27:40 2015 +0200
----------------------------------------------------------------------
src/changes/changes.xml | 3 +++
.../apache/commons/math3/geometry/euclidean/oned/Interval.java | 6 ++++++
.../commons/math3/geometry/euclidean/oned/IntervalTest.java | 6 ++++++
3 files changed, 15 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-math/blob/eb8727f9/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 858e5b4..124bfce 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -51,6 +51,9 @@ If the output is not quite correct, check for invisible trailing spaces!
</properties>
<body>
<release version="3.6" date="XXXX-XX-XX" description="">
+ <action dev="erans" type="fix" issue="MATH-1256">
+ Boundary check to construct an "Interval" (package "o.a.c.m.geometry.euclidean.oned").
+ </action>
<action dev="erans" type="fix" issue="MATH-1255">
Wrong neighbourhood size in class "KohonenUpdateAction" (package "o.a.c.m.ml.neuralnet.sofm").
</action>
http://git-wip-us.apache.org/repos/asf/commons-math/blob/eb8727f9/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Interval.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Interval.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Interval.java
index 18ebac7..ca15231 100644
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Interval.java
+++ b/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Interval.java
@@ -17,6 +17,8 @@
package org.apache.commons.math3.geometry.euclidean.oned;
import org.apache.commons.math3.geometry.partitioning.Region.Location;
+import org.apache.commons.math3.exception.NumberIsTooSmallException;
+import org.apache.commons.math3.exception.util.LocalizedFormats;
/** This class represents a 1D interval.
@@ -36,6 +38,10 @@ public class Interval {
* @param upper upper bound of the interval
*/
public Interval(final double lower, final double upper) {
+ if (upper < lower) {
+ throw new NumberIsTooSmallException(LocalizedFormats.ENDPOINTS_NOT_AN_INTERVAL,
+ upper, lower, true);
+ }
this.lower = lower;
this.upper = upper;
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/eb8727f9/src/test/java/org/apache/commons/math3/geometry/euclidean/oned/IntervalTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math3/geometry/euclidean/oned/IntervalTest.java b/src/test/java/org/apache/commons/math3/geometry/euclidean/oned/IntervalTest.java
index dd3b461..67a75b4 100644
--- a/src/test/java/org/apache/commons/math3/geometry/euclidean/oned/IntervalTest.java
+++ b/src/test/java/org/apache/commons/math3/geometry/euclidean/oned/IntervalTest.java
@@ -19,6 +19,7 @@ package org.apache.commons.math3.geometry.euclidean.oned;
import org.apache.commons.math3.geometry.partitioning.Region;
import org.apache.commons.math3.util.FastMath;
import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math3.exception.NumberIsTooSmallException;
import org.junit.Assert;
import org.junit.Test;
@@ -71,4 +72,9 @@ public class IntervalTest {
Assert.assertEquals(1.0, interval.getBarycenter(), Precision.EPSILON);
}
+ // MATH-1256
+ @Test(expected=NumberIsTooSmallException.class)
+ public void testStrictOrdering() {
+ new Interval(0, -1);
+ }
}
[2/2] [math] Merge branch 'MATH_3_X' of
https://git-wip-us.apache.org/repos/asf/commons-math into MATH_3_X
Posted by er...@apache.org.
Merge branch 'MATH_3_X' of https://git-wip-us.apache.org/repos/asf/commons-math into MATH_3_X
Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/aea9cfb3
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/aea9cfb3
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/aea9cfb3
Branch: refs/heads/MATH_3_X
Commit: aea9cfb34206aed30455c9cc16dd1415dc4faeb8
Parents: eb8727f 8604341
Author: Gilles <er...@apache.org>
Authored: Mon Aug 17 13:28:56 2015 +0200
Committer: Gilles <er...@apache.org>
Committed: Mon Aug 17 13:28:56 2015 +0200
----------------------------------------------------------------------
src/site/xdoc/userguide/geometry.xml | 102 +++++++++++++++++++++++++++---
src/site/xdoc/userguide/index.xml | 1 +
2 files changed, 94 insertions(+), 9 deletions(-)
----------------------------------------------------------------------