Pair Project Interface Design By Li Zhang, Guiying Li
我们的设计中有两个类:class Elevator and class CenterController
by 李皈颖&张丽
Pair work Interface :
Class Elevator
{
Public enum TaskStates:uint
{
Active,
Wait
}
Public struct Queue{
Public TaskStates taskState;
Public Int arrivefoor;
Public Double Priority;
}
Public enum States:uint
{
IsUp,
IsDown,
IsStop
}
Public struct EleState{
Public States mystate;
Public int passengerNum;
Public int Weight;
Public bool IsnewFloor;
Public int myfloornumber;
}
Private int activeWork;
Public EleState CurrentState;
Private Queue[] UpRequest; // up array request
Private Queue[] DownRequest; // down array request
Private int[] floorstop; // people who in the elevator push the button
Private int passengerNum;
Private int weight;
Private int speed;//
Private bool IsLastWorkDone;
Elevator(int passengerLimit , int weightLimit) //create function
{
passengerNum=passengerLimit;
weigthL=weightLimit;
}
Private void opendoor();
Private void Move();
Private void Gettask();//get task from center controller
Private void update(); // update its UpRequest and DownRequest
Private void Control(); // main function control the elevator
Private void addtask();// people in the elevator send a task
}
Class CenterController{
Public struct Work{
Public int floorth;
Public bool IsUp;
Public int elevatornum;
Public int prority;
Public int waittime;
}
Public Work[] WorkPool;
Public enum ButtonStates: uint
{
IsUp,
IsDown
}
Public struct FloorButton{
Public ButtonStates buttonstate;
Public Int Elevatornum;
Public int floorth;
Public int Priority;
}
Public FloorButton[] floorButtons; //save all the buttons
Private void Input();
Private void Compute(); // compute the most high efficiency .
Private void UpdateTask(); // for each elevator, add their task if there is a new request
Private void control(); // main function }
posted on 2012-09-07 16:05 Gun N' Rose 阅读(177) 评论(9) 编辑 收藏 举报