« Return to Thread: How to avoid circular rule activation for non circular problems?

AW: How to avoid circular rule activation fornoncircular problems?

by Ralph Ammon :: Rate this Message:

Reply to Author | View in Thread

Sorry for the line breaks. Here I post my changes in a (hopefully) more readable format:

  rule "Calc StartTime with predecessors"
    when
      $t :     Task(predecessorCount > 0, $predecessors : predecessors )
      forall(  $succTask : Task( this == $t )
               $predTask : Task( this memberOf $predecessors, endTime > 0 ) )
      $endTime : Number() from accumulate  ( $p : Task() from $predecessors,
                                             max($p.getEndTime()) )
      # new constraint
      Task( this == $t, eval($t.getStartTime() != $endTime.longValue()) )
    then
      $t.setStartTime( $endTime.longValue() );
      System.out.println( "Drools: " + $t.toString() + " has new StartTime" );
      # new update
      update( $t );
  end

Best regards
Ralph

_______________________________________________
rules-users mailing list
rules-users@...
https://lists.jboss.org/mailman/listinfo/rules-users

 « Return to Thread: How to avoid circular rule activation for non circular problems?

LightInTheBox - Buy quality products at wholesale price!