Hi,

say I have a class with two fields, x and y:

public class Test {
    int x = 1;
    int y = 2;

    getters/setters...
}


I would like a rule which fires when y = x + 1

my initial thought would be something like:

rule "Rule 1"
       
        when
                test : Test (y == x + 1)
        then
                System.out.println("Rule 1 matches.");
               
end


but this is invalid syntax and I can not find any examples of such a rule. I'm doing my best but reading the manual etc. I'm struggling with the syntax here and can't figure it out.

any help really appreciated!