Java String objects are immutable, of course, so you can't change the existing one; you'd want to remove the existing one and replace it with a new one, something like

(defrule rule
  ?s <- (String)
  =>
  (retract ?s)
  (add (new String "test")))



On Feb 13, 2007, at 2:18 AM, [EMAIL PROTECTED] wrote:

Hello,

I'm new to Jess and i have a problem which is probably easy to solve but i dont know how. I'm using JSR94 StateLessRuleSession to execute my RuleSets written in Jess and as input parameter i have a simple java.lang.String. Now I want to change this String within the RuleSet and get back the changed String in my Java class. For example:

(defclass String java.lang.String)

(defrule MAIN::nextString "nextString"
(String (OBJECT ?i))
=>
(printout t "String " (?i toString) crlf)
???? how to change the string -> for example: String = "test" ????
)

Hope anyone can help me.

Thanks
Mathias


---------------------------------------------------------
Ernest Friedman-Hill
Advanced Software Research          Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 [EMAIL PROTECTED]
Livermore, CA 94550                 http://www.jessrules.com





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