I was curious about the reasoning for the LIFO behavior. Thanks.
On 5/5/06, Mark Proctor <[EMAIL PROTECTED]> wrote:
or in other words Activations with newer data take priority over
activations with older data.
Mark Proctor wrote:
> That is correct LIFO behaviour - last in first out.
> Ray Krueger wrote:
>> The agenda, when calling getNextFocus, calls getLast(). Which causes
>> the consequences to be executed in reverse order. Is there a reason
>> for that?
>>
>> For example, the following example....
>>
>> public static void main(String[] args) throws Exception {
>>
>> StringBuffer rules = new StringBuffer();
>> rules.append("package example;\n")
>> .append("import java.lang.Integer;\n")
>> .append("rule \"Count\"\n")
>> .append("when\n")
>> .append("i : Integer()\n")
>> .append("then\n")
>> .append("System.out.println(i);\n")
>> .append("end\n");
>>
>> System.out.println(rules);
>>
>>
>> final PackageBuilder builder = new PackageBuilder();
>> builder.addPackageFromDrl(new StringReader(rules.toString()));
>>
>> final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
>> ruleBase.addPackage(builder.getPackage());
>>
>> final WorkingMemory workingMemory = ruleBase.newWorkingMemory();
>>
>> for (int i = 0; i < 10; i++) {
>> workingMemory.assertObject(new Integer(i));
>> }
>>
>> workingMemory.fireAllRules();
>> }
>>
>>
>> Will print out...
>> 9
>> 8
>> 7
>> 6
>> 5
>> 4
>> 3
>> 2
>> 1
>> 0
>>
>>
>
>
>