| 1 | package Travel::Status::DE::HAFAS::Journey; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # vim:foldmethod=marker | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 5 | ▶ | use 5.014; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 5 | ▶ | use parent 'Class::Accessor'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 5 | ▶ | use DateTime::Format::Strptime; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 5 | ▶ | use List::Util qw(any uniq); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 5 | ▶ | use Travel::Status::DE::HAFAS::Stop; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 5 | our $VERSION = '6.15'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 5 | Travel::Status::DE::HAFAS::Journey->mk_ro_accessors( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | qw(datetime sched_datetime rt_datetime tz_offset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | is_additional is_cancelled is_partially_cancelled | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | station station_eva platform sched_platform rt_platform operator | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | product product_at | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | id name type type_long class number line line_no load delay | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | route_end route_start origin destination direction) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | # {{{ Constructor | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 34 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=50 SCAR=51.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 34 | my ( $obj, %opt ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 34 | ▶ | my @icoL = @{ $opt{common}{icoL} // [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$opt{"common"}{"icoL"} // []
MC/DC0%0/1
$opt{"common"}{"icoL"} // []
$opt{"common"}{"icoL"}
Truth table50%1/2
A
A= $opt{"common"}{"icoL"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 34 | ▶ | my @tcocL = @{ $opt{common}{tcocL} // [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$opt{"common"}{"tcocL"} // []
MC/DC100%1/1
$opt{"common"}{"tcocL"} // []
$opt{"common"}{"tcocL"}
Truth table100%2/2
A
A= $opt{"common"}{"tcocL"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 34 | ▶ | my @remL = @{ $opt{common}{remL} // [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$opt{"common"}{"remL"} // []
MC/DC0%0/1
$opt{"common"}{"remL"} // []
$opt{"common"}{"remL"}
Truth table50%1/2
A
A= $opt{"common"}{"remL"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 34 | ▶ | my @himL = @{ $opt{common}{himL} // [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$opt{"common"}{"himL"} // []
MC/DC0%0/1
$opt{"common"}{"himL"} // []
$opt{"common"}{"himL"}
Truth table50%1/2
A
A= $opt{"common"}{"himL"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 34 | my $prodL = $opt{prodL}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 34 | my $locL = $opt{locL}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 34 | my $hafas = $opt{hafas}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 34 | my $journey = $opt{journey}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 34 | ▶ | my $date = $opt{date} // $journey->{date}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$opt{"date"} // $journey->{"date"}
MC/DC0%0/2
$opt{"date"} // $journey->{"date"}
$opt{"date"}
$journey->{"date"}
Truth table33%1/3
A // B
A= $opt{"date"}B= $journey->{"date"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 34 | my $direction = $journey->{dirTxt}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 34 | my $jid = $journey->{jid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 34 | my $is_cancelled = $journey->{isCncl}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 34 | my $partially_cancelled = $journey->{isPartCncl}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 34 | my $product = $prodL->[ $journey->{prodX} ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 34 | my @messages; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 34 | ▶ | for my $msg ( @{ $journey->{msgL} // [] } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$journey->{"msgL"} // []
MC/DC100%1/1
$journey->{"msgL"} // []
$journey->{"msgL"}
Truth table100%2/2
A
A= $journey->{"msgL"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 25 | ▶ | if ( $msg->{type} eq 'REM' and defined $msg->{remX} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$msg->{"type"} eq "REM" and defined $msg->{"remX"}
MC/DC0%0/2
$msg->{"type"} eq "REM" and defined $msg->{"remX"}
$msg->{"type"} eq "REM"
defined $msg->{"remX"}
Truth table33%1/3
A and B
A= $msg->{"type"} eq "REM"B= defined $msg->{"remX"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 25 | push( @messages, $hafas->add_message( $remL[ $msg->{remX} ] ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | ▶ | elsif ( $msg->{type} eq 'HIM' and defined $msg->{himX} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$msg->{"type"} eq "HIM" and defined $msg->{"himX"}
MC/DC0%0/2
$msg->{"type"} eq "HIM" and defined $msg->{"himX"}
$msg->{"type"} eq "HIM"
defined $msg->{"himX"}
Truth table0%0/3
A and B
A= $msg->{"type"} eq "HIM"B= defined $msg->{"himX"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | push( @messages, $hafas->add_message( $himL[ $msg->{himX} ], 1 ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | say "Unknown message type $msg->{type}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 34 | my $datetime_ref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 34 | ▶ | if ( @{ $journey->{stopL} // [] } or $journey->{stbStop} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition40%2/5
@{$journey->{"stopL"} // [];} or $journey->{"stbStop"}
$journey->{"stopL"} // []
MC/DC0%0/2
@{$journey->{"stopL"} // [];} or $journey->{"stbStop"}
@{$journey->{"stopL"} // [];}
$journey->{"stbStop"}
MC/DC0%0/1
$journey->{"stopL"} // []
$journey->{"stopL"}
Truth table33%1/3
A or B
A= @{$journey->{"stopL"} // [];}B= $journey->{"stbStop"}
Truth table50%1/2
A
A= $journey->{"stopL"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 34 | my ( $date_ref, $parse_fmt ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 34 | ▶ | if ( $jid =~ /#/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | # modern trip ID, used e.g. by DB and ÖBB | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | $date_ref = ( split( /#/, $jid ) )[12]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | $parse_fmt = '%d%m%y'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | if ( length($date_ref) < 5 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | warn( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | "HAFAS, not even once -- midnight crossing may be bogus -- date_ref $date_ref" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | elsif ( length($date_ref) == 5 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | $date_ref = "0${date_ref}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | # old (legacy?) trip ID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 34 | $date_ref = ( split( qr{[|]}, $jid ) )[4]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 34 | $parse_fmt = '%d%m%Y'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 34 | ▶ | if ( length($date_ref) < 7 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | warn( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | "HAFAS, not even once -- midnight crossing may be bogus -- date_ref $date_ref" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | elsif ( length($date_ref) == 7 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 30 | $date_ref = "0${date_ref}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | $datetime_ref = DateTime::Format::Strptime->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | pattern => $parse_fmt, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | time_zone => $hafas->get_active_service->{time_zone} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 34 | ▶ | // 'Europe/Berlin' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$hafas->get_active_service->{"time_zone"} // "Europe/Berlin"
MC/DC0%0/1
$hafas->get_active_service->{"time_zone"} // "Europe/Berlin"
$hafas->get_active_service->{"time_zone"}
Truth table50%1/2
A
A= $hafas->get_active_service->{"time_zone"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | )->parse_datetime($date_ref); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 34 | my @stops; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | my $route_end; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 34 | ▶ | for my $stop ( @{ $journey->{stopL} // [] } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$journey->{"stopL"} // []
MC/DC0%0/1
$journey->{"stopL"} // []
$journey->{"stopL"}
Truth table50%1/2
A
A= $journey->{"stopL"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 438 | my $loc = $locL->[ $stop->{locX} ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | my $stopref = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | loc => $loc, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | stop => $stop, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | common => $opt{common}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 438 | prodL => $prodL, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | hafas => $hafas, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | date => $date, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | datetime_ref => $datetime_ref, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 438 | push( @stops, $stopref ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 438 | $route_end = $loc->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 34 | ▶ | if ( $journey->{stbStop} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 30 | ▶ | if ( $hafas->{arrivals} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | $route_end = $stops[0]->{name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | pop(@stops); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 30 | shift(@stops); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 34 | ▶ | my $ref = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$route_end // $direction
MC/DC0%0/2
$route_end // $direction
$route_end
$direction
Truth table33%1/3
A // B
A= $route_endB= $direction
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | id => $jid, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | product => $product, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | name => $product->name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | number => $product->number, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | line => $product->name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | line_no => $product->line_no, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | type => $product->type, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | type_long => $product->type_long, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | class => $product->class, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | operator => $product->operator, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | direction => $direction, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | is_cancelled => $is_cancelled, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | is_partially_cancelled => $partially_cancelled, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | route_end => $route_end // $direction, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | messages => \@messages, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | route => \@stops, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 34 | ▶ | if ( $journey->{stbStop} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 30 | ▶ | if ( $hafas->{arrivals} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | $ref->{origin} = $ref->{route_end}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | $ref->{is_cancelled} ||= $journey->{stbStop}{aCncl}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$ref->{"is_cancelled"} ||= $journey->{"stbStop"}{"aCncl"}
MC/DC0%0/2
$ref->{"is_cancelled"} ||= $journey->{"stbStop"}{"aCncl"}
$ref->{"is_cancelled"}
$journey->{"stbStop"}{"aCncl"}
Truth table0%0/3
A ||= B
A= $ref->{"is_cancelled"}B= $journey->{"stbStop"}{"aCncl"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 30 | $ref->{destination} = $ref->{route_end}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 30 | ▶ | $ref->{is_cancelled} ||= $journey->{stbStop}{dCncl}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$ref->{"is_cancelled"} ||= $journey->{"stbStop"}{"dCncl"}
MC/DC50%1/2
$ref->{"is_cancelled"} ||= $journey->{"stbStop"}{"dCncl"}
$ref->{"is_cancelled"}
$journey->{"stbStop"}{"dCncl"}
Truth table66%2/3
A ||= B
A= $ref->{"is_cancelled"}B= $journey->{"stbStop"}{"dCncl"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 30 | $ref->{is_additional} = $journey->{stbStop}{isAdd}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | ▶ | elsif ( $stops[0] and $stops[0]{loc} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$stops[0] and $stops[0]{"loc"}
MC/DC0%0/2
$stops[0] and $stops[0]{"loc"}
$stops[0]
$stops[0]{"loc"}
Truth table33%1/3
A and B
A= $stops[0]B= $stops[0]{"loc"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 4 | $ref->{route_start} = $stops[0]{loc}->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 34 | bless( $ref, $obj ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 34 | ▶ | if ( $journey->{stbStop} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 30 | $ref->{station} = $locL->[ $journey->{stbStop}{locX} ]->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 30 | $ref->{station_eva} = 0 + $locL->[ $journey->{stbStop}{locX} ]->eva; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | $ref->{sched_platform} = $journey->{stbStop}{dPlatfS} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 30 | ▶ | // $journey->{stbStop}{dPltfS}{txt}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$journey->{"stbStop"}{"dPlatfS"} // $journey->{"stbStop"}{"dPltfS"}{"txt"}
MC/DC50%1/2
$journey->{"stbStop"}{"dPlatfS"} // $journey->{"stbStop"}{"dPltfS"}{"txt"}
$journey->{"stbStop"}{"dPlatfS"}
$journey->{"stbStop"}{"dPltfS"}{"txt"}
Truth table66%2/3
A // B
A= $journey->{"stbStop"}{"dPlatfS"}B= $journey->{"stbStop"}{"dPltfS"}{"txt"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | $ref->{rt_platform} = $journey->{stbStop}{dPlatfR} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 30 | ▶ | // $journey->{stbStop}{dPltfR}{txt}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$journey->{"stbStop"}{"dPlatfR"} // $journey->{"stbStop"}{"dPltfR"}{"txt"}
MC/DC0%0/2
$journey->{"stbStop"}{"dPlatfR"} // $journey->{"stbStop"}{"dPltfR"}{"txt"}
$journey->{"stbStop"}{"dPlatfR"}
$journey->{"stbStop"}{"dPltfR"}{"txt"}
Truth table33%1/3
A // B
A= $journey->{"stbStop"}{"dPlatfR"}B= $journey->{"stbStop"}{"dPltfR"}{"txt"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 30 | ▶ | $ref->{platform} = $ref->{rt_platform} // $ref->{sched_platform}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$ref->{"rt_platform"} // $ref->{"sched_platform"}
MC/DC50%1/2
$ref->{"rt_platform"} // $ref->{"sched_platform"}
$ref->{"rt_platform"}
$ref->{"sched_platform"}
Truth table66%2/3
A // B
A= $ref->{"rt_platform"}B= $ref->{"sched_platform"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | my $datetime_s = Travel::Status::DE::HAFAS::Stop::handle_day_change( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | $ref, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | input => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | $journey->{stbStop}{ $hafas->{arrivals} ? 'aTimeS' : 'dTimeS' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | offset => $journey->{stbStop}{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | $hafas->{arrivals} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | ? 'aTZOffset' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | : 'dTZOffset' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | date => $date, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | strp_obj => $hafas->{strptime_obj}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 30 | ▶ | ref => $datetime_ref, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | my $datetime_r = Travel::Status::DE::HAFAS::Stop::handle_day_change( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | $ref, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | input => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | $journey->{stbStop}{ $hafas->{arrivals} ? 'aTimeR' : 'dTimeR' }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | offset => $journey->{stbStop}{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | $hafas->{arrivals} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | ? 'aTZOffset' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | : 'dTZOffset' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | date => $date, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | strp_obj => $hafas->{strptime_obj}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 30 | ▶ | ref => $datetime_ref, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 30 | ▶ | my $delay | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | = $datetime_r | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | ? ( $datetime_r->epoch - $datetime_s->epoch ) / 60 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 30 | $ref->{sched_datetime} = $datetime_s; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 30 | $ref->{rt_datetime} = $datetime_r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 30 | ▶ | $ref->{datetime} = $datetime_r // $datetime_s; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$datetime_r // $datetime_s
MC/DC0%0/2
$datetime_r // $datetime_s
$datetime_r
$datetime_s
Truth table66%2/3
A // B
A= $datetime_rB= $datetime_s
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 30 | $ref->{delay} = $delay; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 30 | ▶ | if ( $ref->{delay} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 2 | $ref->{datetime} = $ref->{rt_datetime}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 28 | $ref->{datetime} = $ref->{sched_datetime}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 30 | my %tco; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 30 | ▶ | for my $tco_id ( @{ $journey->{stbStop}{dTrnCmpSX}{tcocX} // [] } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$journey->{"stbStop"}{"dTrnCmpSX"}{"tcocX"} // []
MC/DC0%0/1
$journey->{"stbStop"}{"dTrnCmpSX"}{"tcocX"} // []
$journey->{"stbStop"}{"dTrnCmpSX"}{"tcocX"}
Truth table50%1/2
A
A= $journey->{"stbStop"}{"dTrnCmpSX"}{"tcocX"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | my $tco_kv = $tcocL[$tco_id]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | # BVG has rRT (real-time?) and r (prognosed?); others only have r | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | ▶ | my $load = $tco_kv->{rRT} // $tco_kv->{r}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$tco_kv->{"rRT"} // $tco_kv->{"r"}
MC/DC0%0/2
$tco_kv->{"rRT"} // $tco_kv->{"r"}
$tco_kv->{"rRT"}
$tco_kv->{"r"}
Truth table0%0/3
A // B
A= $tco_kv->{"rRT"}B= $tco_kv->{"r"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | # BVG uses 11 .. 13 rather than 1 .. 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | if ( defined $load and $load > 10 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $load and $load > 10
MC/DC0%0/2
defined $load and $load > 10
defined $load
$load > 10
Truth table0%0/3
A and B
A= defined $loadB= $load > 10
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | $load -= 10; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | $tco{ $tco_kv->{c} } = $load; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 30 | ▶ | if (%tco) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | $ref->{load} = \%tco; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 34 | ▶ | if ( $opt{polyline} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 3 | $ref->{polyline} = $opt{polyline}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 34 | return $ref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | # }}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | # {{{ Accessors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | # Legacy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | ▶ | sub station_uic { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
station_uic: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | return $self->{station_eva}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 5 | ▶ | sub is_changed_platform { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_changed_platform: called CC=5 SCAR=23.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 5 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 5 | ▶ | if ( defined $self->{rt_platform} and defined $self->{sched_platform} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $self->{"rt_platform"} and defined $self->{"sched_platform"}
MC/DC0%0/2
defined $self->{"rt_platform"} and defined $self->{"sched_platform"}
defined $self->{"rt_platform"}
defined $self->{"sched_platform"}
Truth table33%1/3
A and B
A= defined $self->{"rt_platform"}B= defined $self->{"sched_platform"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | ▶ | if ( $self->{rt_platform} ne $self->{sched_platform} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 5 | ▶ | if ( defined $self->{rt_platform} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 5 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 2 | ▶ | sub messages { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
messages: called CC=2 SCAR=7.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 2 | ▶ | if ( $self->{messages} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 2 | return @{ $self->{messages} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | ▶ | sub operators { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
operators: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | ▶ | if ( $self->{operators} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | return @{ $self->{operators} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | $self->{operators} = [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | ▶ | uniq map { ( $_->prod_arr // $_->prod_dep )->operator } grep { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$_->prod_arr // $_->prod_dep
MC/DC0%0/2
$_->prod_arr // $_->prod_dep
$_->prod_arr
$_->prod_dep
Truth table0%0/3
A // B
A= $_->prod_arrB= $_->prod_dep
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | ▶ | ( $_->prod_arr or $_->prod_dep ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/9
($_->prod_arr || $_->prod_dep) && ($_->prod_arr // $_->prod_dep)->operator
$_->prod_arr or $_->prod_dep
$_->prod_arr // $_->prod_dep
MC/DC0%0/3
($_->prod_arr || $_->prod_dep) && ($_->prod_arr // $_->prod_dep)->operator
$_->prod_arr
$_->prod_dep
($_->prod_arr // $_->prod_dep)->operator
MC/DC0%0/2
$_->prod_arr // $_->prod_dep
$_->prod_arr
$_->prod_dep
Truth table0%0/5
A or B && C
A= $_->prod_arrB= $_->prod_depC= ($_->prod_arr // $_->prod_dep)->operator
Truth table0%0/3
A // B
A= $_->prod_arrB= $_->prod_dep
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | and ( $_->prod_arr // $_->prod_dep )->operator | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | } $self->route | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | return @{ $self->{operators} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | ▶ | sub polyline { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
polyline: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | ▶ | if ( $self->{polyline} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | return @{ $self->{polyline} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 215 | ▶ | sub route { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
route: called CC=5 SCAR=16.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 215 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 215 | ▶ | if ( $self->{route} and @{ $self->{route} } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"route"} and @{$self->{"route"};}
MC/DC0%0/2
$self->{"route"} and @{$self->{"route"};}
$self->{"route"}
@{$self->{"route"};}
Truth table33%1/3
A and B
A= $self->{"route"}B= @{$self->{"route"};}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 215 | ▶ | if ( $self->{route}[0] and $self->{route}[0]{stop} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"route"}[0] and $self->{"route"}[0]{"stop"}
MC/DC50%1/2
$self->{"route"}[0] and $self->{"route"}[0]{"stop"}
$self->{"route"}[0]
$self->{"route"}[0]{"stop"}
Truth table66%2/3
A and B
A= $self->{"route"}[0]B= $self->{"route"}[0]{"stop"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | $self->{route} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 85 | = [ map { Travel::Status::DE::HAFAS::Stop->new( %{$_} ) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 7 | @{ $self->{route} } ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 215 | return @{ $self->{route} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 18 | ▶ | sub route_interesting { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
route_interesting: called CC=17 SCAR=29.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 18 | my ( $self, $max_parts ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 18 | my @via = $self->route; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 18 | my ( @via_main, @via_show, $last_stop ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 18 | ▶ | $max_parts //= 3; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$max_parts //= 3
MC/DC0%0/1
$max_parts //= 3
$max_parts
Truth table50%1/2
A
A= $max_parts
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | # Centraal: dutch main station (Hbf in .nl) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | # HB: swiss main station (Hbf in .ch) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | # hl.n.: czech main station (Hbf in .cz) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 18 | for my $stop (@via) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 232 | ▶ | if ( $stop->loc->name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | =~ m{ HB $ | hl\.n\. $ | Hbf | Hauptbahnhof | Bf | Bahnhof | Centraal | Flughafen }x | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 84 | push( @via_main, $stop ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 18 | $last_stop = pop(@via); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 18 | ▶ | if ( @via_main and $via_main[-1]->loc->name eq $last_stop->loc->name ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@via_main and $via_main[-1]->loc->name eq $last_stop->loc->name
MC/DC100%2/2
@via_main and $via_main[-1]->loc->name eq $last_stop->loc->name
@via_main
$via_main[-1]->loc->name eq $last_stop->loc->name
Truth table100%3/3
A and B
A= @via_mainB= $via_main[-1]->loc->name eq $last_stop->loc->name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 6 | pop(@via_main); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 18 | ▶ | if ( @via and $via[-1]->loc->name eq $last_stop->loc->name ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@via and $via[-1]->loc->name eq $last_stop->loc->name
MC/DC0%0/2
@via and $via[-1]->loc->name eq $last_stop->loc->name
@via
$via[-1]->loc->name eq $last_stop->loc->name
Truth table33%1/3
A and B
A= @viaB= $via[-1]->loc->name eq $last_stop->loc->name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | pop(@via); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 18 | ▶ | if ( @via_main and @via and $via[0]->loc->name eq $via_main[0]->loc->name ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
@via_main and @via and $via[0]->loc->name eq $via_main[0]->loc->name
@via_main and @via
MC/DC66%2/3
@via_main and @via and $via[0]->loc->name eq $via_main[0]->loc->name
@via_main
@via
$via[0]->loc->name eq $via_main[0]->loc->name
Truth table75%3/4
A and B and C
A= @via_mainB= @viaC= $via[0]->loc->name eq $via_main[0]->loc->name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 6 | shift(@via_main); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 18 | ▶ | if ( @via < $max_parts ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 2 | @via_show = @via; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 16 | ▶ | if ( @via_main >= $max_parts ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 4 | @via_show = ( $via[0] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 12 | @via_show = splice( @via, 0, $max_parts - @via_main ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 16 | ▶ | while ( @via_show < $max_parts and @via_main ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@via_show < $max_parts and @via_main
MC/DC50%1/2
@via_show < $max_parts and @via_main
@via_show < $max_parts
@via_main
Truth table66%2/3
A and B
A= @via_show < $max_partsB= @via_main
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 12 | my $stop = shift(@via_main); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 12 | ▶ | if ( any { $_->loc->name eq $stop->loc->name } @via_show | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.8
Branch: 1 branch
Condition33%1/3
&any(sub {
$_->loc->name eq $stop->loc->name;
}
, @via_show) or $stop->loc->name eq $last_stop->loc->name
MC/DC0%0/2
&any(sub {
$_->loc->name eq $stop->loc->name;
}
, @via_show) or $stop->loc->name eq $last_stop->loc->name
&any(sub {
$_->loc->name eq $stop->loc->name;
}
, @via_show)
$stop->loc->name eq $last_stop->loc->name
Truth table33%1/3
A or B
A= &any(sub {
$_->loc->name eq $stop->loc->name;
}
, @via_show)B= $stop->loc->name eq $last_stop->loc->name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | or $stop->loc->name eq $last_stop->loc->name ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 12 | push( @via_show, $stop ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 18 | return @via_show; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | ▶ | sub product_at { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
product_at: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | my ( $self, $req_stop ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | for my $stop ( $self->route ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | ▶ | if ( $stop->loc->name eq $req_stop or $stop->loc->eva eq $req_stop ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$stop->loc->name eq $req_stop or $stop->loc->eva eq $req_stop
MC/DC0%0/2
$stop->loc->name eq $req_stop or $stop->loc->eva eq $req_stop
$stop->loc->name eq $req_stop
$stop->loc->eva eq $req_stop
Truth table0%0/3
A or B
A= $stop->loc->name eq $req_stopB= $stop->loc->eva eq $req_stop
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | ▶ | return $stop->prod_dep // $stop->prod_arr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$stop->prod_dep // $stop->prod_arr
MC/DC0%0/2
$stop->prod_dep // $stop->prod_arr
$stop->prod_dep
$stop->prod_arr
Truth table0%0/3
A // B
A= $stop->prod_depB= $stop->prod_arr
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | ▶ | sub TO_JSON { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
TO_JSON: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | my $ret = { %{$self} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | for my $k ( keys %{$ret} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | ▶ | if ( ref( $ret->{$k} ) eq 'DateTime' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | $ret->{$k} = $ret->{$k}->epoch; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | $ret->{route} = [ map { $_->TO_JSON } $self->route ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | return $ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | # }}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 5 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||