Reputation: 2913
I am fairly new to drools and I'm running into some issues I can't really understand. I'm trying to solve an allocation problem and one of my LHS goes like this
$leftAlloc: SlotAllocation($leftRes: resource ) $rightAlloc: SlotAllocation(this != $leftAlloc, resource == $leftRes)
for some reason the second statement does not match anything even thou I'm sure there is a match in the working memory. If I change the code above with the following it works fine
$leftAlloc: SlotAllocation($leftRes: resource ) $rightAlloc: SlotAllocation(this != $leftAlloc, eval(resource == $leftRes))
Can anybody explain this to me?
Thanks!
Upvotes: 1
Views: 537
Reputation: 11
You're probably better off asking this question on the drools user mailing list (use a newsgroup reader to connect to news.gmane.org if you don't want to litter your mailbox).
As for your question: that's really strange. I see only one improbable explanation:
First you should know that resource == $leftRes)
in the DRL will actually call getResource().equals($leftRes)
, so it's not a same/pointer check but an equals check.
On the other hand, eval(resource == $leftRes)
will use a same/pointer check.
So that improbably theory is that your Resource class overwrites the Object.equals
method and doesn't even return true when it's the same instance...
PS: Continue this discussion on the user mailing list if you have further questions and you want those answered too.
Upvotes: 1