Re: [collections][patch] ClassFilterIterator

2002-12-16 Thread Emmanuel Bourg
Tom Drake wrote: I've already submitted an OrPredicate and an InstanceOfPredicate The ClassPredicate i proposed is slightly different from the InstanceOfPredicate though, i'm not sure the strict mode can be efficiently expressed by basic predicates. Emmanuel -- To unsubscribe, e-mail:

RE: [collections][patch] ClassFilterIterator

2002-12-13 Thread Tom Drake
I've already submitted an OrPredicate and an InstanceOfPredicate -Original Message- From: Stephen Colebourne [mailto:[EMAIL PROTECTED]] Sent: Friday, December 13, 2002 4:29 AM To: Jakarta Commons Developers List Subject: Re: [collections][patch] ClassFilterIterator I intend to

Re: [collections][patch] ClassFilterIterator

2002-12-13 Thread Stephen Colebourne
I intend to get a resolution on the functors question, as it is clearly holding things up ;-) The approach taken to functors in general is to have lots of small functors. With your example, rather than having one predicate that receives an array of classes to check, I would probably favour one pre

Re: [collections][patch] ClassFilterIterator

2002-12-13 Thread Emmanuel Bourg
This is a modified version of my previous ClassFilterIterator with a little more meat : - it accepts an array of classes to match several classes - the class matching can optionnaly be "strict", that is subclasses of the required class aren't returned. In strict mode a ClassFilterIterator will o

Re: [collections][patch] ClassFilterIterator

2002-12-12 Thread Rodney Waldhoff
Wouldn't it be more generic to expose your (private inner) ClassPredicate as a public Predicate, say InstanceOfPredicate? That way one could easily create ClassFilterIterator, as you have, but could also use the Predicate in the various CollectionUtils methods, etc. Also, I wonder if the ClassPred

Re: [collections][patch] ClassFilterIterator

2002-12-11 Thread Ola Berg
> Actually, I've got one more comment. Not a biggie, but since I'm already > here. :-) The constructor of ClassPredicate interprets a null value as > equivalent to Object.class. It might be a good idea to shy away from > default behaviour, and instead throw a NullPointerException. Or an IllegalArg

Re: [collections][patch] ClassFilterIterator

2002-12-10 Thread Rich Dougherty
> Hi, here is a suggested addition to the collections component. This is a > trivial FilterIterator which only returns objects of a given class. I > attached the class with its associated test case. Hi Emmanuel Thanks for the contribution. If I've got this right, ClassFilterIterator alters the