Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-5271

RHS statements ordering changes with modify block in executable model

    Details

    • Sprint:
      2020 Week 16-18 (from Apr 13)
    • Story Points:
      3
    • Docs QE Status:
      NEW
    • QE Status:
      NEW

      Description

      The order of statements in RHS changes with executable model when modify block is involved.

      import org.drools.modelcompiler.domain.Person;global java.util.List list;
      rule R when
        $p1 : Person(name == "John")
        $p2 : Person(name == "Paul")
      then
        list.add($p1.getAge());
        list.add($p2.getAge());
        modify($p1) { setAge($p1.getAge()+1) }
        list.add($p1.getAge());
        list.add($p2.getAge());
        modify($p2) { setAge($p2.getAge()+5) }
        list.add($p1.getAge());
        list.add($p2.getAge());
      end
      

      Below is the generated code.

      D.on(var_$p1,
          var_$p2,
          var_list).execute((org.drools.model.Drools drools, org.drools.modelcompiler.domain.Person $p1, org.drools.modelcompiler.domain.Person $p2, java.util.List list) -> {
         {
             {
                 list.add($p1.getAge());
                 list.add($p2.getAge());
                 list.add($p1.getAge());
                 list.add($p2.getAge());
                 list.add($p1.getAge());
                 list.add($p2.getAge());
                 ($p1).setAge($p1.getAge() + 1);
                 drools.update($p1,
                               mask_$p1);
                 ($p2).setAge($p2.getAge() + 5);
                 drools.update($p2,
                               mask_$p2);
             }
         }
      }));
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                tkobayashi Toshiya Kobayashi
                Reporter:
                tkobayashi Toshiya Kobayashi
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: