This topic has been archived. It cannot be replied.
-
工作学习 / IT技术讨论 / 请问各位大虾:我在用JAVA编一个电梯控制系统,以CLASS1负责各个电梯的运行,以CLASS2控制中心调度,可如何让CLASS2随时知道各个电梯的运行状态(FLOOR,DIRECTION,MOVE OR STOP)呢?多谢!
-lxz(flyer);
2002-2-21
(#375656@0)
-
在用那本how to program Java书? :-)
-luoboyang(萝卜秧);
2002-2-21
(#375659@0)
-
不是啦,我在做一个COURSE PROJECT,这本书很好吗?
-lxz(flyer);
2002-2-21
(#375719@0)
-
you must have "FLOOR ,DIRECTION, status" attribute in your elevator class, then getXXX();in my opinion, class2 needn't know these information, just tell class1 to do what. class1 determine it.
-macsym(日进斗斤);
2002-2-21
(#375668@0)
-
问题是,如果有人在电梯外某楼按了向上或下的按钮,CLASS2不是要根据各个电梯的运行来决定把这一个REQUEST传给某一个电梯去处理吗?
-lxz(flyer);
2002-2-21
(#375722@0)
-
if class2 can directely control the elevator, why you need the class1?
-macsym(日进斗斤);
2002-2-21
(#375734@0)
-
In opinion, class2 just forward the request and get result. class1 to prosess the request.
-macsym(日进斗斤);
2002-2-21
(#375737@0)
-
Thank you,macsym,i understand CLASS1 just forword the REQUEST to CLASS1 to let CLASS1 to process, but what you mean "get result" here?
-lxz(flyer);
2002-2-21
(#375754@0)
-
like "success, fail, true , false". just like you bushed the button, the light turn on.
-macsym(日进斗斤);
2002-2-21
(#375762@0)
-
还有,如果让几部电梯同时运行,互不相干,是不是可以在CLASS1里用几个THREADS来实现,每个THREAD控制一个电梯的MOVEMENT,或是有别的好方法?多谢!
-lxz(flyer);
2002-2-21
(#375741@0)
-
yeah, class1 must be muliti-thread
-macsym(日进斗斤);
2002-2-21
(#375747@0)
-
you are so warm-hearted,macsym.another question: do you think three classes is enough for this system(CLASS1, CLASS2 plus another class for adminstrator)?
-lxz(flyer);
2002-2-21
(#375774@0)
-
plus elevator class
-macsym(日进斗斤);
2002-2-21
(#375777@0)
-
but i think CLASS2 is controller and CLASS1 is elevator, or maybe i should be a scheduler? the "elevator class" you mentioned here should include what kind of attributes and methods?
-lxz(flyer);
2002-2-21
(#375786@0)
-
my picture: elevator class, administrator class(muliti-thread), client class(to response and forward request).
-macsym(日进斗斤);
2002-2-21
(#375796@0)
-
forgot it, it's wrong. let me think it
-macsym(日进斗斤);
2002-2-21
(#375801@0)
-
there are two kinds of request, one is outside elevators, the other is inside each elevator, should i combine these two requests inot one class? look forword to your reply.
-lxz(flyer);
2002-2-21
(#375811@0)
-
no, that's diffirent .
-macsym(日进斗斤);
2002-2-21
(#375818@0)
-
so maybe i can use the controller class i mentioned above to respond the outside requests and add a elevator class you mentioned before to deal with inside requests and forowrd them to scheduler class?
-lxz(flyer);
2002-2-21
(#375826@0)
-
you are right!
-macsym(日进斗斤);
2002-2-21
(#375813@0)
-
? i am confused. at what point i am right?
-lxz(flyer);
2002-2-21
(#375821@0)
-
I need more detail about it, do you have a description about it?
-macsym(日进斗斤);
2002-2-21
(#375853@0)
-
here is the description:
-lxz(flyer);
2002-2-21
{669}
(#375968@0)
-
hi, macsym. busy or just mad at my stupid question? anyway, thank for your help and would appreciate your further reply.
-lxz(flyer);
2002-2-21
(#375887@0)
-
CLASS2 is controller and CLASS1 is elevator,
-macsym(日进斗斤);
2002-2-21
(#375862@0)
-
hi, macsym, where are you, away. offline, busy, or just mad at my stupid question? anyway, thank fou your help and also wait for your futher reply.
-lxz(flyer);
2002-2-21
(#375881@0)
-
CLASS2 is controller and CLASS1 is elevator(maybe thread or threadGroup)
-macsym(日进斗斤);
2002-2-21
(#375901@0)
-
"maybe thread or threadGroup"? so you mean i even don't need thread? and also, only these 2 class is enough?
-lxz(flyer);
2002-2-21
(#375974@0)
-
I think you can get some idea from MVC pattern.Class1 is represent the state of elevator and implement obserable interface. Class2 is a Viewer and Controller responsible for display and control elevator implement observor interface. so the system is more clear.
-redriver(redriver);
2002-2-21
{214}
(#375920@0)
-
do i have to learn MVC pattern? to design the whole system, write related documents(such as SDD) for submmission, and learn java already almost exaust me.
-lxz(flyer);
2002-2-21
(#375989@0)