>From the documentation:

public class Pump
  {
    public String getName() { ... }
    public int getFlow() { ... }
    public void setFlow(int f) { ... }
  }

then:
(defrule decrease-pump-flow-if-high-1
    "If a pump's flow rate is over 20, decrease it by 5 units."
    (pump (flow ?f&:(> ?f 20)) (OBJECT ?pump))
    =>
    (set ?pump flow (- ?f 5)))

If we wanted to match on the name slot of Pumpinstead of flow:
(defrule match-by-pump-name
  "Try to find a specific pump"
   (pump (name "MAIN") (OBJECT ?pump))
=>
 (printout t "the main pump " ?pump crlf))

it does not match. I have to write the rule explicity calling equals
on name as such:
(defrule match-by-pump-name
  "Try to find a specific pump"
   (pump (name ?name&:(call ?name equals "MAIN")) (OBJECT ?pump))
=>
 (printout t "the main pump " ?pump crlf))

This gets very messy when I have a slot match such as
(name ~"NONAME"&~"GENERICNAME"&~"FOONAME")

Is there same way we can get JESS to match java.lang.Strings against
string primitives in rules without having to explicitly call the equals
 method?

Thanks,
Lauren
---------------------------------------------------------------------
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