打字猴:1.700464096e+09
1700464096
1700464097 //能处理的级别
1700464098
1700464099 private int level=0;
1700464100
1700464101 //责任传递,下一个人责任人是谁
1700464102
1700464103 private Handler nextHandler;
1700464104
1700464105 //每个类都要说明一下自己能处理哪些请求
1700464106
1700464107 public Handler(int_level){
1700464108
1700464109 this.level=_level;
1700464110
1700464111 }
1700464112
1700464113 //一个女性(女儿、妻子或者是母亲)要求逛街,你要处理这个请求
1700464114
1700464115 public final void HandleMessage(IWomen women){
1700464116
1700464117 if(women.getType()==this.level){
1700464118
1700464119 this.response(women);
1700464120
1700464121 }else{
1700464122
1700464123 if(this.nextHandler!=null){//有后续环节,才把请求往后递送
1700464124
1700464125 this.nextHandler.HandleMessage(women);
1700464126
1700464127 }else{//已经没有后续处理人了,不用处理了
1700464128
1700464129 System.out.println(”–没地方请示了,按不同意处理–\n”);
1700464130
1700464131 }
1700464132
1700464133 }
1700464134
1700464135 }
1700464136
1700464137 /*
1700464138
1700464139 *如果不属于你处理的请求,你应该让她找下一个环节的人,如女儿出嫁了,
1700464140
1700464141 *还向父亲请示是否可以逛街,那父亲就应该告诉女儿,应该找丈夫请示
1700464142
1700464143 */
1700464144
1700464145 public void setNext(Handler_handler){
[ 上一页 ]  [ :1.700464096e+09 ]  [ 下一页 ]