commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ramiro Pereira de Magalhães (JIRA) <j...@apache.org>
Subject [jira] [Updated] (MATH-889) Add a method in Interval that verifies if a double is inside the Interval
Date Sun, 04 Nov 2012 13:44:12 GMT

     [ https://issues.apache.org/jira/browse/MATH-889?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Ramiro Pereira de Magalhães updated MATH-889:
---------------------------------------------

    Description: 
It would be convenient if class org.apache.commons.math3.geometry.euclidean.oned.Interval
had a method such as the one below.

{code}
Here is the method code that may be added to the class.
    /** Verifies if x is inside this Interval.
     * @return true if x is a value between this Interval lower and upper
     * bounds, false otherwise
     */
    public boolean contains(double x) {
        return upper >= x && lower <= x;
    }
{code}

Notice that I'm assuming that an Interval includes its endpoints which may not be true in
certain applications. This may imply the need to improve the Interval class (by adding methods
or internal state) that describe the inclusion or exclusion of endpoints.

  was:
It would be convenient if class org.apache.commons.math3.geometry.euclidean.oned.Interval
had a method such as the one below.

{code}
Here is the method code that may be added to the class.
    /** Verifies if x is inside this Interval.
     * @return true if x is a value between this Interval lower and upper
     * bounds, false otherwise
     */
    public double contains(double x) {
        return upper >= x && lower <= x;
    }
{code}

Notice that I'm assuming that an Interval includes its endpoints which may not be true in
certain applications. This may imply the need to improve the Interval class (by adding methods
or internal state) that describe the inclusion or exclusion of endpoints.

    
> Add a method in Interval that verifies if a double is inside the Interval
> -------------------------------------------------------------------------
>
>                 Key: MATH-889
>                 URL: https://issues.apache.org/jira/browse/MATH-889
>             Project: Commons Math
>          Issue Type: Improvement
>    Affects Versions: 3.0
>            Reporter: Ramiro Pereira de Magalhães
>            Priority: Minor
>
> It would be convenient if class org.apache.commons.math3.geometry.euclidean.oned.Interval
had a method such as the one below.
> {code}
> Here is the method code that may be added to the class.
>     /** Verifies if x is inside this Interval.
>      * @return true if x is a value between this Interval lower and upper
>      * bounds, false otherwise
>      */
>     public boolean contains(double x) {
>         return upper >= x && lower <= x;
>     }
> {code}
> Notice that I'm assuming that an Interval includes its endpoints which may not be true
in certain applications. This may imply the need to improve the Interval class (by adding
methods or internal state) that describe the inclusion or exclusion of endpoints.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message