You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Ramiro Pereira de Magalhães (JIRA)" <ji...@apache.org> on 2012/11/04 14:34:12 UTC

[jira] [Created] (MATH-889) Add a method in Interval that verifies if a double is inside the Interval

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

             Summary: 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 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.

--
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

[jira] [Commented] (MATH-889) Add a method in Interval that verifies if a double is inside the Interval

Posted by "Ramiro Pereira de Magalhães (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-889?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490335#comment-13490335 ] 

Ramiro Pereira de Magalhães commented on MATH-889:
--------------------------------------------------

Luc, your suggestion to reuse the design of the IntervalSet class make a lot of sense to me. The threshold parameter may be convenient to others, but not to my current use cases.
                
> 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

[jira] [Commented] (MATH-889) Add a method in Interval that verifies if a double is inside the Interval

Posted by "Ramiro Pereira de Magalhães (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-889?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490661#comment-13490661 ] 

Ramiro Pereira de Magalhães commented on MATH-889:
--------------------------------------------------

Luc, thank you for your attention to this request.
                
> 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
>             Fix For: 3.1
>
>
> 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

[jira] [Updated] (MATH-889) Add a method in Interval that verifies if a double is inside the Interval

Posted by "Ramiro Pereira de Magalhães (JIRA)" <ji...@apache.org>.
     [ 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

[jira] [Commented] (MATH-889) Add a method in Interval that verifies if a double is inside the Interval

Posted by "Luc Maisonobe (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-889?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490284#comment-13490284 ] 

Luc Maisonobe commented on MATH-889:
------------------------------------

In the same package, there is another class, IntervalsSet, which provides a checkPoint method inherited from its top level interface Region<Space>. The specification for this method is:

{code}
    /** Check a point with respect to the region.
     * @param point point to check
     * @return a code representing the point status: either {@link
     * Location#INSIDE}, {@link Location#OUTSIDE} or {@link Location#BOUNDARY}
     */
    Location checkPoint(final Vector<S> point);
{code}

Wouldn't it be more consistent to use a similar method in Interval, using a simple double as the parameter but returning the same type as the original method, i.e. a Location enum? We could also add a threshold parameter for Location.BOUNDARY.
                
> 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

[jira] [Resolved] (MATH-889) Add a method in Interval that verifies if a double is inside the Interval

Posted by "Luc Maisonobe (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-889?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Luc Maisonobe resolved MATH-889.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 3.1

Fixed in subversion repository as of r1405706.

As I was fixing this, I noticed other methods naming were inconsistent with IntervalsSet (getLower/getInf, getUpper/getSup, getLength/getSize, getMidPoint/getBarycenter). I will open a new JIRA issue to deprecate the Interval specific names and use the IntervalsSet and Region ones for consistency.

Thanks for the report.
                
> 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
>             Fix For: 3.1
>
>
> 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