Hi, just before my holiday we moved the osxa.org CVS repository into the ops4j archives.
Some time ago I wrote a new Filter implementation for osxa (that never actually got used, it was still in the testing stage when I had to go and do something else). Interestingly enough, it has an interface very much like Niclas mentioned. You can see my IFilter at https://scm.ops4j.org/repos/ops4j/laboratory/users/harald/trunk/osxaTest-framework/src/org/osxa/test/speed/n/IFilter.java A usage example looks like this: Filter filter = new FilterI( new ItemEquals("A","D") .or(new ItemEquals("A","H")) .or(new ItemEquals("A","E")) .or(new ItemEquals("A","D")) .or(new ItemEquals("A","F")) .or(new ItemEquals("A","G")) .or(new ItemEquals("A","G")) .or(new ItemEquals("A","C")) .or(new ItemEquals("A","C")) ); (There was a wrapper around the IFilter to satisfy the OSGi API, that's what the FilterI is for ...) If I understand my code correctly, all that is missing to turn this into the utility you were looking for is a bunch of toString() implementations. BTW: We used filters heavily in osxa and I optimized one special case in the new filter implementation: (|(a=b)(a=c)(a=d)) is handled by a specialized handler. Also, there is some caching going on. The code is probably not really thread-safe. Harald PS: About that holiday: I am sitting at the pool. http://tinyurl.com/2t9jmj Niclas Hedhman wrote: > On Tuesday 20 March 2007 18:27, Alin Dreghiciu wrote: >> If by fluid programming you mean something less verbose and that can be >> easily concatenated then that's what I meant by a less shorter code. > > I think that would be better. Perhaps; > > Expression e = > FilterBuilder.newInstance().constant(a).or().constant(b); > Filter f = > FilterBuilder.newInstance().constant(c).and().expression(e).create(); _______________________________________________ general mailing list general@lists.ops4j.org http://lists.ops4j.org/mailman/listinfo/general