I can also submit a patch for min and max with parameters short[],
int[], long[], float[], and double[].  Would it make sense for this to
go into lang.NumberUtils or a new class in lang.math?


We're considering this in math right now too, I post our opinion to lang after we discuss.


-Mark

_matthewHawthorne wrote:

I have a path and test for xor(boolean[]) that I will submit for
BooleanUtils.






On Mon, 2003-06-23 at 02:08, [EMAIL PROTECTED] wrote:


I disagree. lang.math exists for very simple, common maths operations. Min/max is a good example of this. It should be extended to all primitive types.

A little duplication here is OK. (Note that a year ago I wouldn't have written this, but it makes more sense to me now)

Adding min(int[]) etc is also probably a good idea. It may be best to rename the methods to min and max to be compatable with [math] (deprecating as needed).

On the boolean question, we have a BooleanUtils to add xor() to. Do you have a patch/test available?

Stephen



from:    Gary Gregory <[EMAIL PROTECTED]>
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:[EMAIL PROTECTED] 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?





--
Mark Diggory
Software Developer
Harvard MIT Data Center
http://www.hmdc.harvard.edu



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to