I think that Camillo wrote:
>>How I use "eq" to compare generic objects?

Well, first off a bit of listserv etiquette... let's not do an end-run
around Ernest here.  So if you have a question personally for me, then send
it to me at my address below.  But every day that Ernest has to answer FAQs
is one day that I don't get to play with Charlemagne (Jess 7.0), so whatever
I can do (humbly) to help I will.  :-D

Seriously, this is more of a Java question.  Let me quote now from the Jess
function link for "eq"
http://herzberg.ca.sandia.gov/jess/docs/61/function_index.html

"...Uses the Java Object.equals() function, so can be redefined for external
types. "

There's your answer.  You have to roll your own.

When you write Java classes that will be compared at some point, it is
standard practice to override the equals() method to suit your need.  Again,
quoting from "Practical Java" by Peter Haggar, "...An equals method should
be provided by a class if equality of an object of that class requires more
than a comparison of its object reference."

Hope that helps.
Cheers,

-Jason
------------------------

Jason Morris
Morris Technical Solutions
[EMAIL PROTECTED]
www.morristechnicalsolutions.com
fax/phone: 503.692.1088



> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Behalf Of Camillo
> Sent: Tuesday, August 03, 2004 8:06 AM
> To: [EMAIL PROTECTED]
> Subject: R: JESS: new to jess
>
>
> Hi Jason,
> I'm also a new to using jess and I have a trouble... You say to use "eq"
> to compare objects,symbols and references. I have this problem:
>
> (defrule myRule (myPattern (mySlot slotValue))=>...)
>
> where slotValue isn't a primitive type but a generic java object bounded
> to jess variable
>
> How I use "eq" to compare generic objects?
>
> I have used this:
>
> (defrule myRule (myPattern (myslot ?slotValue&:(eq (call ?slotValue
> getValue) myPrimitiveValue)))=>...)
>
> but don't works and I think is incorrect however. Can you help me?
> Thanks
>
> Camillo
>
> --------------------------------------------------------------------
> 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]
> --------------------------------------------------------------------
>

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