Hello again to all Jess Users,

I am trying to use propertychange listeners in a simple jess application.
But I am getting: "Jess reported an error in routine
DefinstanceList.updateMultipleSlots"

The application examines the Type of an event and prints different message
So the EventRules.clp has the following rules:

(import pack.*)
(deftemplate CurrentEvent(declare (from-class CurrentEvent )))


(defrule check-event-type
(CurrentEvent {reading == "TypeX" } ) => (printout t "Event TypeX" crlf))

(defrule check-event-type
(CurrentEvent {reading == "TypeY" } ) => (printout t "Event TypeY" crlf))



(defrule check-event-type
(CurrentEvent {reading == "TypeZ" } ) => (printout t "Event TypeX" crlf))



I hava a BeanSupport Class like the one of page 230 /Jess In Action Book.
I hava a BeanSimulator which fills some values the class CurrentEvent (My
Bean Class) and the TestJessBean which includes the main and the required
function calls to Java API.

Any ideas please, what I'm doing wrong?

Thanks in advance,


//////////////////////////////////////////////////////////////////////////////////////////////////

package pack;


public class BeanSimulator implements Runnable {

        private String theEventType;

        public BeanSimulator(){

                new Thread (this).start();
        }


        public String getEventType(){

                return theEventType;
        }


        public void run(){

                theEventType = "TypeY";

                while (true){


                try {

                        for (int i=0; i<3; i++){
                                theEventType = "TypeX";
                                Thread.sleep(1000);
                                theEventType = "TypeY";
                                Thread.sleep(1000);
                                theEventType = "TypeZ";
                                Thread.sleep(1000);
                        }



                } catch (InterruptedException e) {

                        e.printStackTrace();
                        return;
                }

                }
        }

}

/////////////////////////////////////////////////////////////////////////////////////////


package pack;

public class CurrentEvent extends BeanSupport implements Runnable{

        private String event_type;
        private String event_type_old;
        private String event_sender;
        private BeanSimulator bs;

        public CurrentEvent(String type, String sender){

                event_type = type;
                event_sender = sender;

        }

        public CurrentEvent(){

        }

        public String getReading(){

                return bs.getEventType();
                //return "TypeY";

        }


        public void run() {
                while (true) {
                        String cur_eventtype = getReading();

m_pcs.firePropertyChange("cur_eventtype",event_type_old,cur_eventtype);
                        event_type_old = cur_eventtype;
                        try { Thread.sleep(1000); }

                        catch (InterruptedException ie) { return; }
                }

        }


}

//////////////////////////////////////////////////////////////////////////////////////////////////


package pack;

import java.io.IOException;

import jess.*;

public class TestJessBean {


        public static void main (String[] args) throws
InterruptedException, IOException {

                JessHandler jesshand; // Makes run-until-halt and handls
rete Objects (Engine)


                CurrentEvent cev = new CurrentEvent();

                try {
                        jesshand = new JessHandler();


                        jesshand.batch("EventRules.clp");
                        BeanSimulator bs = new BeanSimulator();

                        //jesshand.add(cev);

jesshand.defClass("CurrentEvent","CurrentEvent",null);
                        jesshand.defInstance("CurrentEvent",cev, true);


                } catch (JessException e) {

                        e.printStackTrace();
                }

        }

}


-----------------------------------------------------
John Chrysakis
R&D Engineer,
Institute of Computer Science (ICS),
Foundation for Research and Technology-Hellas (FORTH)
Heraklion, Crete, Greece.
-----------------------------------------------------



--------------------------------------------------------------------
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