Say I Have rail objects named 1 to 6, and trains objects that are passing throw them. Each rail can have one train.
I Have Two Tracks for the trains (Are a sequence of rails) and the tracks can include same rails.
For example:
Track1 : Rail1 - Rail2 - Rail3 - Rail4
Track2 : Rail4 - Rail3 - Rail5 - Rail6
I'm thinking about making collection for each track, now the problem is how can i know to which Rail the train should continue with. If the train is now at Rail3 (in example), how can it know if it should continue with Rail4 or Rail5. I have a RailManagerClass And The Tracks Should Be stored at that class. what is the best way for storing ang managing the tracks? will a linkedList solve the problem?
Thank you.