You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Sandor Murakozi <sa...@freemail.hu> on 2004/05/19 11:49:23 UTC

Re: [collections] [PATCH] Commons Collections - Wrapper and

Hi Stephen,

I also think a kind marker interface would be nice. If
someone wants to 
travel a tree of predicates (which is needed to display it's
structure, save it, almost anything except building and
simply invoking it) then it would be extremely useful. It
would be also handy if you want to handle different types of
Predicates differently. I think a great part of Predicate
users will need some similar functionality (including me in
my actual project :-)). Now we have to create our reflection
based solution, or huge if else-if statements (brrrrr) , so
I would vote on marker interfaces.

And yes, it would probably open the door, but is it really a
problem? (I use only predicates at this time, so I'm not a
transformer expert, but I can imagine transformer users with
the same problem then me).

BR,
don
 
>Thank you for your patch.

>I'm not certain as to how to procede on this one. There is
nothing wrong
>with your patch or idea. The problem is that it opens the
door to accessing
>other functors such as Transformer and Closure. How far
does this go?

>One idea I have considered is to have a single generic
Decorator interface
>that specifies one method which returns a predicate.

>Another idea is to use reflection, with a single method on
PredicateUtils to
>access this functionality. This might be less intrusive,
but perhaps is also
>less obvious.

>Not sure, any opinions?

>Stephen

>----- Original Message -----
>From: "Brian Lloyd-Newberry" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Friday, May 14, 2004 6:38 PM
>Subject: [PATCH] Commons Collections - Wrapper and
Composite >Predicates


> Commons Collections developers,
>
>    In looking at the 3.1-dev source I see that some
implementations of
> the Predicate objects have:
>    Predicate getPredicate()
>    or
>    Predicate[] getPredicates()
> methods. This is a good thing for me, as I am developing a
search
> interface and would like to be able to use predicates in the
> search/filter process, and be able to do a display of the
predicate
> expression structure.
>
>    I observe that there are basic types of predicates.
Ones which
> operate on Objects, ones that operate on a single
(sub)Predicate and
> ones which operate on more than one Predicate. I propose
that the single
> and multiple cases be tagged using an interface so that
the appropriate
> getPredicate() or getPredicates() method can be found.
>
>    I have attached a patch and 2 new interfaces
(WrapperPredicate.java
> and CompositePredicate.java) which provide the
functionality I propose.
> WrapperPredicate declares Predicate getPredicate().
CompositePredicate
> declares Iterator predicates(), shielding the
CompositePredicate from
> modification (the Iterator returned is Unmodifiable) that the
> Predicate[] getPredicates[] implementation would allow
unless a
> defensive copy was made before the return took place.
>
>    If you have any questions or concerns about my
implementation please
> let me know. This is my first patch on a Jakarta project,
so I hope I
> have  done everything correctly (cvs diff -u).
>
>    Thank you for your work and for providing such a useful
library of
> collections to the community.
>
> -Brian
>
> Brian S. Lloyd-Newberry
> Software Engineer
> RBS, Inc
> http://www.rbs2000.com
>

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


Re: [collections] [PATCH] Commons Collections - Wrapper and

Posted by Stephen Colebourne <sc...@btopenworld.com>.
I added PredicateDecorator marker interface.
Stephen

----- Original Message ----- 
From: "Sandor Murakozi" <sa...@freemail.hu>
To: <co...@jakarta.apache.org>
Sent: Wednesday, May 19, 2004 10:49 AM
Subject: Re: [collections] [PATCH] Commons Collections - Wrapper and 


> Hi Stephen,
> 
> I also think a kind marker interface would be nice. If
> someone wants to 
> travel a tree of predicates (which is needed to display it's
> structure, save it, almost anything except building and
> simply invoking it) then it would be extremely useful. It
> would be also handy if you want to handle different types of
> Predicates differently. I think a great part of Predicate
> users will need some similar functionality (including me in
> my actual project :-)). Now we have to create our reflection
> based solution, or huge if else-if statements (brrrrr) , so
> I would vote on marker interfaces.
> 
> And yes, it would probably open the door, but is it really a
> problem? (I use only predicates at this time, so I'm not a
> transformer expert, but I can imagine transformer users with
> the same problem then me).
> 
> BR,
> don
>  
> >Thank you for your patch.
> 
> >I'm not certain as to how to procede on this one. There is
> nothing wrong
> >with your patch or idea. The problem is that it opens the
> door to accessing
> >other functors such as Transformer and Closure. How far
> does this go?
> 
> >One idea I have considered is to have a single generic
> Decorator interface
> >that specifies one method which returns a predicate.
> 
> >Another idea is to use reflection, with a single method on
> PredicateUtils to
> >access this functionality. This might be less intrusive,
> but perhaps is also
> >less obvious.
> 
> >Not sure, any opinions?
> 
> >Stephen
> 
> >----- Original Message -----
> >From: "Brian Lloyd-Newberry" <[EMAIL PROTECTED]>
> >To: <[EMAIL PROTECTED]>
> >Sent: Friday, May 14, 2004 6:38 PM
> >Subject: [PATCH] Commons Collections - Wrapper and
> Composite >Predicates
> 
> 
> > Commons Collections developers,
> >
> >    In looking at the 3.1-dev source I see that some
> implementations of
> > the Predicate objects have:
> >    Predicate getPredicate()
> >    or
> >    Predicate[] getPredicates()
> > methods. This is a good thing for me, as I am developing a
> search
> > interface and would like to be able to use predicates in the
> > search/filter process, and be able to do a display of the
> predicate
> > expression structure.
> >
> >    I observe that there are basic types of predicates.
> Ones which
> > operate on Objects, ones that operate on a single
> (sub)Predicate and
> > ones which operate on more than one Predicate. I propose
> that the single
> > and multiple cases be tagged using an interface so that
> the appropriate
> > getPredicate() or getPredicates() method can be found.
> >
> >    I have attached a patch and 2 new interfaces
> (WrapperPredicate.java
> > and CompositePredicate.java) which provide the
> functionality I propose.
> > WrapperPredicate declares Predicate getPredicate().
> CompositePredicate
> > declares Iterator predicates(), shielding the
> CompositePredicate from
> > modification (the Iterator returned is Unmodifiable) that the
> > Predicate[] getPredicates[] implementation would allow
> unless a
> > defensive copy was made before the return took place.
> >
> >    If you have any questions or concerns about my
> implementation please
> > let me know. This is my first patch on a Jakarta project,
> so I hope I
> > have  done everything correctly (cvs diff -u).
> >
> >    Thank you for your work and for providing such a useful
> library of
> > collections to the community.
> >
> > -Brian
> >
> > Brian S. Lloyd-Newberry
> > Software Engineer
> > RBS, Inc
> > http://www.rbs2000.com
> >
> 
> ---------------------------------------------------------------------
> 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