So as not to confuse everybody - it seems that the 5.1 textual version of a dsl now looks like this:<br><br>[condition][]There is an element {eVar}={eVar} : Element()<br>[condition][]- called {nVar}={nVar} : name<br>[condition][]- other than {oVar}=this != {oVar}<br>
[condition][]- where {eVar} is disjoint from {oVar}=eval( {eVar}.disjointWith( {oVar} ) )<br>[condition][]- where {eVar} intersects with {oVar}=eval( ! {eVar}.disjointWith( {oVar} ) )<br>[consequence][]show disjoint {n1Var} and {n2Var}=System.out.println( {n1Var} + " and " + {n2Var} + " are disjoint.");<br>
[consequence][]show intersecting {n1Var} and {n2Var}=System.out.println( {n1Var} + " and " + {n2Var} + " intersect.");<br><br>(The documentation is not up-to-date, is it?)<br><br>-W<br><br><br>On 26 August 2010 16:15, Wolfgang Laun <span dir="ltr"><<a href="mailto:wolfgang.laun@gmail.com">wolfgang.laun@gmail.com</a>></span> wrote:<br>
<div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">It is possible to hide the eval for computing the intersection in a DSL.<br>
<br>
Given<br>
<br>
public class Element {<br>
private String name;<br>
private Set<Integer> numbers;<br>
public Element( String name, Integer... numbers ){ ... }<br>
// getters...<br>
public boolean disjointWith( Element other ){<br>
Set<Integer> ownNumbers = new HashSet<Integer>( this.numbers );<br>
ownNumbers.retainAll( other.getNumbers() );<br>
return ownNumbers.isEmpty();<br>
}<br>
}<br>
<br>
and the dsl<br>
<br>
[when]There is an element {eVar}={eVar} : Element()<br>
[when]- called {nVar}={nVar} : name<br>
[when]- other than {oVar}=this != {oVar}<br>
[when]- where {eVar} is disjoint from {oVar}=eval(<br>
{eVar}.disjointWith( {oVar} ) )<br>
[when]- where {eVar} intersects with {oVar}=eval( !<br>
{eVar}.disjointWith( {oVar} ) )<br>
[then]show disjoint {n1Var} and {n2Var}=System.out.println( {n1Var} +<br>
" and " + {n2Var} + " are disjoint.");<br>
[then]show intersecting {n1Var} and {n2Var}=System.out.println(<br>
{n1Var} + " and " + {n2Var} + " intersect.");<br>
<br>
you can write the drsl<br>
<br>
package appl.domain<br>
expander elements.dsl<br>
<br>
rule "find disjoint pairs"<br>
when<br>
There is an element e1<br>
- called n1<br>
There is an element e2<br>
- called n2<br>
- other than e1<br>
- where e1 is disjoint from e2<br>
then<br>
show disjoint n1 and n2<br>
end<br>
<div class="im"><br>
On 25 August 2010 16:55, mechlife <<a href="mailto:gaiamech@gmail.com">gaiamech@gmail.com</a>> wrote:<br>
><br>
</div><div><div></div><div class="h5">> Thanks for your response.<br>
><br>
> I need to use it like 1-4 times depending on what the legacy rules are setup<br>
> on one rule but i do have thousands of rules.<br>
> Also, a future state might be to get these imported into a tool for business<br>
> users to start writing these and would definitely be more pleasing if they<br>
> had an operator that they could use.<br>
> Would you be able to point me to some resources on how to do the custom<br>
> operator<br>
> if the need arise.<br>
><br>
> thanks again for your time.<br>
> --<br>
> View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/comparing-an-intersection-of-sets-tp1313555p1332184.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/comparing-an-intersection-of-sets-tp1313555p1332184.html</a><br>
> Sent from the Drools - User mailing list archive at Nabble.com.<br>
> _______________________________________________<br>
> rules-users mailing list<br>
> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
><br>
</div></div></blockquote></div><br>