打字猴:1.700471481e+09
1700471481
1700471482 this.state=state;
1700471483
1700471484 }
1700471485
1700471486 //创建一个备忘录
1700471487
1700471488 public IMemento createMemento(){
1700471489
1700471490 return new Memento(this.state);
1700471491
1700471492 }
1700471493
1700471494 //恢复一个备忘录
1700471495
1700471496 public void restoreMemento(IMemento_memento){
1700471497
1700471498 this.setState(((Memento)_memento).getState());
1700471499
1700471500 }
1700471501
1700471502 //内置类
1700471503
1700471504 private class Memento implements IMemento{
1700471505
1700471506 //发起人的内部状态
1700471507
1700471508 private String state=””;
1700471509
1700471510 //构造函数传递参数
1700471511
1700471512 private Memento(String_state){
1700471513
1700471514 this.state=_state;
1700471515
1700471516 }
1700471517
1700471518 private String getState(){
1700471519
1700471520 return state;
1700471521
1700471522 }
1700471523
1700471524 private void setState(String state){
1700471525
1700471526 this.state=state;
1700471527
1700471528 }
1700471529
1700471530 }
[ 上一页 ]  [ :1.700471481e+09 ]  [ 下一页 ]