line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
5
|
use Map::Metro::Standard::Moops; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
11
|
|
2
|
1
|
|
|
1
|
|
2412
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
51
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.2300'; # VERSION |
6
|
|
|
|
|
|
|
# PODNAME: Map::Metro::Graph::Route |
7
|
|
|
|
|
|
|
# ABSTRACT: A sequence of line stations |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
1580
|
class Map::Metro::Graph::Route { |
|
1
|
|
|
1
|
|
35
|
|
|
1
|
|
|
1
|
|
6
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
69
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
279
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
62
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
51
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
149
|
|
|
1
|
|
|
|
|
37
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
4628
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
6723
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
4518
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
13
|
|
|
1
|
|
|
|
|
82
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
225
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
1304
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
6290
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
29
|
|
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
54
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
156
|
|
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
5356
|
|
|
1
|
|
|
|
|
20
|
|
|
1
|
|
|
|
|
157
|
|
|
0
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
|
|
16
|
has steps => ( |
12
|
|
|
|
|
|
|
is => 'ro', |
13
|
|
|
|
|
|
|
isa => ArrayRef[ Step ], |
14
|
|
|
|
|
|
|
traits => ['Array'], |
15
|
|
|
|
|
|
|
predicate => 1, |
16
|
|
|
|
|
|
|
handles => { |
17
|
|
|
|
|
|
|
add_step => 'push', |
18
|
|
|
|
|
|
|
step_count => 'count', |
19
|
|
|
|
|
|
|
get_step => 'get', |
20
|
|
|
|
|
|
|
all_steps => 'elements', |
21
|
|
|
|
|
|
|
filter_steps => 'grep', |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
has id => ( |
25
|
|
|
|
|
|
|
is => 'ro', |
26
|
|
|
|
|
|
|
isa => Str, |
27
|
|
|
|
|
|
|
init_arg => undef, |
28
|
0
|
|
|
|
|
0
|
default => sub { join '' => map { ('a'..'z', 2..9)[int rand 33] } (1..8) }, |
|
0
|
|
|
|
|
0
|
|
29
|
1
|
|
|
|
|
253307
|
); |
30
|
1
|
|
|
|
|
4600
|
has line_stations => ( |
31
|
|
|
|
|
|
|
is => 'ro', |
32
|
|
|
|
|
|
|
isa => ArrayRef[ LineStation ], |
33
|
|
|
|
|
|
|
traits => ['Array'], |
34
|
|
|
|
|
|
|
handles => { |
35
|
|
|
|
|
|
|
add_line_station => 'push', |
36
|
|
|
|
|
|
|
all_line_stations => 'elements', |
37
|
|
|
|
|
|
|
step => 'get', |
38
|
|
|
|
|
|
|
line_station_count => 'count', |
39
|
|
|
|
|
|
|
}, |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
1
|
0
|
|
1
|
|
16868
|
method weight { |
|
1
|
|
|
0
|
|
3
|
|
|
1
|
|
|
|
|
144
|
|
|
1
|
|
|
|
|
15204
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
return sum map { $_->weight } $self->all_steps; |
|
0
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
1
|
0
|
|
1
|
|
1252
|
method transfer_on_final_station { |
|
1
|
|
|
0
|
|
1
|
|
|
1
|
|
|
|
|
149
|
|
|
1
|
|
|
|
|
254
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
47
|
0
|
0
|
|
|
|
|
return 0 if $self->step_count < 2; |
48
|
0
|
|
|
|
|
|
my $final_step = $self->get_step(-1); |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
return $final_step->origin_line_station->station->id == $final_step->destination_line_station->station->id; |
51
|
|
|
|
|
|
|
} |
52
|
1
|
0
|
|
1
|
|
1271
|
method transfer_on_first_station { |
|
1
|
|
|
0
|
|
2
|
|
|
1
|
|
|
|
|
138
|
|
|
1
|
|
|
|
|
150
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
53
|
0
|
0
|
|
|
|
|
return 0 if $self->step_count < 2; |
54
|
0
|
|
|
|
|
|
my $first_step = $self->get_step(0); |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
return $first_step->origin_line_station->station->id == $first_step->destination_line_station->station->id; |
57
|
|
|
|
|
|
|
} |
58
|
1
|
0
|
|
1
|
|
1263
|
method longest_line_name_length { |
|
1
|
|
|
0
|
|
2
|
|
|
1
|
|
|
|
|
175
|
|
|
1
|
|
|
|
|
144
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
return length((sort { length $b->origin_line_station->line->name <=> length $a->origin_line_station->line->name } $self->all_steps)[0]->origin_line_station->line->name); |
|
0
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
__END__ |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=pod |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=encoding UTF-8 |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 NAME |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Map::Metro::Graph::Route - A sequence of line stations |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 VERSION |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Version 0.2300, released 2016-01-14. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 DESCRIPTION |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
A route is a specific sequence of L<Steps|Map::Metro::Graph::Step> from one L<LineStation|Map::Metro::Graph::LineStation> to another. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 METHODS |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head2 all_steps() |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Returns an array of the L<Steps|Map::Metro::Graph::Step> in the route, in the order they are travelled. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head2 weight() |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Returns an integer representing the total 'cost' of all L<Connections|Map::Metro::Graph::Connection> on this route. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 SOURCE |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
L<https://github.com/Csson/p5-Map-Metro> |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 HOMEPAGE |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
L<https://metacpan.org/release/Map-Metro> |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 AUTHOR |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Erik Carlsson <info@code301.com> |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This software is copyright (c) 2016 by Erik Carlsson. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
111
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=cut |