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

Edson Tirelli tirelli at post.com
Wed Dec 17 13:27:34 EST 2008


   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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20081217/c472b532/attachment.html 


More information about the rules-users mailing list