Re: [macker-user] detect class that implements 2 interfaces
Brought to you by:
barredijkstra,
melquiades
From: Etienne S. <eti...@ca...> - 2005-10-19 16:23:54
|
Hi Paul Thanks! How can I transform this into a rule that says 'Don't implement interface Alpha AND interface Beta at the same time'. Basically, every class may implement interface Alpha or interface Beta, but no class must implement interface Alpha AND interface Beta at the same time. I want to detect such "violations". I'm sorry that I don't manage to come up with the complete access-rule myself... Maybe Paul knows howto... --Etienne Paul Cantrell wrote: > Oops! I realize I forgot to post my reply to Etienne to the list! Sorry. > > Just use nested includes: > > <include filter="subtype-of" class="Alpha"> > <include filter="subtype-of" class="Beta" /> > </include> > > Read the docs -- nested includes make a boolean AND: > > http://innig.net/macker/guide/pattern.html#nesting > > Michael -- I'm not sure your approach below actually works. Perhaps you > meant that last pattern to read as follows: > > <pattern name="classes-implementing-Alpha-and-Beta"> > <include filter="subtype-of" class="Alpha" /> > <include filter="subtype-of" class="Beta" /> > <exclude pattern="classes-implementing-only-Alpha" /> > <exclude pattern="classes-implementing-only-Beta" /> > </pattern> > > Regardless, nesting is a *far* simpler way to do this. > > Cheers, > > Paul > > > On Oct 19, 2005, at 9:34 AM, Michael Sassin wrote: > >> Hi >> >> I found a solution for this a while back that is clunky but will >> work. Underlying the idea is that if you have tow sets A and B and >> want to now the set of A AND B you can write this also as >> >> A AND B = (A+B) - ( (A - B) + (B-A) >> >> The operations "-" and "+" relate to exclude and include operations >> in Macker. So, as a result you can express your problem as >> >> <pattern name="classes-implementing-only-Alpha"> >> <include filter="subtype-of" class="Alpha" /> >> <exclude filter="subtype-of" class="Beta" /> >> </pattern> >> >> <pattern name="classes-implementing-only-Beta"> >> <include filter="subtype-of" class="Beta" /> >> <exclude filter="subtype-of" class="Alpha" /> >> </pattern> >> >> <pattern name="classes-implementing-only-Beta"> >> <include filter="subtype-of" class="Alpha" /> >> <include filter="subtype-of" class="Beta" /> >> <include pattern="classes-implementing-only-Alpha" /> >> <include pattern="classes-implementing-only-Beta" /> >> </pattern> >> >> Michael > > > On Oct 18, 2005, at 10:12 PM, Etienne Studer wrote: > >> Hi >> >> What kind of macker rule do I have to write to detect all classes >> that implement interface Alpha AND interface Beta. >> >> For example, >> >> class X implements Alpha, Beta { >> ... >> } >> >> Thanks for any help. >> >> --Etienne >> >> P.S. Btw, macker is awesome and we couldn't be without it anymore! > > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: > Power Architecture Resource Center: Free content, downloads, discussions, > and more. http://solutions.newsforge.com/ibmarch.tmpl > _______________________________________________ > Macker-user mailing list > Mac...@li... > https://lists.sourceforge.net/lists/listinfo/macker-user > > Macker home page: http://innig.net/macker/ > |