背著手扇扇子的人
          往事隨風......前事如夢......
          posts - 35,  comments - 17,  trackbacks - 0

          xxx購物超市折扣規則描述:
           1.任何顧客的購物總價大于1000元則享受9折優惠
           2.vip顧客的時候無論購物總價是多少享受7折優惠
           3.普通顧客沒有特別政策,另有規定的除外
           4.白金顧客享受8.5優惠,無論購物總價多少。
           5.黃金顧客享受9折優惠無論購物總價多少。
           6.任何顧客所夠商品中包含tv的時候,優惠后再優惠9.5折
          這個user case 是自己想的,不是很復雜

          對應的規則文件

          #created on: 2006-6-10
          #created by: kebo
          package com.sample

          import com.sample.Person;
          import com.sample.ShopCat;
          import com.sample.Product;
          import com.sample.Helper;


          rule "PRICE_DISCOUT"
           salience 2
           no-loop true
           when
            p:Person(c:cat->(c.getTotalPrice()>1000),discout==1)     
           then
            p.setDiscout(0.9);
            modify(p); 
          end

          rule "VIP"
           salience 3
           no-loop true
           when
            p:Person(type==Person.VIP,discout==1)     
           then
            p.setDiscout(0.7);
            modify(p); 
          end

          rule "COMMON"
           salience 3
           no-loop true
           when
            p:Person(type==Person.COMMON,discout==1)     
           then
            p.setDiscout(1);
            modify(p);
          end

          rule "PLATINA"
           salience 3
           no-loop true
           when
            p:Person(type==Person.PLATINA,discout==1)     
           then
            p.setDiscout(0.85); 
            modify(p);
          end

          rule "GOLD"
           salience 3
           no-loop true
           when
            p:Person(type==Person.GOLD,discout==1)     
           then  
            p.setDiscout(0.9); 
            modify(p);
          end

          rule "CONTAIN TV"
           salience 1
           no-loop true
           when
            p:Person(c:cat->(Helper.isContainType(c.getProducts(),Product.TV)))     
           then
            p.setDiscout(0.95 * p.getDiscout());
            modify(p);
          end

          解決rule的沖突還是比較麻煩的。

          為什么blogjava沒有code著色功能呢?代碼貼上去一點都不好看,唉!

           

           

          posted on 2006-06-13 01:19 kebo 閱讀(2041) 評論(0)  編輯  收藏 所屬分類: java

          <2006年6月>
          28293031123
          45678910
          11121314151617
          18192021222324
          2526272829301
          2345678

          常用鏈接

          留言簿(1)

          隨筆分類

          隨筆檔案

          文章檔案

          相冊

          收藏夾

          朋友

          搜索

          •  

          積分與排名

          • 積分 - 23127
          • 排名 - 1598

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 昭通市| 永宁县| 锡林郭勒盟| 湾仔区| 呈贡县| 新昌县| 东安县| 英德市| 辉县市| 岱山县| 安康市| 石嘴山市| 奉节县| 洛阳市| 石城县| 左权县| 金沙县| 依安县| 拜泉县| 濮阳市| 板桥市| 怀集县| 北川| 菏泽市| 蓝田县| 深州市| 崇仁县| 达日县| 石景山区| 汝阳县| 舞阳县| 保靖县| 虞城县| 宁南县| 林周县| 宾川县| 永登县| 花垣县| 方城县| 陵川县| 石河子市|