Jess71p2 31 - As mentioned previously shadow facts are just...

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

View Full Document Right Arrow Icon
5. Working Memory 23 As mentioned previously, shadow facts are just unordered facts that serve as "bridges" to Java objects. By using shadow facts, you can put any Java object into Jess's working memory. 5.3.1. Templates for shadow facts Like all other facts, shadow facts need to have a template, In this case, though, rather than specifying the slots ourselves, we want to let Jess create the template automatically by looking at a Java class. For example, we might be writing a banking program. Our imaginary Java code works with Account objects, like this: import java.io.Serializable; public class Account implements Serializable { private float balance; public float getBalance() { return balance; } public void setBalance(float balance) { this.balance = balance; } // Other, more interesting methods } At some point the rule-based part of our program needs to deal with these too. Therefore we'll need a template like this: Jess> (deftemplate Account (declare (from-class Account)))
Background image of page 1
This is the end of the preview. Sign up to access the rest of the 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