5.Layer类[code=java]package cn.zjc.test.elevator;
public class Layer {
/**楼层数*/
private int index;
/**楼层名称*/
private String name;
/**
* 构造函数
* */
public Layer(){}
/**
* 构造函数
* @param index(int)
* @param name(String)
* */
public Layer(int index ,String name){
this.index = index;
this.name = name;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
/**
* 显示当前电梯所在的楼层数
* @prama elevator(Elevator)
* */
public int getElevatorIndex(Elevator elevator){
int index = 0 ;
return index;
}
/**
* 显示当前电梯运行的方向
* @return int 0:停止状态 1:向上 2:向下
* */
public int getElevatorDirection(Elevator elevator){
int direction = 0 ;
return direction;
}
/**
* 向上请求服务
* */
public boolean up(Elevator elevator){
boolean boo = false;
return boo;
}
/**
* 向下请求服务
* */
public boolean down(Elevator elevator){
boolean boo = false;
return boo;
}
}[/code]6.LayerThread类[code=java]package cn.zjc.test.elevator;
public class LayerThread implements Runnable {
/**楼层*/
private int index;
/**为此楼层提供服务的电梯*/
private Elevator elevator;
/**
* 构造函数
* */
public LayerThread(){
}
/**
* 构造函数
* @param index(int):楼层
* @prama elevator(Elevator):为此楼层提供服务的电梯
* */
public LayerThread(int index , Elevator elevator){
this.index = index;
this.elevator = elevator;
}
/**
* run()
* */
public void run() {
System.out.println("楼层" + index + ",提供服务的电梯是:"+elevator.getName());
}
}[/code]7.MainClass类[code=java]package cn.zjc.test.elevator;
/**
* 启动类
* */
public class MainClass {
public static void main(String [] args){
new BuildingController();
}
}[/code]请大家多多参与。在此先谢谢诸位。
[ 本帖最后由 龙舌兰 于 2011-08-01 20:33 编辑 ] |