打字猴:1.70047351e+09
1700473510
1700473511 代码清单26-10 关闭状态
1700473512
1700473513 public class ClosingState extends LiftState{
1700473514
1700473515 //电梯门关闭,这是关闭状态要实现的动作
1700473516
1700473517 @Override
1700473518
1700473519 public void close(){
1700473520
1700473521 System.out.println(“电梯门关闭……”);
1700473522
1700473523 }
1700473524
1700473525 //电梯门关了再打开
1700473526
1700473527 @Override
1700473528
1700473529 public void open(){
1700473530
1700473531 super.context.setLiftState(Context.openningState); //置为敞门状态
1700473532
1700473533 super.context.getLiftState().open();
1700473534
1700473535 }
1700473536
1700473537 //电梯门关了就运行,这是再正常不过了
1700473538
1700473539 @Override
1700473540
1700473541 public void run(){
1700473542
1700473543 super.context.setLiftState(Context.runningState); //设置为运行状态
1700473544
1700473545 super.context.getLiftState().run();
1700473546
1700473547 }
1700473548
1700473549 //电梯门关着,我就不按楼层
1700473550
1700473551 @Override
1700473552
1700473553 public void stop(){
1700473554
1700473555 super.context.setLiftState(Context.stoppingState); //设置为停止状态
1700473556
1700473557 super.context.getLiftState().stop();
1700473558
1700473559 }
[ 上一页 ]  [ :1.70047351e+09 ]  [ 下一页 ]