You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Mark R. Diggory" <md...@latte.harvard.edu> on 2003/06/23 03:18:54 UTC

[math][lang] Array methods: was: Re: [lang] NumberUtils minimum, maximum, and xor

We should make this discussion available in both communities.

There's also a consideration in that java.util.Arrays carries a number 
of static primitive[] methods (just as another parallel) for sorting and 
searching arrays.

We also need to consider that the o.a.c.m.MathUtils/StatUtils do not 
carry these methods for all primitive types at this time. I'm sure 
theres alot of room for discussion in both groups as to the best place 
for such methods and what types to support.

Should primitive[]-->primitive style methods be limited to 
o.a.c.m.s.StatUtils, or could/should they be made available via 
o.a.c.m.u.MathUtils or even o.a.c.l.NumberUtils?

Lastly, its the case that Math often delegates to StrictMath for some 
methods (StictMath being a native Implementation), so there is a 
precident for "hierarchies" in this case as well.

-Mark

Gary Gregory wrote:
> If we want to be consistent, we could deprecate [lang]'s min/max and point
> to [math]. This would parallel nicely with c.lang for java.lang and c.math
> for java.math. It does not seem right to add all primitive types to
> c.lang.NumberUtils if min/max routines are in c.math.
> 
> Gary
> 
> -----Original Message-----
> From: Mark R. Diggory [mailto:mdiggory@latte.harvard.edu] 
> Sent: Saturday, June 21, 2003 15:18
> To: Jakarta Commons Developers List
> Subject: Re: [lang] NumberUtils minimum, maximum, and xor
> 
> Just to note: we have moved somwhat along these lines in the the commons 
> [math] sandbox component. Currently we have o.a.c.m.stat.StatUtils:
> 
> double min(double[] doubleArr)
> double max(double[] doubleArr)
> 
> available there.
> 
> -Mark Diggory
> 
> _matthewHawthorne wrote:
> 
>>I have 2 observations:
>>
>>(1) Currently, the following methods are in o.a.c.l.NumberUtils
>>
>>int maximum(int a, int b, int c)
>>long maximum(long a, long b, long c)
>>int minimum(int a, int b, int c)
>>long minimum(long a, long b, long c)
>>
>>I think it be more flexible to replace them with the following:
>>
>>int minimum(int[] intArr)
>>int maximum(int[] intArr)
>>long minimum(long[] longArr)
>>long maximum(long[] longArr)
>>
>>It also may be a good time to add any missing methods such as:
>>
>>short minimum(short[] shortArr)
>>short maximum(short[] shortArr)
>>float minimum(float[] floatArr)
>>float maximum(float[] floatArr)
>>double minimum(double[] doubleArr)
>>double maximum(double[] doubleArr)
>>
>>Any thoughts?
>>
>>
>>(2) After searching for an easy way to xor booleans, and not finding
>>anything, I created a method:
>>
>>boolean xor(boolean[] boolArr)
>>
>>Would this be a good addition to NumberUtils?
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 


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