State Diagram: TOP:checkfornextcomingtrain