commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From _matthewHawthorne <mhawtho...@alumni.pitt.edu>
Subject Re: [lang] NumberUtils minimum, maximum, and xor
Date Wed, 25 Jun 2003 00:03:15 GMT
I created a bug report and attached patches for:

ArrayUtils/ArrayUtilsTest

BooleanUtils/BooleanUtilsTest

NumberUtils/NumberUtilsTest

Here is the url:
http://issues.apache.org/bugzilla/show_bug.cgi?id=21068

If these changes are well received, I'll make another quick patch for
primitive/object converters for all primitive array types.




On Tue, 2003-06-24 at 00:59, Stephen Colebourne wrote:
> I agree that both methods should be added, but as they are array
> manipulators I suggest patching ArayUtils. Then we can add other array
> conversions for primitive numbers there too.
> Stephen
> 
> ----- Original Message -----
> From: "_matthewHawthorne" <mhawthorne@alumni.pitt.edu>
> To: <commons-dev@jakarta.apache.org>
> Sent: Tuesday, June 24, 2003 3:44 AM
> Subject: Re: [lang] NumberUtils minimum, maximum, and xor
> 
> 
> > While working on the xor patch, I encountered the need to create the
> > following method:
> >
> > boolean[] toPrimitiveArray(Boolean[])
> >
> > to avoid duplicating logic between handling primitive and object
> > booleans.
> >
> > I made it private.  But would it be a good public addition?  Along with:
> >
> > Boolean[] toObjectArray(boolean[])
> >
> > Any thoughts or suggestions?
> >
> >
> >
> >
> > On Mon, 2003-06-23 at 15:40, Stephen Colebourne wrote:
> > > 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
> >
> 
> 
> ---------------------------------------------------------------------
> 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