打字猴:1.700468978e+09
1700468978 private String type;
1700468979
1700468980 //通过构造函数传递参数,我要监控的是谁,谁来监控,要监控什么
1700468981
1700468982 public Spy(HanFeiZi_hanFeiZi,LiSi_liSi,String_type){
1700468983
1700468984 this.hanFeiZi=_hanFeiZi;
1700468985
1700468986 this.liSi=_liSi;
1700468987
1700468988 this.type=_type;
1700468989
1700468990 }
1700468991
1700468992 @Override
1700468993
1700468994 public void run(){
1700468995
1700468996 while(true){
1700468997
1700468998 if(this.type.equals(“breakfast”)){//监控是否在吃早餐
1700468999
1700469000 //如果发现韩非子在吃饭,就通知李斯
1700469001
1700469002 if(this.hanFeiZi.isHavingBreakfast()){
1700469003
1700469004 this.liSi.update(“韩非子在吃饭”);
1700469005
1700469006 //重置状态,继续监控
1700469007
1700469008 this.hanFeiZi.setHavingBreakfast(false);
1700469009
1700469010 }
1700469011
1700469012 }else{//监控是否在娱乐
1700469013
1700469014 if(this.hanFeiZi.isHavingFun()){
1700469015
1700469016 this.liSi.update(“韩非子在娱乐”);
1700469017
1700469018 this.hanFeiZi.setHavingFun(false);
1700469019
1700469020 }
1700469021
1700469022 }
1700469023
1700469024 }
1700469025
1700469026 }
1700469027
[ 上一页 ]  [ :1.700468978e+09 ]  [ 下一页 ]