Jess71p2 33 - The working memory still thinks our Account's...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
5. Working Memory 25 Jess> (printout t (?a getBalance) crlf) 0.0 Jess> (modify 0 (balance 1)) <Fact-0> Jess> (facts) f-0 (MAIN::Account (balance 1) (class <Java-Object:java.lang.Class>) (OBJECT <Java-Object:Account>)) For a total of 1 facts in module MAIN. Jess> (printout t (?a getBalance) crlf) 1.0 But what happens if we modify the Account directly? Jess> (printout t (?a getBalance) crlf) 1.0 Jess> (?a setBalance 2) Jess> (printout t (?a getBalance) crlf) 2.0 Jess> (facts) f-0 (MAIN::Account (balance 1) (class <Java-Object:java.lang.Class>) (OBJECT <Java-Object:Account>)) For a total of 1 facts in module MAIN.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: The working memory still thinks our Account's balance is 1.0. There are several ways to notify Jess that the object is changed and working memory needs updating. One is using the update function: Jess> (update ?a) Jess> (facts) f-0 (MAIN::Account (balance 2.0) (class <Java-Object:java.lang.Class>) (OBJECT <Java-Object:Account>)) For a total of 1 facts in module MAIN. update tells Jess to refresh the slot values of the shadow fact linked to the given Java object. The reset function, which resets working memory, updates the slots of all shadow facts in the...
View Full Document

This note was uploaded on 03/02/2010 for the course COMP 102 taught by Professor Smith during the Spring '10 term at California State University , Monterey Bay.

Ask a homework question - tutors are online