2020
10-08
10-08
Java如何通过枚举实现有限状态机
首先在枚举类中定义state和定义的抽象方法。publicenumJavaPlatformState{//定义stateOPEN{@Overridevoidexit(JavaPlatformMachinepm){super.exit(pm);}@Overridevoidvalid(JavaPlatformMachinepm){this.exit(pm);if(pm.data.getValid_()){pm.state=STEP1;}else{NotFound();pm.state=OFF;}pm.state.entry(pm);}@Overridevoidfi...
继续阅读 >