train
callrequestArrival
to enter station.mediator
will check availability of the station ,when station is vacant thetrain
will be allowed to enter otherwise has to queue.- When the occupying train leaves station the
mediator
will notify the first train in thetrainQueue
to enter the station by callingpermitArrival()
. mediator
contains lock means only one ofcanLand
andnotifyFree
can be called at a time.