commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles <gil...@harfang.homelinux.org>
Subject Re: [commons-lang3] NumberUtils feature
Date Fri, 29 Dec 2017 21:46:13 GMT
On Fri, 29 Dec 2017 16:19:05 -0200, Lucas Carvalho wrote:
> Gilles, thanks for you reply.
>
> I will consider your sugestions.
>
> So, can i open a issue in jira (apache commons) and implement this 
> feature?

Better wait for other opinions on the various suggestions,
as it impacts on which JIRA project you'd open the issue.

Regards,
Gilles

>
> Thanks.
>
> Lucas Carvalho
>
>
>
> On Fri, Dec 29, 2017 at 12:25 PM, Gilles 
> <gilles@harfang.homelinux.org>
> wrote:
>
>> Hi.
>>
>> On Fri, 29 Dec 2017 11:53:29 -0200, Lucas Carvalho wrote:
>>
>>> I`m sorry,
>>>
>>> Now code in "text":
>>>
>>> public static boolean between(final int value, final int x, final 
>>> int y) {
>>>
>>>    return value >= x && value <= y;
>>>
>>> }
>>>
>>>
>>> public static boolean between(final short value, final short x, 
>>> final
>>> short
>>> y) {
>>>
>>>    return value >= x && value <= y;
>>>
>>> }
>>>
>>
>> To comply with the Java convention, it should probably be 
>> "isBetween".
>>
>> Incidently, this also shows a weakness of "Utils" classes: the 
>> "target"
>> (which would normally be "this") is on the same footing as the other
>> arguments (the bounds of the interval here).
>>
>> Also the naming does not reflect whether bounds are included or not:
>> usually, one would assume that the left bound is included (>=) but 
>> not
>> the right one (<).
>>
>> Then, what about "between(15, 20, 10)"?
>>
>> Finally, we should consider whether to continue bloating 
>> "NumberUtils"
>> in "Lang" or move some of it to the new "Numbers" component.[1]
>>
>> Regards,
>> Gilles
>>
>> [1] 
>> https://git1-us-west.apache.org/repos/asf?p=commons-numbers.git;a=tree
>>
>>
>>>
>>>
>>> Obrigado.
>>>
>>> Atenciosamente
>>>
>>> Lucas Carvalho
>>>
>>> *Fone *- 34 9 9903 4621
>>>
>>> On Fri, Dec 29, 2017 at 11:47 AM, Gilles 
>>> <gilles@harfang.homelinux.org>
>>> wrote:
>>>
>>> Hi.
>>>>
>>>> On Fri, 29 Dec 2017 09:51:59 -0200, Lucas Carvalho wrote:
>>>>
>>>> Hello everybody,
>>>>>
>>>>> I want know if the feature "between" in NumberUtils lib has be
>>>>> discussed?
>>>>> I
>>>>> use this methods a lot and i would like to share this code in 
>>>>> apache
>>>>> commons.
>>>>>
>>>>> Below i share a example:
>>>>>
>>>>> [image: Inline image 1]
>>>>>
>>>>>
>>>> All I can see is the above.
>>>> [Perhaps the image was stripped.]
>>>>
>>>> I assume it is code; so, please write it here as "text".
>>>>
>>>> Thanks,
>>>> Gilles
>>>>
>>>>
>>>> Thanks.
>>>>>
>>>>> Lucas Carvalho


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message