[rules-users] Better way to write a constrained collect?

David Sinclair dsinclair at chariotsolutions.com
Wed Dec 17 13:30:18 EST 2008


Great idea Edson, thanks!

On Wed, Dec 17, 2008 at 1:27 PM, Edson Tirelli <tirelli at post.com> wrote:

>
>    The only improvement I can suggest for your rule is to not use collect
> if you are checking for the non-existance of and object (size == 0). "not"
> does the job and is much lighter from a performance perspective:
>
> Cluster($ipAddressCollection : ipAddressCollection != null)
> $ipAddressUsage : IPAddressUsage(guid in
> (IPAddressUsage.CUSTOMER_MANAGEMENT,
>
>
> IPAddressUsage.CUSTOMER_BACKUP,
>
> IPAddressUsage.CUSTOMER_PRODUCTION,
>
> IPAddressUsage.CUSTOMER_HEARTBEAT) )
> not( IPAddress(ipAddressUsage == $ipAddressUsage) from
> $ipAddressCollection.ipAddresses )
>
>
>     []s
>     Edson
>
>
> 2008/12/17 David Sinclair <dsinclair at chariotsolutions.com>
>
>> I have the when part of a rule
>>
>> Cluster($ipAddressCollection : ipAddressCollection != null)
>> $ipAddressUsage : IPAddressUsage(guid in
>> (IPAddressUsage.CUSTOMER_MANAGEMENT,
>>
>> IPAddressUsage.CUSTOMER_BACKUP,
>>
>> IPAddressUsage.CUSTOMER_PRODUCTION,
>>
>> IPAddressUsage.CUSTOMER_HEARTBEAT))
>> java.util.LinkedList(size == 0) from collect( IPAddress(ipAddressUsage ==
>> $ipAddressUsage) from $ipAddressCollection.ipAddresses)
>>
>> This works fine, but I would like to constrain the IPAddress's usage
>> within the collect, as opposed to joining.
>>
>> Anyone know if this is possible?
>>
>> thanks
>>
>> dave
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
>
> --
>  Edson Tirelli
>  JBoss Drools Core Development
>  JBoss, a division of Red Hat @ www.jboss.com
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20081217/8a93f3be/attachment.html 


More information about the rules-users mailing list