commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Colebourne" <scolebou...@btopenworld.com>
Subject Re: [lang] NumberUtils minimum, maximum, and xor
Date Mon, 23 Jun 2003 22:40:32 GMT
NumberUtils is best for this.

Stephen

----- Original Message -----
From: "_matthewHawthorne" <mhawthorne@alumni.pitt.edu>
To: "Jakarta Commons Developers List" <commons-dev@jakarta.apache.org>
Sent: Monday, June 23, 2003 4:25 PM
Subject: RE: [lang] NumberUtils minimum, maximum, and xor


> I have a path and test for xor(boolean[]) that I will submit for
> BooleanUtils.
>
> 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?
>
>
>
>
> On Mon, 2003-06-23 at 02:08, scolebourne@btopenworld.com 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 <ggregory@seagullsw.com>
> > > 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
> >
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message