Uploaded image for project: 'Commons Math'
  1. Commons Math
  2. MATH-889

Add a method in Interval that verifies if a double is inside the Interval

Rank to TopRank to BottomVotersWatch issueWatchersConvert to sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0
    • Fix Version/s: 3.1
    • Labels:
      None

      Description

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

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

      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.

        Attachments

          Activity

          $i18n.getText('security.level.explanation', $currentSelection) Viewable by All Users
          Cancel

            People

            • Assignee:
              Unassigned
              Reporter:
              ramiromagalhaes Ramiro Pereira de Magalhães

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment