1700473454
1700473455
public final static OpenningState openningState=new OpenningState();
1700473456
1700473457
public final static ClosingState closeingState=new ClosingState();
1700473458
1700473459
public final static RunningState runningState=new RunningState();
1700473460
1700473461
public final static StoppingState stoppingState=new StoppingState();
1700473462
1700473463
//定义一个当前电梯状态
1700473464
1700473465
private LiftState liftState;
1700473466
1700473467
public LiftState getLiftState(){
1700473468
1700473469
return liftState;
1700473470
1700473471
}
1700473472
1700473473
public void setLiftState(LiftState liftState){
1700473474
1700473475
this.liftState=liftState;
1700473476
1700473477
//把当前的环境通知到各个实现类中
1700473478
1700473479
this.liftState.setContext(this);
1700473480
1700473481
}
1700473482
1700473483
public void open(){
1700473484
1700473485
this.liftState.open();
1700473486
1700473487
}
1700473488
1700473489
public void close(){
1700473490
1700473491
this.liftState.close();
1700473492
1700473493
}
1700473494
1700473495
public void run(){
1700473496
1700473497
this.liftState.run();
1700473498
1700473499
}
1700473500
1700473501
public void stop(){
1700473502
1700473503
this.liftState.stop();
[
上一页 ]
[ :1.700473454e+09 ]
[
下一页 ]