blob: c5e9f672e93041a3d9e3e7465f232667d196b37d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
module AccessPointsHelper
def access_links_pairs(access_links)
hpairs = Hash.new
pairs = Array.new
access_links.each do |link|
key = pair_key(link)
pair = nil
if (hpairs.has_key? key)
pair = hpairs[key]
else
pair = AccessLinkPair.new
pairs << pair
hpairs[key] = pair
end
if (link.link_orientation_type == "access_point_to_stop_area")
pair.from_access_point = link
else
pair.to_access_point = link
end
end
pairs
end
def pair_key(access_link)
"#{access_link.access_point.id}-#{access_link.stop_area.id}"
end
end
|