如何在流口水中积累

时间:2014-04-03 05:48:12

标签: conditional-statements drools accumulate

我想列出<字符串> Control_Exam_List()的名称<<是List<字符串>

但它的条件是$ scheduleCheck。

然后我使用了“from”功能,但仍无效。

Drools Rule

rule "People List"
  salience 5
  when
    $scheduleCheck : Schedule( )
    $controlExamList : Control_Exam_List( ) 
       from accumulate( $scheduleCECheck : Schedule( ) from $scheduleCheck ,
                        init( Control_Exam_List CEL = new Control_Exam_List(); ),
                        action( CEL.addData($scheduleCECheck.getControl1());
                                CEL.addData($scheduleCECheck.getControl2());
                                CEL.addData($scheduleCECheck.getControl3()); ),
                        result( CEL ) )
    $schedule : Schedule( date == $scheduleCheck.getDate() &&
                  $scheduleCheck.getStarttime() >= starttime && <= endtime)
  then
    for( String str: $controlExamList.getCode() /* get List <String>*/ ){
      System.out.println( str );
    }
end

1 个答案:

答案 0 :(得分:0)

rule "People List"
  salience 5
  when
    $scheduleCheck : Schedule( )
    $schedule : Schedule( date == $scheduleCheck.getDate() &&
                  $scheduleCheck.getStarttime() >= starttime && <= endtime)
    $controlExamList : Control_Exam_List( ) 
       from accumulate( $scheduleCECheck : Schedule( 
                        date == $scheduleCheck.getDate() ||
                        $scheduleCheck.getStarttime() == starttime || == endtime ) ,
            init( Control_Exam_List CEL = new Control_Exam_List(); ),
            action( CEL.addData($scheduleCECheck.getControl1());
                    CEL.addData($scheduleCECheck.getControl2());
                    CEL.addData($scheduleCECheck.getControl3()); ),
            result( CEL ) )
  then
    for( String str: $controlExamList.getCode() /* get List <String>*/ ){
      System.out.println( str );
    }
end