I'm trying to read two variables from a Java
class into my .clp
file to compare.
Can anyone please help me with this. Thank you.
I'm trying in this way..
(deftemplate Alarm (declare (from-class Alarm)))
(Alarm (measuredValue ?m) (nominalValue ?n))
(printout t ?m ?n crlf)
You should have an fact of class
Alarm
inserted in working memory. Then a rule like thislets you access the fields of some such
Alarm
object. As to comparing those values: you can do this in the rule, but you didn't write how, so I didn't add anything.Later To use a Java class for creating an object and insert it as a fact:
You can use
(get-member ...)
to access fields in a Java object.See the Jess manual for this (and more) information.