I took the Fibanocci example and modified it little bit. It still seems to work, but I don't know how. Here is my rule.
rule "Recurse"
salience 10
when
f : Fibanocci(value == 0)
not Fibanocci(sequence == 0)
then
System.out.println(f.sequence + "/" + f.value);
insert(new Fibanocci(f.sequence - 1));
end
I get the following output:
50/0 49/0 48/0 47/0 46/0 45/0 .. and so on
It seems to me every time a new instance of Fibanocci
is inserted, it should start from 50 again, but it doesn't.
// here is my class, getter/setter skipped
public class Fibonacci {
private int sequence;
private long value;
public Fibonacci(final int sequence) {
this.sequence = sequence;
}
}