Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. a problem about drools

a problem about drools

Scheduled Pinned Locked Moved Java
helpcomregextutorialquestion
3 Posts 3 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    newtypebao
    wrote on last edited by
    #1

    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(); }

    R B 2 Replies Last reply
    0
    • N newtypebao

      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(); }

      R Offline
      R Offline
      Reagan Conservative
      wrote on last edited by
      #2

      Doesn't look like any "Java" I've ever seen. Maybe C#??? Try their forums

      John P.

      1 Reply Last reply
      0
      • N newtypebao

        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(); }

        B Offline
        B Offline
        BlackWolvix
        wrote on last edited by
        #3

        which programming language this code is for? :S regards

        BlaCk WolViX

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups