Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / September 2005

Tip: Looking for answers? Try searching our database.

intersection model with threads problem

Thread view: 
zaebos@gmail.com - 11 Sep 2005 23:16 GMT
X-No-Archive
Hello,

I am trying to learn java threads, and to attempt an exercise from my
textbook, hwever I am not sure if any of my proposed solutions are in
the right vein...

The problem is to model an intersection with trafficlights and 2
sensors at each trafficlight, one for arriving and entering, and one
for exiting..., and cars as threads.

the time the car stays in for, the length of time it takes the lights
to switch colors, and the number of cars must all be definable and easy
to change..

I was consiering having each car as a thread, and sensors and
trafficlights as a monitors, when a sensor detects a car arriving, it
notifies the trafficlight to change, and trafficlight will block or
allow the car thread to run, ie enter or leave...

I'm not sure if I am even on the right track, and can not find any
example solutions to this problem, so if anyone has any idea I would be
very gratefull

Thanks,
Jason
blmblm@myrealbox.com - 13 Sep 2005 16:03 GMT
>X-No-Archive
>Hello,
[quoted text clipped - 6 lines]
>sensors at each trafficlight, one for arriving and entering, and one
>for exiting..., and cars as threads.

[ snip ]

I notice that you posted essentially the same question in
comp.java.lang.programmer.  If you're going to do this (post the
same question in two newsgroups), might I suggest that you crosspost?
As it is now, people who don't read both newsgroups will only see
one set of replies and may duplicate something that has already been
said in the other newsgroup.  With crossposting that wouldn't happen.

(I guess this might be a "YMMV", since there are those who frown on
crossposting.  But in this kind of situation I think it makes sense.)

| B. L. Massingill
| ObDisclaimer:  I don't speak for my employers; they return the favor.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.