Hi,
Is there any way to modify only one slot of the definstance. Right now as i
observe it is retracting the object and reasserting it with updated values.
I have the following scenario.
interface AIntf {
public int getId();
public void incrCount();
public void decrCount();
public int getCount();
public int getTotalCount();
}
class A implements AIntf {
int id;
int count;
static final int total_count = 100;
...................
............
}
(defclass A AIntf)
Now i have couple of rules which update the counter and check the percentage
of the count.
defrule R1 (
(A (id ?id) (OBJECT ?obj))
=>
(call ?obj incrCount)
)
defrule R2 (
(A (count ?count) (totalCount ?total_count))
(test (> (/ (* ?count 100) ?total_count) 50))
=>
(printout t "count is more than 50 percent of the total count" crlf)
)
Now whenever rule R1 fires and updates the counter i am firing an event to
indicate there is a change in the count value so rule R2 can get evaluated
again. But at the same time jess is retracting the entire A and reasserting
it with the new count value and rule R1 is getting activated again and
firing. This is going in a cycle.
Since i do not want to patternmatch on the count variable in rule R1 is
there any way i can restrict this? Or is it possible to make jess retract
only that count fact and re assert it instead of the entire object instance?
Any suggestions?
Thanks in advance.
Satish.
---------------------------------------------------------------------
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]
---------------------------------------------------------------------