I think Larner, Dan wrote:
>
> 4. Ensure you respect typing in your Jess rules. e.g.
>
> In the pumps example, if you add the following 2 properties
> to the Pump class in jess/examples/pumps/Pump.java
>
...
> private Object m_some_object;
> public void setSomeObject(Object an_obj) {
> System.out.println("Pump.setSomeObject(" + an_obj.getClass().getName() + " " +
>an_obj + ") called");
> Object old_object = m_some_object;
> m_some_object = an_obj;
> pcs.firePropertyChange("someObject", old_object,m_some_object);
> }
>
...
> ;; next line raises exception
> (set ?pump someObject ?name)
> (printout t "Raised pumping rate of pump " ?name " to "
> (get ?pump flow) crlf))
>
>
> You will get the exception:
>
> C:\Java\Jess50a3>jview jess.examples.pumps.MainInJava
> WARNING: TANK MAIN IS LOW!
> Pump.setSomeString(java.lang.String MAIN) called
> Rete Exception in routine call while executing defrule raise-rate-if-low.
> Message: No method 'setSomeObject' found or invalid argument types at line 0: (
>run 1 ) .
> at jess/reflect/Call.call (ReflectFunctions.java)
> at jess/reflect/Set.call (ReflectFunctions.java)
...
> because ?name is a Jess string, not a java object.
>
>
Now this is really funny. This is exactly the same bug as I described
earlier today, and jokingly said that although it is obscure, all bugs
can seem obscure. It effects ONLY Strings passed to Object-wanting
methods. You should (and will in the next version) be able to pass any
subclasss of Object to this method and have it work.
Anyway, thanks for the report!
---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
Org. 8920, MS 9214 [EMAIL PROTECTED]
PO Box 969 http://herzberg.ca.sandia.gov
Livermore, CA 94550
---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list. List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------