1700459120
//这个参数是各个基本方法执行的顺序
1700459121
1700459122
private ArrayList<String>sequence=new ArrayList<String>();
1700459123
1700459124
//模型是启动开始跑了
1700459125
1700459126
protected abstract void start();
1700459127
1700459128
//能发动,那还要能停下来,那才是真本事
1700459129
1700459130
protected abstract void stop();
1700459131
1700459132
//喇叭会出声音,是滴滴叫,还是哔哔叫
1700459133
1700459134
protected abstract void alarm();
1700459135
1700459136
//引擎会轰隆隆地响,不响那是假的
1700459137
1700459138
protected abstract void engineBoom();
1700459139
1700459140
//那模型应该会跑吧,别管是人推的,还是电力驱动,总之要会跑
1700459141
1700459142
final public void run(){
1700459143
1700459144
//循环一边,谁在前,就先执行谁
1700459145
1700459146
for(int i=0;i<this.sequence.size();i++){
1700459147
1700459148
String actionName=this.sequence.get(i);
1700459149
1700459150
if(actionName.equalsIgnoreCase(“start”)){
1700459151
1700459152
this.start();//开启汽车
1700459153
1700459154
}else if(actionName.equalsIgnoreCase(“stop”)){
1700459155
1700459156
this.stop();//停止汽车
1700459157
1700459158
}else if(actionName.equalsIgnoreCase(“alarm”)){
1700459159
1700459160
this.alarm();//喇叭开始叫了
1700459161
1700459162
}else if(actionName.equalsIgnoreCase(“engine boom”)){//
1700459163
1700459164
如果是engine boom关键字
1700459165
1700459166
this.engineBoom();//引擎开始轰鸣
1700459167
1700459168
}
1700459169
[
上一页 ]
[ :1.70045912e+09 ]
[
下一页 ]