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
- -- WHY: Why is it not printing..
- console.output ("Calculating...!")
- ---------------------------------
- highlight_reachable (s, 120)
- console.output ("Done!")
- end
- feature {NONE} -- Implementation
- highlight_reachable (s: STATION; t: REAL_64)
- -- Highight stations reachable from `s' within `t' seconds.
- require
- station_exists: s /= Void
- do
- -- WHY: Why is it not printing..
- console.output ("Calculating...! Please be patient.")
- --------------------------------
- across
- s.lines as i
- loop
- -- Highlight the current station
- if
- not zurich_map.station_view (s).is_highlighted
- then
- zurich_map.station_view (s).highlight
- end
- -- Go through the cases
- if
- i.item.north_terminal /= void and then i.item.next_station (s, i.item.north_terminal) /= void and then (i.item.distance (s, i.item.next_station (s, i.item.north_terminal)) / i.item.speed) <= t
- then
- highlight_reachable (i.item.next_station (s, i.item.north_terminal), t - (i.item.distance (s, i.item.next_station (s, i.item.north_terminal)) / i.item.speed))
- end
- if
- i.item.east_terminal /= void and then i.item.next_station (s, i.item.east_terminal) /= void and then (i.item.distance (s, i.item.next_station (s, i.item.east_terminal)) / i.item.speed) <= t
- then
- highlight_reachable (i.item.next_station (s, i.item.east_terminal), t - (i.item.distance (s, i.item.next_station (s, i.item.east_terminal)) / i.item.speed))
- end
- if
- i.item.south_terminal /= void and then i.item.next_station (s, i.item.south_terminal) /= void and then (i.item.distance (s, i.item.next_station (s, i.item.south_terminal)) / i.item.speed) <= t
- then
- highlight_reachable (i.item.next_station (s, i.item.south_terminal), t - (i.item.distance (s, i.item.next_station (s, i.item.south_terminal)) / i.item.speed))
- end
- if
- i.item.west_terminal /= void and then i.item.next_station (s, i.item.west_terminal) /= void and then (i.item.distance (s, i.item.next_station (s, i.item.west_terminal)) / i.item.speed) <= t
- then
- highlight_reachable (i.item.next_station (s, i.item.west_terminal), t - (i.item.distance (s, i.item.next_station (s, i.item.west_terminal)) / i.item.speed))
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement