commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Lloyd-Newberry <>
Subject [PATCH] Commons Collections - Wrapper and Composite Predicates
Date Fri, 14 May 2004 17:38:21 GMT
Commons Collections developers,

   In looking at the 3.1-dev source I see that some implementations of 
the Predicate objects have:
   Predicate getPredicate()
   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 ( 
and 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 S. Lloyd-Newberry
Software Engineer
RBS, Inc

View raw message