Drools Expert - stateless vs stateful

From Training Material
Jump to navigation Jump to search
title
Drools Expert - stateless vs stateful
author
Bernard Szlachta (NobleProg Ltd)

Drools Expert - mvel - RHS - basic Training Materials

Stateless vs stateful ⌘。

  • Validate age of an applicant
  • 下围棋

Go ⌘。

Stateless
  1. Make a move (facts.add(new WhiteStone(3,5))) 走一步
  2. run .execute(facts) method 执行execute方法
  3. make sure that facts array and working memory are in sync 确定facts array的事实和工作内存里面的事实同步
  4. make a move (facts.add(new BlackStone(3,4)))
  5. run .execute(facts) method
  6. make sure that facts array and working memory are in sync
Stateful
  1. Make a move (ks.insert(new WhiteStone(3,5)))
  2. run .fireAllRules() method
  3. make a move (ks.insert(new BlackStone(3,4)))
  4. run .fireAllRules() method
  5. when game ends run ks.dispose()