automotiverobotbuildable.java
来自「程序设计模式java入门源码大全」· Java 代码 · 共 66 行
JAVA
66 行
import java.util.*;
public class AutomotiveRobotBuildable implements RobotBuildable
{
ArrayList actions;
public AutomotiveRobotBuildable()
{
}
public final void go()
{
Iterator itr = actions.iterator();
while(itr.hasNext()) {
switch ((new Integer(itr.next().toString())).intValue()){
case 1:
start();
break;
case 2:
getParts();
break;
case 3:
assemble();
break;
case 4:
test();
break;
case 5:
stop();
break;
}
}
}
public void start()
{
System.out.println("Starting....");
}
public void getParts()
{
System.out.println("Getting a carburetor....");
}
public void assemble()
{
System.out.println("Installing the carburetor....");
}
public void test()
{
System.out.println("Revving the engine....");
}
public void stop()
{
System.out.println("Stopping....");
}
public void loadActions(ArrayList a)
{
actions = a;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?