Couple things......when you see a situation as such, watch the front wheel of the vehicle for any movement......slow down and listen to your instincts.
I did one day riding to work, because I saw a situation that was ripe for a accident, involving a transit bus, which had pulled over to the stop, prior to a intersection, flashers on, opposite direction from which I traveled.
I saw a SUV coming up to that intersection, on the side street, wanting to get on to the main road I was traveling on, at a little to fast than normal....
I knew he wanted to roll through that stop to beat the LONG line of traffic that was behind me, commuters going to work after getting off the ferry, a LONG line that will keep this SUV pinned until they ALL passed.
About that moment the bus pulled away, I knew I could not make my left hand turn now, onto the lane the SUV was wanting to exit, in front of the bus.
It just moved away, the driver looking into its rear side mirror, never forward into its line of travel yet. She would have hit me in the process of my turn.....
I knew then that the SUV driver was sure to hit the gas and pull out ASAP the second the bus passed, and that would be RIGHT INTO ME as I would come into view way too late....
So, I abandoned that spot, and moved up past my turn.....
Sure enough, it went down just like that....
I would have been hit if I had made my legal turn in front of a parked bus, when the driver changed the scenario on me by their actions, or the SUV.....
I just hung a quick U, went back and now made a right hand turn on the street I wanted.
Then I crashed my bike trying to pat myself on my back

Its part of the game....let it go ASAP.....
Keep your mind occupied on the moment, not the past, its over, and you need all your resources to avoid the next one.