From: wsdngtmp@... (Sascha Doerdelmann) Date: 2004-05-26T19:38:44+09:00 Subject: Re: defining condititions Florian Weber wrote: > my_set.rules = !name("orange") && hasProperty("color") && > (hasProperty("size") || hasProperty("weight")) Apply the composite pattern, see http://c2.com/cgi/wiki?CompositePattern or http://unicoi.kennesaw.edu/~jbamford/csis4650/uml/GoF_Patterns/composite.htm Forget about the addComponent, removeComponent messages. You need a different way to build composite rules. As in the pattern you need an abstract class for all components. Call it AbstractRule and build subclasses for composed rules and concrete rules. Implement messages like "and", "or", etc. in AbstractRule, each of them should return a composed rule. Depending on your implementation of the composed rules you might overwrite these messages in composed rules. Cheers Sascha