Hello,
I want to create a Java simulation program that is using Jess.
The simulation has i = [1..n] steps. I have in mind the following
pseudo-code:
The program defines some rules, fact templates, and asserts shadow facts.
The program excecutes the engine until halt.
For each step i the program does these operations:
(1) It asserts a fact that contains the current step value (i). This
assertion fires a sequence of rules that are modifying the shadow facts.
(2) Once there is no more activation, it updates the gui by reading some
shadow facts properties values.
(3) Then it retracts the fact with the current step value (i), it increments
i (i++) and it resumes the first operation (1).
Because the gui can change quickly (2), I am thinking to use a
javax.swing.Timer, to allow the user to see what is happening. So the timer
will control the simulation pace. For example, the user could assign a
simulation pace of 5 seconds between each step (i).
The fact that contains the current step value (i) would be asserted in the
timer's event listener. However, before to assert it, all the rules
activated during the previous step (i -1) must have been fired. How can I do
that? Should I check if there is no element in activationLists(), before
asserting the new step value?
I have found in JIA a small example with gui (chapter 13), but I am still
wondering if I can use it.
Any hint that can help me to solve my problem would be appreciated.
Thanks in advance.
--------------------------------------------------------------------
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]
--------------------------------------------------------------------