package com.signavio.droolsexport
import java.util.Listimport java.util.Arraysimport java.util.HashSetimport java.util.Collections
declare ListDecision textList : List booleanList : List numberList : List textOutput : String end
rule "listDecision_rule_1" no-loop when $listDecision : ListDecision( textList.equals(Arrays.asList("hallo", "welt")), booleanList.equals(Arrays.asList(true)), numberList.equals(Arrays.asList(1.0, 2.0, 3.0)) ) then modify( $listDecision ){ setTextOutput("EQUALS"); };end
rule "listDecision_rule_2" no-loop when $listDecision : ListDecision( !textList.equals(Arrays.asList("hallo", "welt")), !booleanList.equals(Arrays.asList(true)), !numberList.equals(Arrays.asList(1.0, 2.0, 3.0)) ) then modify( $listDecision ){ setTextOutput("NOT EQUALS"); };end
rule "listDecision_rule_3" no-loop when $listDecision : ListDecision( new HashSet(textList).containsAll(new HashSet(Arrays.asList("hallo", "welt"))), new HashSet(booleanList).containsAll(new HashSet(Arrays.asList(true))), new HashSet(numberList).containsAll(new HashSet(Arrays.asList(1.0, 2.0, 3.0))) ) then modify( $listDecision ){ setTextOutput("ELEMENTS OF"); };end
rule "listDecision_rule_4" no-loop when $listDecision : ListDecision( !new HashSet(textList).containsAll(new HashSet(Arrays.asList("hallo", "welt"))), !new HashSet(booleanList).containsAll(new HashSet(Arrays.asList(true))), !new HashSet(numberList).containsAll(new HashSet(Arrays.asList(1.0, 2.0, 3.0))) ) then modify( $listDecision ){ setTextOutput("NOT ELEMENTS OF"); };end
rule "listDecision_rule_5" no-loop when $listDecision : ListDecision( !Collections.disjoint(textList, Arrays.asList("hallo", "welt")), !Collections.disjoint(booleanList, Arrays.asList(true)), !Collections.disjoint(numberList, Arrays.asList(1.0, 2.0, 3.0)) ) then modify( $listDecision ){ setTextOutput("CONTAINS ANY OF"); };end
rule "listDecision_rule_6" no-loop when $listDecision : ListDecision( new HashSet(textList).equals(new HashSet(Arrays.asList("hallo", "welt"))), new HashSet(booleanList).equals(new HashSet(Arrays.asList(true))), new HashSet(numberList).equals(new HashSet(Arrays.asList(1.0, 2.0, 3.0))) ) then modify( $listDecision ){ setTextOutput("CONTAINS ONLY"); };end
rule "listDecision_rule_7" no-loop when $listDecision : ListDecision( Collections.disjoint(textList, Arrays.asList("hallo", "welt")), Collections.disjoint(booleanList, Arrays.asList(true)), Collections.disjoint(numberList, Arrays.asList(1.0, 2.0, 3.0)) ) then modify( $listDecision ){ setTextOutput("CONTAINS NONE OF"); };end
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-usage/e5db8733-ac4c-40ee-9195-a005366e9013%40googlegroups.com.--
You received this message because you are subscribed to the Google Groups "Drools Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-usage...@googlegroups.com.
To post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-usage/ebbe0752-4d9c-492d-92e6-808ce835359e%40googlegroups.com.
package com.signavio.droolsexport
import java.util.Listimport java.util.Arraysimport java.util.HashSetimport java.util.Collections
declare ListDecision textList : List booleanList : List numberList : List textOutput : String end
rule "listDecision_rule_1" no-loop when $listDecision : ListDecision( textList.equals(["hallo", "welt"]), !booleanList.equals([true]), new HashSet([1.0, 2.0, 3.0]).containsAll(new HashSet(numberList)) ) then modify( $listDecision ){ setTextOutput("RULE 1"); };end
rule "listDecision_rule_2" no-loop when $listDecision : ListDecision( !textList.equals(["hallo", "welt"]), booleanList.equals([true]), !new HashSet([1.0, 2.0, 3.0]).containsAll(new HashSet(numberList)) ) then modify( $listDecision ){ setTextOutput("RULE 2"); };end
rule "listDecision_rule_3" no-loop when $listDecision : ListDecision( new HashSet(["hallo", "welt"]).containsAll(new HashSet(textList)), booleanList.equals([true]), !numberList.equals([1.0, 2.0, 3.0]) ) then modify( $listDecision ){ setTextOutput("RULE 3"); };end
rule "listDecision_rule_4" no-loop when $listDecision : ListDecision( !new HashSet(["hallo", "welt"]).containsAll(new HashSet(textList)), !booleanList.equals([true]), !Collections.disjoint(numberList, [1.0, 2.0, 3.0] ) then modify( $listDecision ){ setTextOutput("RULE 4"); };end
rule "listDecision_rule_5" no-loop when $listDecision : ListDecision( !Collections.disjoint(textList, ["hallo", "welt"], !new HashSet([true]).containsAll(new HashSet(booleanList)), numberList.equals([1.0, 2.0, 3.0]) ) then modify( $listDecision ){ setTextOutput("RULE 5"); };end
rule "listDecision_rule_6" no-loop when $listDecision : ListDecision( new HashSet(["hallo", "welt"]).equals(new HashSet(textList)), new HashSet([true]).equals(new HashSet(booleanList)), Collections.disjoint(numberList, [1.0, 2.0, 3.0] ) then modify( $listDecision ){ setTextOutput("RULE 6"); };end
rule "listDecision_rule_7" no-loop when $listDecision : ListDecision( Collections.disjoint(textList, ["hallo", "welt"], !booleanList.equals([true]), numberList.equals([1.0, 2.0, 3.0]) ) then modify( $listDecision ){ setTextOutput("RULE 7"); };end
List<String> stringInput = Arrays.asList("wurst", "schmeckt", "wurst", "neckt");
List<Boolean> booleanInput = Arrays.asList(false, false);
List<Double> numberInput = Arrays.asList(1d, 2d, 3d);
String expected = "RULE 7";
2015-07-01 10:00:02,838 WARN (MvelConstraint.java:312) - Exception jitting: booleanList.equals([true]) This is NOT an error and NOT prevent the correct execution since the constraint will be evaluated in intrepreted mode2015-07-01 10:00:02,869 WARN (MvelConstraint.java:312) - Exception jitting: !booleanList.equals([true]) This is NOT an error and NOT prevent the correct execution since the constraint will be evaluated in intrepreted mode2015-07-01 10:00:02,884 WARN (MvelConstraint.java:312) - Exception jitting: !Collections.disjoint(numberList, [1.0, 2.0, 3.0]) This is NOT an error and NOT prevent the correct execution since the constraint will be evaluated in intrepreted mode2015-07-01 10:00:02,903 WARN (MvelConstraint.java:312) - Exception jitting: !booleanList.equals([true]) This is NOT an error and NOT prevent the correct execution since the constraint will be evaluated in intrepreted mode2015-07-01 10:00:02,906 WARN (MvelConstraint.java:312) - Exception jitting: numberList.equals([1.0, 2.0, 3.0]) This is NOT an error and NOT prevent the correct execution since the constraint will be evaluated in intrepreted modeTo view this discussion on the web visit https://groups.google.com/d/msgid/drools-usage/c94a73e8-0169-480c-84cb-8d8779a41b7d%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-usage/b95fe315-1dc0-496c-86b6-271477069f52%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-usage/002280a6-d5f3-4855-8ce4-efeca245cf5a%40googlegroups.com.