a problem about drools
-
Hi, I have encountered an infinite loop in the following example. I just want to update the mathine's "tag". when the "tag" is ture ,then put out message "aaaaaaaaaaaaaaaaaaaaaaa". But infinite loop occurs even though no-loop is used. is there anyone can help me? thanks! package com.sample rule "Test for type1 machine" no-loop true salience 100 when machine1 : Machine($t:type , type == "Type1" , functions == "func1",code == "c001") machine2 : Machine($f:functions,type == $t,functions=="func2",code=="c002") machine3 : Machine(type == "Type2" ,functions==$f , code=="c003") then System.out.println("match"); machine1.setTag(true); machine2.setTag(true); machine3.setTag(true); System.out.println(machine1.getName()+" "+machine1.getTag()); System.out.println(machine2.getName()+" "+machine2.getTag()); System.out.println(machine3.getName()+" "+machine3.getTag()); update(machine1); //update(machine2); // update(machine3); end rule "Test modify" no-loop true salience 90 when machine6 : Machine(tag == true) then System.out.println(machine6.getName()+"aaaaaaaaaaaaaaaa"); end public static final void main(String[] args) { try { //load up the rulebase RuleBase ruleBase = readRule(); // RuleBase ruleBase =getRuleBase(); WorkingMemory workingMemory = ruleBase.newStatefulSession(); //go ! Machine machine1=new Machine("Type1","func1","machine1","c001"); Machine machine2=new Machine("Type1","func2","machine2","c002"); Machine machine3=new Machine("Type2","func2","machine3","c003"); Machine machine4=new Machine("Type2","func2","machine4","c003"); Machine machine5=new Machine("Type1","func1","machine5","c001"); workingMemory.insert( machine1 ); workingMemory.insert( machine2 ); workingMemory.insert( machine3 ); workingMemory.insert( machine4 ); workingMemory.insert( machine5 ); workingMemory.fireAllRules(); }
-
Hi, I have encountered an infinite loop in the following example. I just want to update the mathine's "tag". when the "tag" is ture ,then put out message "aaaaaaaaaaaaaaaaaaaaaaa". But infinite loop occurs even though no-loop is used. is there anyone can help me? thanks! package com.sample rule "Test for type1 machine" no-loop true salience 100 when machine1 : Machine($t:type , type == "Type1" , functions == "func1",code == "c001") machine2 : Machine($f:functions,type == $t,functions=="func2",code=="c002") machine3 : Machine(type == "Type2" ,functions==$f , code=="c003") then System.out.println("match"); machine1.setTag(true); machine2.setTag(true); machine3.setTag(true); System.out.println(machine1.getName()+" "+machine1.getTag()); System.out.println(machine2.getName()+" "+machine2.getTag()); System.out.println(machine3.getName()+" "+machine3.getTag()); update(machine1); //update(machine2); // update(machine3); end rule "Test modify" no-loop true salience 90 when machine6 : Machine(tag == true) then System.out.println(machine6.getName()+"aaaaaaaaaaaaaaaa"); end public static final void main(String[] args) { try { //load up the rulebase RuleBase ruleBase = readRule(); // RuleBase ruleBase =getRuleBase(); WorkingMemory workingMemory = ruleBase.newStatefulSession(); //go ! Machine machine1=new Machine("Type1","func1","machine1","c001"); Machine machine2=new Machine("Type1","func2","machine2","c002"); Machine machine3=new Machine("Type2","func2","machine3","c003"); Machine machine4=new Machine("Type2","func2","machine4","c003"); Machine machine5=new Machine("Type1","func1","machine5","c001"); workingMemory.insert( machine1 ); workingMemory.insert( machine2 ); workingMemory.insert( machine3 ); workingMemory.insert( machine4 ); workingMemory.insert( machine5 ); workingMemory.fireAllRules(); }
Doesn't look like any "Java" I've ever seen. Maybe C#??? Try their forums
John P.
-
Hi, I have encountered an infinite loop in the following example. I just want to update the mathine's "tag". when the "tag" is ture ,then put out message "aaaaaaaaaaaaaaaaaaaaaaa". But infinite loop occurs even though no-loop is used. is there anyone can help me? thanks! package com.sample rule "Test for type1 machine" no-loop true salience 100 when machine1 : Machine($t:type , type == "Type1" , functions == "func1",code == "c001") machine2 : Machine($f:functions,type == $t,functions=="func2",code=="c002") machine3 : Machine(type == "Type2" ,functions==$f , code=="c003") then System.out.println("match"); machine1.setTag(true); machine2.setTag(true); machine3.setTag(true); System.out.println(machine1.getName()+" "+machine1.getTag()); System.out.println(machine2.getName()+" "+machine2.getTag()); System.out.println(machine3.getName()+" "+machine3.getTag()); update(machine1); //update(machine2); // update(machine3); end rule "Test modify" no-loop true salience 90 when machine6 : Machine(tag == true) then System.out.println(machine6.getName()+"aaaaaaaaaaaaaaaa"); end public static final void main(String[] args) { try { //load up the rulebase RuleBase ruleBase = readRule(); // RuleBase ruleBase =getRuleBase(); WorkingMemory workingMemory = ruleBase.newStatefulSession(); //go ! Machine machine1=new Machine("Type1","func1","machine1","c001"); Machine machine2=new Machine("Type1","func2","machine2","c002"); Machine machine3=new Machine("Type2","func2","machine3","c003"); Machine machine4=new Machine("Type2","func2","machine4","c003"); Machine machine5=new Machine("Type1","func1","machine5","c001"); workingMemory.insert( machine1 ); workingMemory.insert( machine2 ); workingMemory.insert( machine3 ); workingMemory.insert( machine4 ); workingMemory.insert( machine5 ); workingMemory.fireAllRules(); }
which programming language this code is for? :S regards
BlaCk WolViX