1. We call connectionSearch.search("stopA", "stopB", 1) 2. connectionSearch calls stops.setStartingStop("stopA", 1) 3. stops may need to create stopA instance 4. stops calls stopA.updateReachableAt(1, null) 5. stopA changes its internal state and returns 6. stops returns 7. connectionSearch calls stops.getLines("stopA") 8. stops call stopA.getLines() 9. stopA returns ["1", "2"] 10.stops returns ["1", "2"] 11.connectionSearch calls lines.updateReachable(["1", "2"], "StopA") 12.lines may need to create line1, line2 objects and lineSegments objects 13.lines calls line1.updateReachable("stopA") 14.line1 finds out that first stop is not "stopA" 15.line1 finds that there is time 10 in starting times 16.line1 calls linesegments[0].nextStop(10) and gets (15, "stopA") 17.line1 calls linesegments[1].nextStopAndUpdateReachable(15) 18.linesegment confirm it has capactity and calls nextStop.updateReachableAt this changes reachability at "StopZ" to 19 via "1". 19.linesegment returns (19, "StopZ", true). The last element of the tuple would be false if there was no capacity. 20.line1 finds out that there are no more linesegments. 21.line1 tires if a bus that starts earlier could be used, but finds out that there is no such bus and returns. 22.lines calls line2.updateReachable("stopA") 23.Similar interaction between lines and line2 occours. 24.lines returns 25.connectionSearch calls stops.earliestReachableAfter(1) and the return value is ("StopZ", 19) 26.connectionSearch calls stops.getLines("stopZ") and gets ["3"] 27.connectionSearch calls lines.updateReachable(["3"], "StopZ"). This interaction updates that "StopB" is reachable on time 28, via "3" 28.connectionSearch finds that stopB is stops.earliestReachableAfter(15). Thus optimal connection is found. 29.connectionSearch finds how "stopB" was reached using stops.getReachableAt("StopB"). result is (28, "3") 30.connectionSearch calls lines.updateCapacityAndGetPreviousStop("3", "StopB", 28) which find out used line segments updates their capacity and returns "StopZ". 31.connectionSearch finds how "stopZ" was reached using stops.getReachableAt("StopZ"). result is (19, "1") 32.connectionSearch calls lines.updateCapacityAndGetPreviousStop("1", "StopZ", 19) which find out used line segments updates their capacity and returns "StopA". 33.connectionSearch calls clean methods to clean temporary search data (in db, we just persist the capacity changes and destroy the objects)