[EMAIL PROTECTED] wrote:
I think Graia, Hakim wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]

Hi
I have problem with retracting facts I used retract and undefinstance but the fact is till there
...
It's possible that your problem is related to problems with your
objects's hashCode() and/or equals() method. If the hashCode of the
object changes unexpectedly -- i.e., while it's installed in working
memory as a definstance, without associated change events -- Jess's
internal data structures can become corrupted. Furthermore, if your
Bean class's equals and hashCode methods are not defined consistently
-- i.e., you've overridden one, but not the other, so that their basic
contract is violated -- again, Jess can become confused. Earlier
versions of Jess were more prone to this than current ones.
Hakim and I are working together on this. The scenario is:
- We create a Java object.
- We definstance a static shadow fact for it.
- We munge the Java object's properties.
- We retract the shadow fact.
- We definstance a new static shadow fact.

Bear with us on retract-and-re-definstance. For various reasons, we can't use dynamic shadow facts, so we retract and re-assert when necessary. This led us to our problem.

Mr. Fried's "hashCode() and/or equals()" is a good clue. When we munge our Java object, though, we don't change its hashCode. The hashCode is really a serial number that's set at constructor time; changing the object's properties doesn't change the serial number. The object's equals() implementation is basically "return hashCode1 == hashCode2", so the two versions of the object are equals(). It looked like the clue led to a dead end.

But we followed it anyway. We changed our code to *retract* the shadow fact *before* we *munge* the Java object's properties. Now the retract works fine, so we're happy.

We're still confused about why our *munging* the Java object *before* *retracting* it makes it unretractable. We've solved our problem, though, and we have to move on, so we're going to try to be happy without fully understanding why our first pass didn't work.

--
Richard Kasperowski
Tel: 617-576-1552, Fax: 617-576-2441
mailto:[EMAIL PROTECTED]
http://www.altisimo.com/

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to