Clarified definition of isSupportXxxBoundInclusive in RealDistribution interface,

made code consistent with the definition, and deprecated these methods, marking
for removal in 4.0.
JIRA: MATH-859


git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1382380 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Phil Steitz 2012-09-08 22:15:32 +00:00
parent 2d2912e4a1
commit 66dece126a
5 changed files with 53 additions and 8 deletions

View File

@ -52,6 +52,11 @@ If the output is not quite correct, check for invisible trailing spaces!
<body> <body>
<release version="3.1" date="TBD" description=" <release version="3.1" date="TBD" description="
"> ">
<action dev="psteitz" type="update" issue="MATH-859">
Clarified definition of isSupportXxxBoundInclusive in RealDistribution
interface, made code consistent with the definition, and deprecated
these methods, marking for removal in 4.0.
</action>
<action dev="erans" type="update" issue="MATH-841" due-to="Sebastien Riou"> <action dev="erans" type="update" issue="MATH-841" due-to="Sebastien Riou">
Performance improvement in computation of the greatest common divisor Performance improvement in computation of the greatest common divisor
(in class "o.a.c.m.util.ArithmeticUtils"). (in class "o.a.c.m.util.ArithmeticUtils").

View File

@ -272,7 +272,7 @@ public class FDistribution extends AbstractRealDistribution {
/** {@inheritDoc} */ /** {@inheritDoc} */
public boolean isSupportLowerBoundInclusive() { public boolean isSupportLowerBoundInclusive() {
return true; return false;
} }
/** {@inheritDoc} */ /** {@inheritDoc} */

View File

@ -137,18 +137,26 @@ public interface RealDistribution {
double getSupportUpperBound(); double getSupportUpperBound();
/** /**
* Use this method to get information about whether the lower bound * Whether or not the lower bound of support is in the domain of the density
* of the support is inclusive or not. * function. Returns true iff {@code getSupporLowerBound()} is finite and
* {@code density(getSupportLowerBound())} returns a non-NaN, non-infinite
* value.
* *
* @return whether the lower bound of the support is inclusive or not * @return true if the lower bound of support is finite and the density
* function returns a non-NaN, non-infinite value there
* @deprecated to be removed in 4.0
*/ */
boolean isSupportLowerBoundInclusive(); boolean isSupportLowerBoundInclusive();
/** /**
* Use this method to get information about whether the upper bound * Whether or not the upper bound of support is in the domain of the density
* of the support is inclusive or not. * function. Returns true iff {@code getSupportUpperBound()} is finite and
* {@code density(getSupportUpperBound())} returns a non-NaN, non-infinite
* value.
* *
* @return whether the upper bound of the support is inclusive or not * @return true if the upper bound of support is finite and the density
* function returns a non-NaN, non-infinite value there
* @deprecated to be removed in 4.0
*/ */
boolean isSupportUpperBoundInclusive(); boolean isSupportUpperBoundInclusive();

View File

@ -181,7 +181,7 @@ public class UniformRealDistribution extends AbstractRealDistribution {
/** {@inheritDoc} */ /** {@inheritDoc} */
public boolean isSupportUpperBoundInclusive() { public boolean isSupportUpperBoundInclusive() {
return false; return true;
} }
/** /**

View File

@ -338,6 +338,38 @@ public abstract class RealDistributionAbstractTest {
integrationTestPoints.get(i)), tol); integrationTestPoints.get(i)), tol);
} }
} }
/**
* Verify that isSupportLowerBoundInclusvie returns true iff the lower bound
* is finite and density is non-NaN, non-infinite there.
*/
@Test
public void testIsSupportLowerBoundInclusive() {
final double lowerBound = distribution.getSupportLowerBound();
double result = Double.NaN;
result = distribution.density(lowerBound);
Assert.assertEquals(
!Double.isInfinite(lowerBound) && !Double.isNaN(result) &&
!Double.isInfinite(result),
distribution.isSupportLowerBoundInclusive());
}
/**
* Verify that isSupportUpperBoundInclusvie returns true iff the upper bound
* is finite and density is non-NaN, non-infinite there.
*/
@Test
public void testIsSupportUpperBoundInclusive() {
final double upperBound = distribution.getSupportUpperBound();
double result = Double.NaN;
result = distribution.density(upperBound);
Assert.assertEquals(
!Double.isInfinite(upperBound) && !Double.isNaN(result) &&
!Double.isInfinite(result),
distribution.isSupportUpperBoundInclusive());
}
//------------------ Getters / Setters for test instance data ----------- //------------------ Getters / Setters for test instance data -----------
/** /**