Greetings, This is going to sound really dumb...
I have a SimpleBean that has two properties property1 and property2. I also have two rules each matching one of the properties. When one of the properties changes, both rules fire even though only one pattern has a reference to the changed property slot. Has Jess always worked this way or has this behavior changed recently? Thanks in advance! alan ******************************** Rules: (clear all) (watch all) (defclass simple SimpleBean) (defrule print-property1 (simple (property1 ?prop)) => (printout t "property1 = " ?prop crlf) ) (defrule print-property2 (simple (property2 ?prop)) => (printout t "property2 = " ?prop crlf) ) (bind ?instance (new SimpleBean)) (definstance simple ?instance) (run) (call ?instance setProperty1 "hello") (run) (call ?instance setProperty2 "world") (run) (call ?instance setProperty2 "123") (run) Sample output: Jess> (batch c:/jess/jess61a3/main.jess) MAIN::print-property1: +1+1+t MAIN::print-property2: =1=1+t ==> f-0 (MAIN::simple (class <External-Address:java.lang.Class>) (property1 nil) (property2 nil) (OBJECT <External-Address:SimpleBean>)) ==> Activation: MAIN::print-property1 : f-0 ==> Activation: MAIN::print-property2 : f-0 FIRE 1 MAIN::print-property1 f-0 property1 = nil FIRE 2 MAIN::print-property2 f-0 property2 = nil <== f-0 (MAIN::simple (class <External-Address:java.lang.Class>) (property1 nil) (property2 nil) (OBJECT <External-Address:SimpleBean>)) ==> f-0 (MAIN::simple (class <External-Address:java.lang.Class>) (property1 "hello") (property2 nil) (OBJECT <External-Address:SimpleBean>)) ==> Activation: MAIN::print-property1 : f-0 ==> Activation: MAIN::print-property2 : f-0 FIRE 1 MAIN::print-property1 f-0 property1 = hello FIRE 2 MAIN::print-property2 f-0 property2 = nil <== f-0 (MAIN::simple (class <External-Address:java.lang.Class>) (property1 "hello") (property2 nil) (OBJECT <External-Address:SimpleBean>)) ==> f-0 (MAIN::simple (class <External-Address:java.lang.Class>) (property1 "hello") (property2 "world") (OBJECT <External-Address:SimpleBean>)) ==> Activation: MAIN::print-property1 : f-0 ==> Activation: MAIN::print-property2 : f-0 FIRE 1 MAIN::print-property1 f-0 property1 = hello FIRE 2 MAIN::print-property2 f-0 property2 = world <== f-0 (MAIN::simple (class <External-Address:java.lang.Class>) (property1 "hello") (property2 "world") (OBJECT <External-Address:SimpleBean>)) ==> f-0 (MAIN::simple (class <External-Address:java.lang.Class>) (property1 "hello") (property2 "123") (OBJECT <External-Address:SimpleBean>)) ==> Activation: MAIN::print-property1 : f-0 ==> Activation: MAIN::print-property2 : f-0 FIRE 1 MAIN::print-property1 f-0 property1 = hello FIRE 2 MAIN::print-property2 f-0 property2 = 123 2 SimpleBean class: /* * SimpleBean.java * * Created on August 13, 2002, 2:52 PM */ import java.beans.*; /** * * @author amoore */ public class SimpleBean extends Object implements java.io.Serializable { private static final String PROP_PROPERTY_1 = "Property1"; private String property1; private static final String PROP_PROPERTY_2 = "Property2"; private String property2; private PropertyChangeSupport propertySupport; /** Creates new SimpleBean */ public SimpleBean () { propertySupport = new PropertyChangeSupport ( this ); } public String getProperty1() { return property1; } public void setProperty1 (String value) { String oldValue = property1; property1 = value; propertySupport.firePropertyChange (PROP_PROPERTY_1, oldValue, property1); } public String getProperty2() { return property2; } public void setProperty2 (String value) { String oldValue = property2; property2 = value; propertySupport.firePropertyChange (PROP_PROPERTY_2, oldValue, property2); } public void addPropertyChangeListener (PropertyChangeListener listener) { propertySupport.addPropertyChangeListener (listener); } public void removePropertyChangeListener (PropertyChangeListener listener) { propertySupport.removePropertyChangeListener (listener); } } -------------------------------------------------------------------- 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] --------------------------------------------------------------------