--- On Thu, 2/26/09, David Boaz <[email protected]> wrote:
> My Quantity objects are immutable value objects. just like
> the String literal "abc", or a Date. My rule should behave
> exactly like Person(name == "abc")
You should look into defining a domain specific language, as has been suggested
earlier.
> Can I instruct Drools not to check for changes on that
> objects?
Not if you're getting them using "from". Every time it produces output it is
assumed to be fresh. The way you tell drools "this object will only change
when I tell you it's changed" is to insert it into working memory. That's it.
That's why it is there. I can't say it any plainer.
Look at it this way: say you specified that an object of type A is immutable.
When it returns from "from" you still have to check if you've seen that
particular instance before, and then if you've previously matched it with the
other objects in the rule. Checking if you've seen them before means you have
to maintain a memory of that object type, thus specifying how long you want to
track each instance of that type. It's working memory, just in another form.
> Im sure that Im not the first facing this issue.
Nope. "This issue" is the reason the rete algorithm was invented. :)
I reeeeeeally don't think inserting the Quantity objects into working memory
will be as painful as you think. It can probably be handled behind the scenes
without intervention from the rule writer.
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users