commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Yandell (JIRA)" <j...@apache.org>
Subject [jira] Commented: (LANG-386) LeftOf/RightOfNumber in Range convenience methods necessary
Date Sun, 06 Jan 2008 00:29:34 GMT

    [ https://issues.apache.org/jira/browse/LANG-386?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12556308#action_12556308
] 

Henri Yandell commented on LANG-386:
------------------------------------

Sounds interesting. Naming feels a little tricky; in the above you've got your results back
to front (for my reading of the name). ie:

false = range.leftOfInteger(-5);
true = range.leftOfInteger(5);

ie) Range is left of Integer. 

Also possibly should use lessThan/greaterThan semantics rather than left/right.

The 3 static int field and positionOfInteger suggests the style of Comparable interface. 

As long as we maintain the existing API, I'm all for adding methods to define greater/lesser
and a compareTo style method. Patches welcome :)

> LeftOf/RightOfNumber in Range convenience methods necessary
> -----------------------------------------------------------
>
>                 Key: LANG-386
>                 URL: https://issues.apache.org/jira/browse/LANG-386
>             Project: Commons Lang
>          Issue Type: New Feature
>    Affects Versions: 2.3
>            Reporter: Michael
>
> I've using Ranges recently and found then insufficent in methods.
> I cand check if my numbers is in the Range or not but I cant check on which side of the
Range it is.
> This is my idea:
> Range range = new Range(0,5);
> boolean outsided = range.leftOfInteger(-5);
> outsided equals true
> boolean outsided = range.leftOfInteger(5);
> outsided equals tfase
> same applies for rightOf
> another convenience method would be:
> create 3 final static int field:
> Range.LEFT_OF = -1;
> Range.INSIDE = 0;
> Range.RIGHT_OF = 1;
> range.positionOfInteger(-2)  returns LEFT_OF
> and so forth
> it is some refactoring of contains and the upper methods.
> it would increase functionality

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message