Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- note
- description: "Short trips."
- class
- SHORT_TRIPS
- inherit
- ZURICH_OBJECTS
- feature -- Explore Zurich
- highlight_short_distance (s: STATION)
- -- Highlight stations reachable from `s' within 2 minutes.
- require
- station_exists: s /= Void
- do
- create checked_stations
- highlight_reachable (s, 120)
- end
- feature -- Access
- checked_stations: V_LINKED_STACK [STATION]
- feature {NONE} -- Implementation
- highlight_reachable (s: STATION; t: REAL_64)
- -- Highight stations reachable from `s' within `t' seconds.
- require
- station_exists: s /= Void
- local
- line: LINE
- next: STATION
- do
- if t >= 0.0 then
- Zurich_map.station_view (s).highlight
- checked_stations.extend (s)
- across
- s.lines as li
- loop
- line := li.item
- next := line.next_station (s, line.north_terminal)
- if next /= Void and then not checked_stations.has (next) then
- highlight_reachable (next, t - s.position.distance (next.position) / line.speed)
- end
- next := line.next_station (s, line.south_terminal)
- if next /= Void and then not checked_stations.has (next) then
- highlight_reachable (next, t - s.position.distance (next.position) / line.speed)
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement