| 1 | package Travel::Status::DE::IRIS::Result; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 7 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 7 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 7 | ▶ | use 5.014; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 7 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 7 | ▶ | use parent 'Class::Accessor'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 7 | ▶ | use Carp qw(cluck); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 7 | ▶ | use DateTime; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 7 | ▶ | use DateTime::Format::Strptime; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 7 | ▶ | use List::Compare; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 7 | ▶ | use List::Util qw(any); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 7 | ▶ | use List::MoreUtils qw(uniq lastval); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 7 | ▶ | use Scalar::Util qw(weaken); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | 7 | our $VERSION = '2.05'; | |||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 7 | Travel::Status::DE::IRIS::Result->mk_ro_accessors( | |||||||||||||||||||||||||||||||||||||||||
| 20 | qw(arrival arrival_delay arrival_has_realtime arrival_is_additional arrival_is_cancelled arrival_hidden | ||||||||||||||||||||||||||||||||||||||||||
| 21 | date datetime delay | ||||||||||||||||||||||||||||||||||||||||||
| 22 | departure departure_delay departure_has_realtime departure_is_additional departure_is_cancelled departure_hidden | ||||||||||||||||||||||||||||||||||||||||||
| 23 | ds100 has_realtime is_transfer is_unscheduled is_wing | ||||||||||||||||||||||||||||||||||||||||||
| 24 | line_no old_train_id old_train_no operator platform raw_id | ||||||||||||||||||||||||||||||||||||||||||
| 25 | realtime_xml route_start route_end | ||||||||||||||||||||||||||||||||||||||||||
| 26 | sched_arrival sched_departure sched_platform sched_route_start | ||||||||||||||||||||||||||||||||||||||||||
| 27 | sched_route_end start | ||||||||||||||||||||||||||||||||||||||||||
| 28 | station station_eva station_uic | ||||||||||||||||||||||||||||||||||||||||||
| 29 | stop_no time train_id train_no transfer type | ||||||||||||||||||||||||||||||||||||||||||
| 30 | unknown_t unknown_o wing_id wing_of) | ||||||||||||||||||||||||||||||||||||||||||
| 31 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | # {{{ Data (message codes, station fixups) | ||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | 7 | my %translation = ( | |||||||||||||||||||||||||||||||||||||||||
| 36 | 1 => 'Nähere Informationen in Kürze', | ||||||||||||||||||||||||||||||||||||||||||
| 37 | 2 => 'Polizeieinsatz', | ||||||||||||||||||||||||||||||||||||||||||
| 38 | 3 => 'Feuerwehreinsatz auf der Strecke', | ||||||||||||||||||||||||||||||||||||||||||
| 39 | 4 => 'Kurzfristiger Personalausfall', # xlsx: missing | ||||||||||||||||||||||||||||||||||||||||||
| 40 | 5 => 'Ärztliche Versorgung eines Fahrgastes', | ||||||||||||||||||||||||||||||||||||||||||
| 41 | 6 => 'Betätigen der Notbremse', # xlsx: "Unbefugtes Ziehen der Notbremse" | ||||||||||||||||||||||||||||||||||||||||||
| 42 | 7 => 'Unbefugte Personen auf der Strecke', | ||||||||||||||||||||||||||||||||||||||||||
| 43 | 8 => 'Notarzteinsatz auf der Strecke', | ||||||||||||||||||||||||||||||||||||||||||
| 44 | 9 => 'Streikauswirkungen', | ||||||||||||||||||||||||||||||||||||||||||
| 45 | 10 => 'Tiere auf der Strecke', | ||||||||||||||||||||||||||||||||||||||||||
| 46 | 11 => 'Unwetter', | ||||||||||||||||||||||||||||||||||||||||||
| 47 | 12 => 'Warten auf ein verspätetes Schiff', | ||||||||||||||||||||||||||||||||||||||||||
| 48 | 13 => 'Pass- und Zollkontrolle', | ||||||||||||||||||||||||||||||||||||||||||
| 49 | 14 => 'Defekt am Bahnhof', # xlsx: "Technischer Defekt am Bahnhof" | ||||||||||||||||||||||||||||||||||||||||||
| 50 | 15 => 'Beeinträchtigung durch Vandalismus', | ||||||||||||||||||||||||||||||||||||||||||
| 51 | 16 => 'Entschärfung einer Fliegerbombe', | ||||||||||||||||||||||||||||||||||||||||||
| 52 | 17 => 'Beschädigung einer Brücke', | ||||||||||||||||||||||||||||||||||||||||||
| 53 | 18 => 'Umgestürzter Baum auf der Strecke', | ||||||||||||||||||||||||||||||||||||||||||
| 54 | 19 => 'Unfall an einem Bahnübergang', | ||||||||||||||||||||||||||||||||||||||||||
| 55 | 20 => 'Tiere im Gleis', # xlsx: missing | ||||||||||||||||||||||||||||||||||||||||||
| 56 | 21 => 'Warten auf Anschlussreisende', | ||||||||||||||||||||||||||||||||||||||||||
| 57 | 22 => 'Witterungsbedingte Beeinträchtigungen', | ||||||||||||||||||||||||||||||||||||||||||
| 58 | 23 => 'Betriebsstabilisierung', # deleted as of 2025-12-14 | ||||||||||||||||||||||||||||||||||||||||||
| 59 | 24 => 'Verspätung im Ausland', | ||||||||||||||||||||||||||||||||||||||||||
| 60 | 25 => 'Bereitstellung weiterer Wagen', | ||||||||||||||||||||||||||||||||||||||||||
| 61 | 26 => 'Abhängen von Wagen', | ||||||||||||||||||||||||||||||||||||||||||
| 62 | 27 => 'Technische Störung am Bus', | ||||||||||||||||||||||||||||||||||||||||||
| 63 | 28 => 'Gegenstände auf der Strecke', | ||||||||||||||||||||||||||||||||||||||||||
| 64 | 29 => 'Ersatzverkehr mit Bus ist eingerichtet', | ||||||||||||||||||||||||||||||||||||||||||
| 65 | 30 => 'Personalausfall im Stellwerk', | ||||||||||||||||||||||||||||||||||||||||||
| 66 | 31 => 'Bauarbeiten', | ||||||||||||||||||||||||||||||||||||||||||
| 67 | 32 => 'Längere Haltezeit am Bahnhof', | ||||||||||||||||||||||||||||||||||||||||||
| 68 | 33 => 'Defekt an der Oberleitung', # xlsx: "Reparatur an der Oberleitung" | ||||||||||||||||||||||||||||||||||||||||||
| 69 | 34 => 'Defekt an einem Signal', # xlsx: "Reparatur an einem Signal" | ||||||||||||||||||||||||||||||||||||||||||
| 70 | 35 => 'Streckensperrung', | ||||||||||||||||||||||||||||||||||||||||||
| 71 | 36 => 'Technische Störung am Zug', | ||||||||||||||||||||||||||||||||||||||||||
| 72 | 37 => 'Kurzfristiger Fahrzeugausfall', | ||||||||||||||||||||||||||||||||||||||||||
| 73 | 38 => 'Defekt an der Strecke', # xlsx: "Reparatur an der Strecke" | ||||||||||||||||||||||||||||||||||||||||||
| 74 | 39 => 'Stau / Hohes Verkehrsaufkommen', | ||||||||||||||||||||||||||||||||||||||||||
| 75 | 40 => 'Defektes Stellwerk', | ||||||||||||||||||||||||||||||||||||||||||
| 76 | 41 => 'Defekt an einem Bahnübergang' | ||||||||||||||||||||||||||||||||||||||||||
| 77 | , # xlsx: "Technischer Defekt an einem Bahnüburgang" | ||||||||||||||||||||||||||||||||||||||||||
| 78 | 42 => 'Außerplanmäßige Geschwindigkeitsbeschränkung' | ||||||||||||||||||||||||||||||||||||||||||
| 79 | , # xlsx: "Vorübergehend verminderte Geschwindigkeit auf der Strecke" | ||||||||||||||||||||||||||||||||||||||||||
| 80 | 43 => 'Verspätung eines vorausfahrenden Zuges', | ||||||||||||||||||||||||||||||||||||||||||
| 81 | 44 => 'Warten auf einen entgegenkommenden Zug', | ||||||||||||||||||||||||||||||||||||||||||
| 82 | 45 => 'Vorfahrt eines anderen Zuges', | ||||||||||||||||||||||||||||||||||||||||||
| 83 | 46 => 'Vorfahrt eines anderen Zuges', # xlsx: missing | ||||||||||||||||||||||||||||||||||||||||||
| 84 | 47 => 'Verspätete Bereitstellung', | ||||||||||||||||||||||||||||||||||||||||||
| 85 | 48 => 'Verspätung aus vorheriger Fahrt', | ||||||||||||||||||||||||||||||||||||||||||
| 86 | 49 => 'Kurzfristiger Personalausfall', | ||||||||||||||||||||||||||||||||||||||||||
| 87 | 50 => 'Kurzfristige Erkrankung von Personal', | ||||||||||||||||||||||||||||||||||||||||||
| 88 | 51 => 'Verspätetes Personal aus vorheriger Fahrt', | ||||||||||||||||||||||||||||||||||||||||||
| 89 | 52 => 'Streik', | ||||||||||||||||||||||||||||||||||||||||||
| 90 | 53 => 'Unwetterauswirkungen', | ||||||||||||||||||||||||||||||||||||||||||
| 91 | 54 => 'Verfügbarkeit der Gleise derzeit eingeschränkt', | ||||||||||||||||||||||||||||||||||||||||||
| 92 | 55 => 'Technischer Defekt an einem anderen Zug', | ||||||||||||||||||||||||||||||||||||||||||
| 93 | 56 => 'Laden der Antriebsbatterie', | ||||||||||||||||||||||||||||||||||||||||||
| 94 | 57 => 'Zusätzlicher Halt', # xslx: "Zusätzlicher Halt zum Ein- und Ausstieg" | ||||||||||||||||||||||||||||||||||||||||||
| 95 | 58 => 'Umleitung', # xlsx: "Umleitung des Zuges" | ||||||||||||||||||||||||||||||||||||||||||
| 96 | 59 => 'Schnee und Eis', | ||||||||||||||||||||||||||||||||||||||||||
| 97 | 60 => 'Witterungsbedingt verminderte Geschwindigkeit', | ||||||||||||||||||||||||||||||||||||||||||
| 98 | 61 => 'Defekte Tür', | ||||||||||||||||||||||||||||||||||||||||||
| 99 | 62 => 'Behobener Defekt am Zug', | ||||||||||||||||||||||||||||||||||||||||||
| 100 | 63 => 'Technische Untersuchung am Zug', | ||||||||||||||||||||||||||||||||||||||||||
| 101 | 64 => 'Defekt an einer Weiche', | ||||||||||||||||||||||||||||||||||||||||||
| 102 | 65 => 'Erdrutsch', | ||||||||||||||||||||||||||||||||||||||||||
| 103 | 66 => 'Hochwasser', | ||||||||||||||||||||||||||||||||||||||||||
| 104 | 67 => 'Behördliche Maßnahme', | ||||||||||||||||||||||||||||||||||||||||||
| 105 | 68 => 'Hohes Fahrgastaufkommen' | ||||||||||||||||||||||||||||||||||||||||||
| 106 | , # xlsx: "Hohes Fahrgastaufkommen verlängert Ein- und Ausstieg" | ||||||||||||||||||||||||||||||||||||||||||
| 107 | 69 => 'Zug verkehrt mit verminderter Geschwindigeit', | ||||||||||||||||||||||||||||||||||||||||||
| 108 | 70 => 'WLAN nicht verfügbar', | ||||||||||||||||||||||||||||||||||||||||||
| 109 | 71 => 'Eingeschränktes WLAN', | ||||||||||||||||||||||||||||||||||||||||||
| 110 | 72 => 'Info/Entertainment nicht verfügbar', | ||||||||||||||||||||||||||||||||||||||||||
| 111 | 73 => 'Heute: Mehrzweckabteil vorne', | ||||||||||||||||||||||||||||||||||||||||||
| 112 | 74 => 'Heute: Mehrzweckabteil hinten', | ||||||||||||||||||||||||||||||||||||||||||
| 113 | 75 => 'Heute: 1. Klasse vorne', | ||||||||||||||||||||||||||||||||||||||||||
| 114 | 76 => 'Heute: 1. Klasse hinten', | ||||||||||||||||||||||||||||||||||||||||||
| 115 | 77 => '1. Klasse fehlt', | ||||||||||||||||||||||||||||||||||||||||||
| 116 | 78 => 'Ersatzverkehr mit Bus ist eingerichtet', | ||||||||||||||||||||||||||||||||||||||||||
| 117 | 79 => 'Mehrzweckabteil fehlt', | ||||||||||||||||||||||||||||||||||||||||||
| 118 | 80 => 'Abweichende Wagenreihung', | ||||||||||||||||||||||||||||||||||||||||||
| 119 | 81 => 'Fahrzeugtausch', # deleted as of 2025-12-14 | ||||||||||||||||||||||||||||||||||||||||||
| 120 | 82 => 'Mehrere Wagen fehlen', | ||||||||||||||||||||||||||||||||||||||||||
| 121 | 83 => 'Heute ohne fahrzeuggebundene Einstiegshilfe', | ||||||||||||||||||||||||||||||||||||||||||
| 122 | 84 => 'Zug verkehrt richtig gereiht', | ||||||||||||||||||||||||||||||||||||||||||
| 123 | 85 => 'Ein Wagen fehlt', | ||||||||||||||||||||||||||||||||||||||||||
| 124 | 86 => 'Gesamter Zug ohne Reservierung', | ||||||||||||||||||||||||||||||||||||||||||
| 125 | 87 => 'Einzelne Wagen ohne Reservierung', | ||||||||||||||||||||||||||||||||||||||||||
| 126 | 88 => 'Keine Qualitätsmängel', | ||||||||||||||||||||||||||||||||||||||||||
| 127 | 89 => 'Reservierungen sind wieder vorhanden', | ||||||||||||||||||||||||||||||||||||||||||
| 128 | 90 => 'Kein gastronomisches Angebot', | ||||||||||||||||||||||||||||||||||||||||||
| 129 | 91 => 'Fahrradmitnahme nicht möglich', | ||||||||||||||||||||||||||||||||||||||||||
| 130 | 92 => 'Fahrradmitnahme kann nicht garantiert werden', | ||||||||||||||||||||||||||||||||||||||||||
| 131 | 93 => 'Behindertengerechte Einrichtung fehlt', | ||||||||||||||||||||||||||||||||||||||||||
| 132 | 94 => 'Ersatzbewirtschaftung', | ||||||||||||||||||||||||||||||||||||||||||
| 133 | 95 => 'Universaltoilette fehlt', | ||||||||||||||||||||||||||||||||||||||||||
| 134 | 96 => 'Zustieg kann nicht garantiert werden', | ||||||||||||||||||||||||||||||||||||||||||
| 135 | 97 => 'Hohe Auslastung', | ||||||||||||||||||||||||||||||||||||||||||
| 136 | 98 => 'Sonstige Qualitätsmängel', | ||||||||||||||||||||||||||||||||||||||||||
| 137 | 99 => 'Verzögerungen im Betriebsablauf', | ||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | # Occasionally, there's a message with ID 900. In all cases observed so far, | ||||||||||||||||||||||||||||||||||||||||||
| 140 | # it was used for "Anschlussbus wartet". However, as we don't know which bus | ||||||||||||||||||||||||||||||||||||||||||
| 141 | # it refers to, we don't show it to users. | ||||||||||||||||||||||||||||||||||||||||||
| 142 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | # IRIS may return "Betriebsstelle nicht bekannt" for some recently added | ||||||||||||||||||||||||||||||||||||||||||
| 145 | # stations. Fix those manually. | ||||||||||||||||||||||||||||||||||||||||||
| 146 | 7 | my %fixup = ( | |||||||||||||||||||||||||||||||||||||||||
| 147 | 8002795 => 'Herten(Westf)', | ||||||||||||||||||||||||||||||||||||||||||
| 148 | 8003983 => 'Merklingen - Schwäbische Alb', | ||||||||||||||||||||||||||||||||||||||||||
| 149 | 8005493 => 'Schwetzingen-Hirschacker', | ||||||||||||||||||||||||||||||||||||||||||
| 150 | 8070678 => 'Metzingen-Neuhausen', | ||||||||||||||||||||||||||||||||||||||||||
| 151 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | # }}} | ||||||||||||||||||||||||||||||||||||||||||
| 154 | # {{{ Constructor | ||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||
| 156 | 1140 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=14 SCAR=26.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | 1140 | my ( $obj, %opt ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | 1140 | my $ref = \%opt; | |||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | 1140 | my ( $train_id, $start_ts, $stop_no ) = split( /.\K-/, $opt{raw_id} ); | |||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | 1140 | bless( $ref, $obj ); | |||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | 1140 | ▶ | $ref->{strptime_obj} //= DateTime::Format::Strptime->new( | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$ref->{"strptime_obj"} //= "DateTime::Format::Strptime"->new("pattern", "%y%m%d%H%M", "time_zone", "Europe/Berlin")
MC/DC0%0/2
$ref->{"strptime_obj"} //= "DateTime::Format::Strptime"->new("pattern", "%y%m%d%H%M", "time_zone", "Europe/Berlin")
$ref->{"strptime_obj"}
"DateTime::Format::Strptime"->new("pattern", "%y%m%d%H%M", "time_zone", "Europe/Berlin")
Truth table33%1/3
A //= B
A= $ref->{"strptime_obj"}B= "DateTime::Format::Strptime"->new("pattern", "%y%m%d%H%M", "time_zone", "Europe/Berlin")
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | pattern => '%y%m%d%H%M', | ||||||||||||||||||||||||||||||||||||||||||
| 167 | time_zone => 'Europe/Berlin', | ||||||||||||||||||||||||||||||||||||||||||
| 168 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | 1140 | $ref->{wing_id} = "${train_id}-${start_ts}"; | |||||||||||||||||||||||||||||||||||||||||
| 171 | 1140 | $ref->{is_wing} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 172 | 1140 | $train_id =~ s{^-}{}; | |||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | 1140 | $ref->{start} = $ref->parse_ts($start_ts); | |||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||
| 176 | 1140 | $ref->{train_id} = $train_id; | |||||||||||||||||||||||||||||||||||||||||
| 177 | 1140 | $ref->{stop_no} = $stop_no; | |||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | 1140 | ▶ | if ( $opt{transfer} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 180 | 24 | my ($transfer) = split( /.\K-/, $opt{transfer} ); | |||||||||||||||||||||||||||||||||||||||||
| 181 | 24 | $transfer =~ s{^-}{}; | |||||||||||||||||||||||||||||||||||||||||
| 182 | 24 | $ref->{transfer} = $transfer; | |||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | my $ar = $ref->{arrival} = $ref->{sched_arrival} | ||||||||||||||||||||||||||||||||||||||||||
| 186 | 1140 | = $ref->parse_ts( $opt{arrival_ts} ); | |||||||||||||||||||||||||||||||||||||||||
| 187 | my $dp = $ref->{departure} = $ref->{sched_departure} | ||||||||||||||||||||||||||||||||||||||||||
| 188 | 1140 | = $ref->parse_ts( $opt{departure_ts} ); | |||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||
| 190 | 1140 | ▶ | if ( not( defined $ar or defined $dp ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $ar or defined $dp
MC/DC0%0/2
defined $ar or defined $dp
defined $ar
defined $dp
Truth table66%2/3
A or B
A= defined $arB= defined $dp
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | cluck( | ||||||||||||||||||||||||||||||||||||||||||
| 192 | sprintf( | ||||||||||||||||||||||||||||||||||||||||||
| 193 | "Neither arrival '%s' nor departure '%s' are valid " | ||||||||||||||||||||||||||||||||||||||||||
| 194 | . "timestamps - can't handle this train", | ||||||||||||||||||||||||||||||||||||||||||
| 195 | $opt{arrival_ts}, $opt{departure_ts} | ||||||||||||||||||||||||||||||||||||||||||
| 196 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||
| 200 | 1140 | ▶ | my $dt = $ref->{datetime} = $dp // $ar; | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$dp // $ar
MC/DC0%0/2
$dp // $ar
$dp
$ar
Truth table66%2/3
A // B
A= $dpB= $ar
| |||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||
| 202 | 1140 | $ref->{date} = $dt->strftime('%d.%m.%Y'); | |||||||||||||||||||||||||||||||||||||||||
| 203 | 1140 | $ref->{time} = $dt->strftime('%H:%M'); | |||||||||||||||||||||||||||||||||||||||||
| 204 | 1140 | $ref->{epoch} = $dt->epoch; | |||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||
| 206 | $ref->{route_pre} = $ref->{sched_route_pre} | ||||||||||||||||||||||||||||||||||||||||||
| 207 | 1140 | ▶ | = [ split( qr{[|]}, $ref->{route_pre} // q{} ) ]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$ref->{"route_pre"} // ""
MC/DC100%1/1
$ref->{"route_pre"} // ""
$ref->{"route_pre"}
Truth table100%2/2
A
A= $ref->{"route_pre"}
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | $ref->{route_post} = $ref->{sched_route_post} | ||||||||||||||||||||||||||||||||||||||||||
| 209 | 1140 | ▶ | = [ split( qr{[|]}, $ref->{route_post} // q{} ) ]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$ref->{"route_post"} // ""
MC/DC100%1/1
$ref->{"route_post"} // ""
$ref->{"route_post"}
Truth table100%2/2
A
A= $ref->{"route_post"}
| |||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | 1140 | $ref->fixup_route( $ref->{route_pre} ); | |||||||||||||||||||||||||||||||||||||||||
| 212 | 1140 | $ref->fixup_route( $ref->{route_post} ); | |||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||
| 214 | 1140 | ▶ | $ref->{route_pre_incomplete} = $ref->{route_end} ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 215 | 1140 | ▶ | $ref->{route_post_incomplete} = $ref->{route_post} ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | 1140 | $ref->{sched_platform} = $ref->{platform}; | |||||||||||||||||||||||||||||||||||||||||
| 218 | $ref->{route_end} | ||||||||||||||||||||||||||||||||||||||||||
| 219 | = $ref->{sched_route_end} | ||||||||||||||||||||||||||||||||||||||||||
| 220 | = $ref->{route_end} | ||||||||||||||||||||||||||||||||||||||||||
| 221 | || $ref->{route_post}[-1] | ||||||||||||||||||||||||||||||||||||||||||
| 222 | 1140 | ▶ | || $ref->{station}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition83%5/6
$ref->{'route_end'} || $ref->{'route_post'}[-1] || $ref->{'station'}
$ref->{"route_end"} or $ref->{"route_post"}[-1]
MC/DC0%0/3
$ref->{'route_end'} || $ref->{'route_post'}[-1] || $ref->{'station'}
$ref->{"route_end"}
$ref->{"route_post"}[-1]
$ref->{'station'}
Truth table75%3/4
A or B || C
A= $ref->{"route_end"}B= $ref->{"route_post"}[-1]C= $ref->{'station'}
| |||||||||||||||||||||||||||||||||||||||||||
| 223 | $ref->{route_start} | ||||||||||||||||||||||||||||||||||||||||||
| 224 | = $ref->{sched_route_start} | ||||||||||||||||||||||||||||||||||||||||||
| 225 | = $ref->{route_start} | ||||||||||||||||||||||||||||||||||||||||||
| 226 | || $ref->{route_pre}[0] | ||||||||||||||||||||||||||||||||||||||||||
| 227 | 1140 | ▶ | || $ref->{station}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition83%5/6
$ref->{'route_start'} || $ref->{'route_pre'}[0] || $ref->{'station'}
$ref->{"route_start"} or $ref->{"route_pre"}[0]
MC/DC0%0/3
$ref->{'route_start'} || $ref->{'route_pre'}[0] || $ref->{'station'}
$ref->{"route_start"}
$ref->{"route_pre"}[0]
$ref->{'station'}
Truth table75%3/4
A or B || C
A= $ref->{"route_start"}B= $ref->{"route_pre"}[0]C= $ref->{'station'}
| |||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | 1140 | return $ref; | |||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||
| 232 | # }}} | ||||||||||||||||||||||||||||||||||||||||||
| 233 | # {{{ Internal Helpers | ||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||
| 235 | 3012 | ▶ | sub fixup_route { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fixup_route: called CC=4 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 236 | 3012 | my ( $self, $route ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 237 | 3012 | for my $stop ( @{$route} ) { | |||||||||||||||||||||||||||||||||||||||||
| 238 | 27180 | ▶ | if ( $stop =~ m{^Betriebsstelle nicht bekannt (\d+)$} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | if ( $fixup{$1} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | $stop = $fixup{$1}; | |||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||
| 246 | 5011 | ▶ | sub parse_ts { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_ts: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 247 | 5011 | my ( $self, $string ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | 5011 | ▶ | if ( defined $string ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 250 | 4655 | return $self->{strptime_obj}->parse_datetime($string); | |||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||
| 252 | 356 | return; | |||||||||||||||||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||
| 255 | # List::Compare does not keep the order of its arguments (even with unsorted). | ||||||||||||||||||||||||||||||||||||||||||
| 256 | # So we need to re-sort all stops to maintain their original order. | ||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | ▶ | sub sorted_sublist { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sorted_sublist: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | my ( $self, $list, $sublist ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | my %pos; | |||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | ▶ | if ( not $sublist or not @{$sublist} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$sublist and @{$sublist;}
MC/DC0%0/2
$sublist and @{$sublist;}
$sublist
@{$sublist;}
Truth table0%0/3
A and B
A= $sublistB= @{$sublist;}
| |||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | for my $i ( 0 .. $#{$list} ) { | |||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | $pos{ $list->[$i] } = $i; | |||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | my @sorted = sort { $pos{$a} <=> $pos{$b} } @{$sublist}; | |||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | return @sorted; | |||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||
| 274 | 3 | ▶ | sub superseded_messages { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
superseded_messages: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 275 | 3 | my ( $self, $msg ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 276 | 3 | my %superseded = ( | |||||||||||||||||||||||||||||||||||||||||
| 277 | 73 => [74], | ||||||||||||||||||||||||||||||||||||||||||
| 278 | 74 => [73], | ||||||||||||||||||||||||||||||||||||||||||
| 279 | 75 => [76], | ||||||||||||||||||||||||||||||||||||||||||
| 280 | 76 => [75], | ||||||||||||||||||||||||||||||||||||||||||
| 281 | 84 => [ 73, 74, 75, 76, 80 ], | ||||||||||||||||||||||||||||||||||||||||||
| 282 | 88 => [ | ||||||||||||||||||||||||||||||||||||||||||
| 283 | 70, 71, 72, 77, 78, 79, 82, 83, 85, 90, | ||||||||||||||||||||||||||||||||||||||||||
| 284 | 91, 92, 93, 94, 95, 96, 97, 98 | ||||||||||||||||||||||||||||||||||||||||||
| 285 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 286 | 89 => [ 86, 87 ], | ||||||||||||||||||||||||||||||||||||||||||
| 287 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||
| 289 | 3 | ▶ | return @{ $superseded{$msg} // [] }; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$superseded{$msg} // []
MC/DC0%0/1
$superseded{$msg} // []
$superseded{$msg}
Truth table50%1/2
A
A= $superseded{$msg}
| |||||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||
| 292 | # }}} | ||||||||||||||||||||||||||||||||||||||||||
| 293 | # {{{ Internal Setters for IRIS.pm | ||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||
| 295 | 760 | ▶ | sub set_ar { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_ar: called CC=17 SCAR=28.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 296 | 760 | my ( $self, %attrib ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||
| 298 | 760 | ▶ | if ( $attrib{status} and $attrib{status} eq 'c' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
$attrib{"status"} and $attrib{"status"} eq "c"
MC/DC100%2/2
$attrib{"status"} and $attrib{"status"} eq "c"
$attrib{"status"}
$attrib{"status"} eq "c"
Truth table100%3/3
A and B
A= $attrib{"status"}B= $attrib{"status"} eq "c"
| |||||||||||||||||||||||||||||||||||||||||||
| 299 | 54 | $self->{has_realtime} = $self->{arrival_has_realtime} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 300 | 54 | $self->{arrival_is_cancelled} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||||||||
| 302 | ▶ | elsif ( $attrib{status} and $attrib{status} eq 'a' ) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$attrib{"status"} and $attrib{"status"} eq "a"
MC/DC0%0/2
$attrib{"status"} and $attrib{"status"} eq "a"
$attrib{"status"}
$attrib{"status"} eq "a"
Truth table66%2/3
A and B
A= $attrib{"status"}B= $attrib{"status"} eq "a"
| |||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | $self->{arrival_is_additional} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||||||||||||||||
| 305 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 306 | 706 | $self->{arrival_is_additional} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 307 | 706 | $self->{arrival_is_cancelled} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||
| 310 | 760 | ▶ | if ( $attrib{arrival_hidden} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | $self->{arrival_hidden} = $attrib{arrival_hidden}; | |||||||||||||||||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||
| 314 | # unscheduled arrivals may not appear in the plan, but we do need to | ||||||||||||||||||||||||||||||||||||||||||
| 315 | # know their planned arrival time | ||||||||||||||||||||||||||||||||||||||||||
| 316 | 760 | ▶ | if ( $attrib{plan_arrival_ts} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 317 | $self->{sched_arrival} | ||||||||||||||||||||||||||||||||||||||||||
| 318 | 184 | = $self->parse_ts( $attrib{plan_arrival_ts} ); | |||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||
| 321 | 760 | ▶ | if ( $attrib{arrival_ts} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 322 | 648 | $self->{has_realtime} = $self->{arrival_has_realtime} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 323 | 648 | $self->{arrival} = $self->parse_ts( $attrib{arrival_ts} ); | |||||||||||||||||||||||||||||||||||||||||
| 324 | 648 | ▶ | if ( not $self->{arrival_is_cancelled} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 325 | $self->{delay} = $self->{arrival_delay} | ||||||||||||||||||||||||||||||||||||||||||
| 326 | 640 | = $self->arrival->subtract_datetime( $self->sched_arrival ) | |||||||||||||||||||||||||||||||||||||||||
| 327 | ->in_units('minutes'); | ||||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||||||||||||
| 330 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 331 | 112 | $self->{arrival} = $self->{sched_arrival}; | |||||||||||||||||||||||||||||||||||||||||
| 332 | 112 | ▶ | $self->{arrival_delay} //= 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"arrival_delay"} //= 0
MC/DC0%0/1
$self->{"arrival_delay"} //= 0
$self->{"arrival_delay"}
Truth table50%1/2
A
A= $self->{"arrival_delay"}
| |||||||||||||||||||||||||||||||||||||||||||
| 333 | 112 | ▶ | $self->{delay} //= 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"delay"} //= 0
MC/DC0%0/1
$self->{"delay"} //= 0
$self->{"delay"}
Truth table50%1/2
A
A= $self->{"delay"}
| |||||||||||||||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||
| 336 | 760 | ▶ | if ( $attrib{platform} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 337 | 14 | $self->{platform} = $attrib{platform}; | |||||||||||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||||||||||
| 339 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 340 | 746 | $self->{platform} = $self->{sched_platform}; | |||||||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||
| 343 | 760 | ▶ | if ( defined $attrib{route_pre} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 344 | 190 | ▶ | $self->{route_pre} = [ split( qr{[|]}, $attrib{route_pre} // q{} ) ]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$attrib{"route_pre"} // ""
MC/DC0%0/1
$attrib{"route_pre"} // ""
$attrib{"route_pre"}
Truth table50%1/2
A
A= $attrib{"route_pre"}
| |||||||||||||||||||||||||||||||||||||||||||
| 345 | 190 | $self->fixup_route( $self->{route_pre} ); | |||||||||||||||||||||||||||||||||||||||||
| 346 | 190 | ▶ | if ( @{ $self->{route_pre} } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 347 | 144 | $self->{route_start} = $self->{route_pre}[0]; | |||||||||||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||||||||||||||||
| 350 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 351 | 570 | $self->{route_pre} = $self->{sched_route_pre}; | |||||||||||||||||||||||||||||||||||||||||
| 352 | 570 | $self->{route_start} = $self->{sched_route_start}; | |||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||
| 355 | # also only for unscheduled arrivals | ||||||||||||||||||||||||||||||||||||||||||
| 356 | 760 | ▶ | if ( $attrib{sched_route_pre} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 357 | $self->{sched_route_pre} | ||||||||||||||||||||||||||||||||||||||||||
| 358 | 184 | ▶ | = [ split( qr{[|]}, $attrib{sched_route_pre} // q{} ) ]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$attrib{"sched_route_pre"} // ""
MC/DC0%0/1
$attrib{"sched_route_pre"} // ""
$attrib{"sched_route_pre"}
Truth table50%1/2
A
A= $attrib{"sched_route_pre"}
| |||||||||||||||||||||||||||||||||||||||||||
| 359 | 184 | $self->fixup_route( $self->{sched_route_pre} ); | |||||||||||||||||||||||||||||||||||||||||
| 360 | 184 | $self->{sched_route_start} = $self->{sched_route_pre}[0]; | |||||||||||||||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||
| 363 | 760 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||
| 366 | 686 | ▶ | sub set_dp { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_dp: called CC=17 SCAR=28.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 367 | 686 | my ( $self, %attrib ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||
| 369 | 686 | ▶ | if ( $attrib{status} and $attrib{status} eq 'c' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
$attrib{"status"} and $attrib{"status"} eq "c"
MC/DC100%2/2
$attrib{"status"} and $attrib{"status"} eq "c"
$attrib{"status"}
$attrib{"status"} eq "c"
Truth table100%3/3
A and B
A= $attrib{"status"}B= $attrib{"status"} eq "c"
| |||||||||||||||||||||||||||||||||||||||||||
| 370 | 53 | $self->{has_realtime} = $self->{arrival_has_realtime} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 371 | 53 | $self->{departure_is_cancelled} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||||||||||||||||
| 373 | ▶ | elsif ( $attrib{status} and $attrib{status} eq 'a' ) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$attrib{"status"} and $attrib{"status"} eq "a"
MC/DC0%0/2
$attrib{"status"} and $attrib{"status"} eq "a"
$attrib{"status"}
$attrib{"status"} eq "a"
Truth table66%2/3
A and B
A= $attrib{"status"}B= $attrib{"status"} eq "a"
| |||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | $self->{departure_is_additional} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||||||||||||||||
| 376 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 377 | 633 | $self->{departure_is_additional} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 378 | 633 | $self->{departure_is_cancelled} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||
| 381 | 686 | ▶ | if ( $attrib{departure_hidden} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | $self->{departure_hidden} = $attrib{departure_hidden}; | |||||||||||||||||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||
| 385 | # unscheduled arrivals may not appear in the plan, but we do need to | ||||||||||||||||||||||||||||||||||||||||||
| 386 | # know their planned arrival time | ||||||||||||||||||||||||||||||||||||||||||
| 387 | 686 | ▶ | if ( $attrib{plan_departure_ts} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 388 | $self->{sched_departure} | ||||||||||||||||||||||||||||||||||||||||||
| 389 | 176 | = $self->parse_ts( $attrib{plan_departure_ts} ); | |||||||||||||||||||||||||||||||||||||||||
| 390 | } | ||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||
| 392 | 686 | ▶ | if ( $attrib{departure_ts} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 393 | 572 | $self->{has_realtime} = $self->{departure_has_realtime} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 394 | 572 | $self->{departure} = $self->parse_ts( $attrib{departure_ts} ); | |||||||||||||||||||||||||||||||||||||||||
| 395 | 572 | ▶ | if ( not $self->{departure_is_cancelled} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 396 | $self->{delay} = $self->{departure_delay} | ||||||||||||||||||||||||||||||||||||||||||
| 397 | 564 | = $self->departure->subtract_datetime( $self->sched_departure ) | |||||||||||||||||||||||||||||||||||||||||
| 398 | ->in_units('minutes'); | ||||||||||||||||||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||||||||||||||||
| 401 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 402 | 114 | $self->{departure} = $self->{sched_departure}; | |||||||||||||||||||||||||||||||||||||||||
| 403 | 114 | ▶ | $self->{delay} //= 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"delay"} //= 0
MC/DC100%1/1
$self->{"delay"} //= 0
$self->{"delay"}
Truth table100%2/2
A
A= $self->{"delay"}
| |||||||||||||||||||||||||||||||||||||||||||
| 404 | 114 | ▶ | $self->{departure_delay} //= 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"departure_delay"} //= 0
MC/DC0%0/1
$self->{"departure_delay"} //= 0
$self->{"departure_delay"}
Truth table50%1/2
A
A= $self->{"departure_delay"}
| |||||||||||||||||||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||
| 407 | 686 | ▶ | if ( $attrib{platform} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 408 | 7 | $self->{platform} = $attrib{platform}; | |||||||||||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||||||||||||
| 410 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 411 | 679 | $self->{platform} = $self->{sched_platform}; | |||||||||||||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||
| 414 | 686 | ▶ | if ( defined $attrib{route_post} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 415 | 182 | ▶ | $self->{route_post} = [ split( qr{[|]}, $attrib{route_post} // q{} ) ]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$attrib{"route_post"} // ""
MC/DC0%0/1
$attrib{"route_post"} // ""
$attrib{"route_post"}
Truth table50%1/2
A
A= $attrib{"route_post"}
| |||||||||||||||||||||||||||||||||||||||||||
| 416 | 182 | $self->fixup_route( $self->{route_post} ); | |||||||||||||||||||||||||||||||||||||||||
| 417 | 182 | ▶ | if ( @{ $self->{route_post} } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 418 | 137 | $self->{route_end} = $self->{route_post}[-1]; | |||||||||||||||||||||||||||||||||||||||||
| 419 | } | ||||||||||||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||||||||||||
| 421 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 422 | 504 | $self->{route_post} = $self->{sched_route_post}; | |||||||||||||||||||||||||||||||||||||||||
| 423 | 504 | $self->{route_end} = $self->{sched_route_end}; | |||||||||||||||||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||||||
| 426 | # also only for unscheduled departures | ||||||||||||||||||||||||||||||||||||||||||
| 427 | 686 | ▶ | if ( $attrib{sched_route_post} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 428 | $self->{sched_route_post} | ||||||||||||||||||||||||||||||||||||||||||
| 429 | 176 | ▶ | = [ split( qr{[|]}, $attrib{sched_route_post} // q{} ) ]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$attrib{"sched_route_post"} // ""
MC/DC0%0/1
$attrib{"sched_route_post"} // ""
$attrib{"sched_route_post"}
Truth table50%1/2
A
A= $attrib{"sched_route_post"}
| |||||||||||||||||||||||||||||||||||||||||||
| 430 | 176 | $self->fixup_route( $self->{sched_route_post} ); | |||||||||||||||||||||||||||||||||||||||||
| 431 | 176 | $self->{sched_route_end} = $self->{sched_route_post}[-1]; | |||||||||||||||||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||
| 434 | 686 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||
| 437 | 827 | ▶ | sub set_messages { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_messages: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 438 | 827 | my ( $self, %messages ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||
| 440 | 827 | $self->{messages} = \%messages; | |||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||
| 442 | 827 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 443 | } | ||||||||||||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||||||||||||
| 445 | 827 | ▶ | sub set_realtime { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_realtime: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 446 | 827 | my ( $self, $xmlobj ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||
| 448 | 827 | $self->{realtime_xml} = $xmlobj; | |||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||
| 450 | 827 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||
| 453 | 1 | ▶ | sub add_raw_ref { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_raw_ref: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 454 | 1 | my ( $self, %attrib ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||
| 456 | 1 | push( @{ $self->{refs} }, \%attrib ); | |||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||
| 458 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 459 | } | ||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||
| 461 | 121 | ▶ | sub set_unscheduled { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_unscheduled: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 462 | 121 | my ( $self, $unscheduled ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||
| 464 | 121 | $self->{is_unscheduled} = $unscheduled; | |||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||
| 466 | 121 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 467 | } | ||||||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||||||
| 469 | 14 | ▶ | sub add_arrival_wingref { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_arrival_wingref: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 470 | 14 | my ( $self, $ref ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||||||||||||
| 472 | 14 | my $backref = $self; | |||||||||||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||||||||||||
| 474 | 14 | weaken($ref); | |||||||||||||||||||||||||||||||||||||||||
| 475 | 14 | weaken($backref); | |||||||||||||||||||||||||||||||||||||||||
| 476 | 14 | $ref->{is_wing} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 477 | 14 | $ref->{wing_of} = $backref; | |||||||||||||||||||||||||||||||||||||||||
| 478 | 14 | push( @{ $self->{arrival_wings} }, $ref ); | |||||||||||||||||||||||||||||||||||||||||
| 479 | 14 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 480 | } | ||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||
| 482 | 8 | ▶ | sub add_departure_wingref { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_departure_wingref: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 483 | 8 | my ( $self, $ref ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||
| 485 | 8 | my $backref = $self; | |||||||||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||||||||||
| 487 | 8 | weaken($ref); | |||||||||||||||||||||||||||||||||||||||||
| 488 | 8 | weaken($backref); | |||||||||||||||||||||||||||||||||||||||||
| 489 | 8 | $ref->{is_wing} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 490 | 8 | $ref->{wing_of} = $backref; | |||||||||||||||||||||||||||||||||||||||||
| 491 | 8 | push( @{ $self->{departure_wings} }, $ref ); | |||||||||||||||||||||||||||||||||||||||||
| 492 | 8 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 493 | } | ||||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | ▶ | sub add_reference { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_reference: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | my ( $self, $ref ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | $ref->add_inverse_reference($self); | |||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | weaken($ref); | |||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | push( @{ $self->{replacement_for} }, $ref ); | |||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 502 | } | ||||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||
| 504 | 10 | ▶ | sub merge_with_departure { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
merge_with_departure: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 505 | 10 | my ( $self, $result ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||||||||||||||||
| 507 | # result must be departure-only | ||||||||||||||||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||||||||||||||||
| 509 | 10 | $self->{is_transfer} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||
| 511 | 10 | $self->{old_train_id} = $self->{train_id}; | |||||||||||||||||||||||||||||||||||||||||
| 512 | 10 | $self->{old_train_no} = $self->{train_no}; | |||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||
| 514 | # departure is preferred over arrival, so overwrite default values | ||||||||||||||||||||||||||||||||||||||||||
| 515 | 10 | $self->{date} = $result->{date}; | |||||||||||||||||||||||||||||||||||||||||
| 516 | 10 | $self->{time} = $result->{time}; | |||||||||||||||||||||||||||||||||||||||||
| 517 | 10 | $self->{epoch} = $result->{epoch}; | |||||||||||||||||||||||||||||||||||||||||
| 518 | 10 | $self->{datetime} = $result->{datetime}; | |||||||||||||||||||||||||||||||||||||||||
| 519 | 10 | $self->{train_id} = $result->{train_id}; | |||||||||||||||||||||||||||||||||||||||||
| 520 | 10 | $self->{train_no} = $result->{train_no}; | |||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||
| 522 | 10 | $self->{departure} = $result->{departure}; | |||||||||||||||||||||||||||||||||||||||||
| 523 | 10 | $self->{departure_wings} = $result->{departure_wings}; | |||||||||||||||||||||||||||||||||||||||||
| 524 | 10 | $self->{route_end} = $result->{route_end}; | |||||||||||||||||||||||||||||||||||||||||
| 525 | 10 | $self->{route_post} = $result->{route_post}; | |||||||||||||||||||||||||||||||||||||||||
| 526 | 10 | $self->{sched_departure} = $result->{sched_departure}; | |||||||||||||||||||||||||||||||||||||||||
| 527 | 10 | $self->{sched_route_post} = $result->{sched_route_post}; | |||||||||||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||||||||||||
| 529 | # update realtime info only if applicable | ||||||||||||||||||||||||||||||||||||||||||
| 530 | 10 | ▶ | $self->{is_cancelled} ||= $result->{is_cancelled}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"is_cancelled"} ||= $result->{"is_cancelled"}
MC/DC0%0/2
$self->{"is_cancelled"} ||= $result->{"is_cancelled"}
$self->{"is_cancelled"}
$result->{"is_cancelled"}
Truth table33%1/3
A ||= B
A= $self->{"is_cancelled"}B= $result->{"is_cancelled"}
| |||||||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||||||
| 532 | 10 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 533 | } | ||||||||||||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | ▶ | sub add_inverse_reference { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_inverse_reference: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | my ( $self, $ref ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | weaken($ref); | |||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | push( @{ $self->{replaced_by} }, $ref ); | |||||||||||||||||||||||||||||||||||||||||
| 540 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 541 | } | ||||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||
| 543 | # }}} | ||||||||||||||||||||||||||||||||||||||||||
| 544 | # {{{ Public Accessors | ||||||||||||||||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | ▶ | sub is_additional { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_additional: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 547 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | ▶ | if ( $self->{arrival_is_additional} and $self->{departure_is_additional} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"arrival_is_additional"} and $self->{"departure_is_additional"}
MC/DC0%0/2
$self->{"arrival_is_additional"} and $self->{"departure_is_additional"}
$self->{"arrival_is_additional"}
$self->{"departure_is_additional"}
Truth table0%0/3
A and B
A= $self->{"arrival_is_additional"}B= $self->{"departure_is_additional"}
| |||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 551 | } | ||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | ▶ | if ( $self->{arrival_is_additional} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"arrival_is_additional"} and not defined $self->{"departure_is_additional"}
MC/DC0%0/2
$self->{"arrival_is_additional"} and not defined $self->{"departure_is_additional"}
$self->{"arrival_is_additional"}
not defined $self->{"departure_is_additional"}
Truth table0%0/3
A and not(B)
A= $self->{"arrival_is_additional"}B= not defined $self->{"departure_is_additional"}
| |||||||||||||||||||||||||||||||||||||||||||
| 553 | and not defined $self->{departure_is_additional} ) | ||||||||||||||||||||||||||||||||||||||||||
| 554 | { | ||||||||||||||||||||||||||||||||||||||||||
| 555 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 556 | } | ||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | ▶ | if ( not defined $self->{arrival_is_additional} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $self->{"arrival_is_additional"} and $self->{"departure_is_additional"}
MC/DC0%0/2
not defined $self->{"arrival_is_additional"} and $self->{"departure_is_additional"}
not defined $self->{"arrival_is_additional"}
$self->{"departure_is_additional"}
Truth table0%0/3
not(A) and B
A= not defined $self->{"arrival_is_additional"}B= $self->{"departure_is_additional"}
| |||||||||||||||||||||||||||||||||||||||||||
| 558 | and $self->{departure_is_additional} ) | ||||||||||||||||||||||||||||||||||||||||||
| 559 | { | ||||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 561 | } | ||||||||||||||||||||||||||||||||||||||||||
| 562 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 563 | } | ||||||||||||||||||||||||||||||||||||||||||
| 564 | |||||||||||||||||||||||||||||||||||||||||||
| 565 | 2 | ▶ | sub is_cancelled { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_cancelled: called CC=7 SCAR=23.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 566 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||||||
| 568 | 2 | ▶ | if ( $self->{arrival_is_cancelled} and $self->{departure_is_cancelled} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"arrival_is_cancelled"} and $self->{"departure_is_cancelled"}
MC/DC50%1/2
$self->{"arrival_is_cancelled"} and $self->{"departure_is_cancelled"}
$self->{"arrival_is_cancelled"}
$self->{"departure_is_cancelled"}
Truth table66%2/3
A and B
A= $self->{"arrival_is_cancelled"}B= $self->{"departure_is_cancelled"}
| |||||||||||||||||||||||||||||||||||||||||||
| 569 | 1 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 570 | } | ||||||||||||||||||||||||||||||||||||||||||
| 571 | 1 | ▶ | if ( $self->{arrival_is_cancelled} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"arrival_is_cancelled"} and not defined $self->{"departure_is_cancelled"}
MC/DC0%0/2
$self->{"arrival_is_cancelled"} and not defined $self->{"departure_is_cancelled"}
$self->{"arrival_is_cancelled"}
not defined $self->{"departure_is_cancelled"}
Truth table33%1/3
A and not(B)
A= $self->{"arrival_is_cancelled"}B= not defined $self->{"departure_is_cancelled"}
| |||||||||||||||||||||||||||||||||||||||||||
| 572 | and not defined $self->{departure_is_cancelled} ) | ||||||||||||||||||||||||||||||||||||||||||
| 573 | { | ||||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 575 | } | ||||||||||||||||||||||||||||||||||||||||||
| 576 | 1 | ▶ | if ( not defined $self->{arrival_is_cancelled} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $self->{"arrival_is_cancelled"} and $self->{"departure_is_cancelled"}
MC/DC0%0/2
not defined $self->{"arrival_is_cancelled"} and $self->{"departure_is_cancelled"}
not defined $self->{"arrival_is_cancelled"}
$self->{"departure_is_cancelled"}
Truth table33%1/3
not(A) and B
A= not defined $self->{"arrival_is_cancelled"}B= $self->{"departure_is_cancelled"}
| |||||||||||||||||||||||||||||||||||||||||||
| 577 | and $self->{departure_is_cancelled} ) | ||||||||||||||||||||||||||||||||||||||||||
| 578 | { | ||||||||||||||||||||||||||||||||||||||||||
| 579 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 580 | } | ||||||||||||||||||||||||||||||||||||||||||
| 581 | 1 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 582 | } | ||||||||||||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||||||||||||
| 584 | 0 | ▶ | sub additional_stops { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
additional_stops: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 585 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||||||||||||
| 587 | $self->{comparator} //= List::Compare->new( | ||||||||||||||||||||||||||||||||||||||||||
| 588 | { | ||||||||||||||||||||||||||||||||||||||||||
| 589 | 0 | ▶ | lists => [ $self->{sched_route_post}, $self->{route_post} ], | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"comparator"} //= "List::Compare"->new({"lists", [$self->{"sched_route_post"}, $self->{"route_post"}], "unsorted", 1})
MC/DC0%0/2
$self->{"comparator"} //= "List::Compare"->new({"lists", [$self->{"sched_route_post"}, $self->{"route_post"}], "unsorted", 1})
$self->{"comparator"}
"List::Compare"->new({"lists", [$self->{"sched_route_post"}, $self->{"route_post"}], "unsorted", 1})
Truth table0%0/3
A //= B
A= $self->{"comparator"}B= "List::Compare"->new({"lists", [$self->{"sched_route_post"}, $self->{"route_post"}], "unsorted", 1})
| |||||||||||||||||||||||||||||||||||||||||||
| 590 | unsorted => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 591 | } | ||||||||||||||||||||||||||||||||||||||||||
| 592 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||
| 594 | return $self->sorted_sublist( $self->{route_post}, | ||||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | [ $self->{comparator}->get_complement ] ); | |||||||||||||||||||||||||||||||||||||||||
| 596 | } | ||||||||||||||||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||||||||||||||||
| 598 | 0 | ▶ | sub canceled_stops { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
canceled_stops: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 600 | |||||||||||||||||||||||||||||||||||||||||||
| 601 | $self->{comparator} //= List::Compare->new( | ||||||||||||||||||||||||||||||||||||||||||
| 602 | { | ||||||||||||||||||||||||||||||||||||||||||
| 603 | 0 | ▶ | lists => [ $self->{sched_route_post}, $self->{route_post} ], | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"comparator"} //= "List::Compare"->new({"lists", [$self->{"sched_route_post"}, $self->{"route_post"}], "unsorted", 1})
MC/DC0%0/2
$self->{"comparator"} //= "List::Compare"->new({"lists", [$self->{"sched_route_post"}, $self->{"route_post"}], "unsorted", 1})
$self->{"comparator"}
"List::Compare"->new({"lists", [$self->{"sched_route_post"}, $self->{"route_post"}], "unsorted", 1})
Truth table0%0/3
A //= B
A= $self->{"comparator"}B= "List::Compare"->new({"lists", [$self->{"sched_route_post"}, $self->{"route_post"}], "unsorted", 1})
| |||||||||||||||||||||||||||||||||||||||||||
| 604 | unsorted => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 605 | } | ||||||||||||||||||||||||||||||||||||||||||
| 606 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||||||||||||||||
| 608 | return $self->sorted_sublist( $self->{sched_route_post}, | ||||||||||||||||||||||||||||||||||||||||||
| 609 | 0 | [ $self->{comparator}->get_unique ] ); | |||||||||||||||||||||||||||||||||||||||||
| 610 | } | ||||||||||||||||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||||||||||||||||
| 612 | 1 | ▶ | sub classes { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
classes: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 613 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||||||||||||||||
| 615 | 1 | ▶ | my @classes = split( //, $self->{classes} // q{} ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"classes"} // ""
MC/DC0%0/1
$self->{"classes"} // ""
$self->{"classes"}
Truth table50%1/2
A
A= $self->{"classes"}
| |||||||||||||||||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||||||||||||||||
| 617 | 1 | return @classes; | |||||||||||||||||||||||||||||||||||||||||
| 618 | } | ||||||||||||||||||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||||||||||||||||
| 620 | 134 | ▶ | sub origin { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
origin: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 621 | 134 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||||||||||||||||
| 623 | 134 | return $self->route_start; | |||||||||||||||||||||||||||||||||||||||||
| 624 | } | ||||||||||||||||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||||||||||||||
| 626 | 134 | ▶ | sub destination { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
destination: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 627 | 134 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||||||||||||||||
| 629 | 134 | return $self->route_end; | |||||||||||||||||||||||||||||||||||||||||
| 630 | } | ||||||||||||||||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||||||||||||||||
| 632 | 1 | ▶ | sub delay_messages { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delay_messages: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 633 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 634 | |||||||||||||||||||||||||||||||||||||||||||
| 635 | 1 | my @keys = sort keys %{ $self->{messages} }; | |||||||||||||||||||||||||||||||||||||||||
| 636 | 1 | my @msgs = grep { $_->[1] eq 'd' } map { $self->{messages}{$_} } @keys; | |||||||||||||||||||||||||||||||||||||||||
| 637 | 1 | my @msgids = uniq( map { $_->[2] } @msgs ); | |||||||||||||||||||||||||||||||||||||||||
| 638 | 1 | my @ret; | |||||||||||||||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||||||||||||||||
| 640 | 1 | for my $id (@msgids) { | |||||||||||||||||||||||||||||||||||||||||
| 641 | 2 | for my $superseded ( $self->superseded_messages($id) ) { | |||||||||||||||||||||||||||||||||||||||||
| 642 | 0 | @ret = grep { not( $_->[2] == $superseded ) } @ret; | |||||||||||||||||||||||||||||||||||||||||
| 643 | } | ||||||||||||||||||||||||||||||||||||||||||
| 644 | 2 | ▶ | my $msg = lastval { $_->[2] == $id } @msgs; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 645 | 2 | push( @ret, $msg ); | |||||||||||||||||||||||||||||||||||||||||
| 646 | } | ||||||||||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||||||||||
| 648 | @ret = reverse | ||||||||||||||||||||||||||||||||||||||||||
| 649 | 1 | map { [ $self->parse_ts( $_->[0] ), $self->translate_msg( $_->[2] ) ] } | |||||||||||||||||||||||||||||||||||||||||
| 650 | @ret; | ||||||||||||||||||||||||||||||||||||||||||
| 651 | |||||||||||||||||||||||||||||||||||||||||||
| 652 | 1 | return @ret; | |||||||||||||||||||||||||||||||||||||||||
| 653 | } | ||||||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||||||
| 655 | 4 | ▶ | sub arrival_wings { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
arrival_wings: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 656 | 4 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||||||||||||||||
| 658 | 4 | ▶ | if ( $self->{arrival_wings} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 659 | 2 | return @{ $self->{arrival_wings} }; | |||||||||||||||||||||||||||||||||||||||||
| 660 | } | ||||||||||||||||||||||||||||||||||||||||||
| 661 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||
| 662 | } | ||||||||||||||||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||||||||||||||||
| 664 | 6 | ▶ | sub departure_wings { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
departure_wings: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 665 | 6 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||||||||||||
| 667 | 6 | ▶ | if ( $self->{departure_wings} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 668 | 4 | return @{ $self->{departure_wings} }; | |||||||||||||||||||||||||||||||||||||||||
| 669 | } | ||||||||||||||||||||||||||||||||||||||||||
| 670 | 2 | return; | |||||||||||||||||||||||||||||||||||||||||
| 671 | } | ||||||||||||||||||||||||||||||||||||||||||
| 672 | |||||||||||||||||||||||||||||||||||||||||||
| 673 | 0 | ▶ | sub replaced_by { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
replaced_by: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 674 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||||||||||||||||
| 676 | 0 | ▶ | if ( $self->{replaced_by} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 677 | 0 | return @{ $self->{replaced_by} }; | |||||||||||||||||||||||||||||||||||||||||
| 678 | } | ||||||||||||||||||||||||||||||||||||||||||
| 679 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 680 | } | ||||||||||||||||||||||||||||||||||||||||||
| 681 | |||||||||||||||||||||||||||||||||||||||||||
| 682 | 0 | ▶ | sub replacement_for { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
replacement_for: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 683 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||||||||||||
| 685 | 0 | ▶ | if ( $self->{replacement_for} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 686 | 0 | return @{ $self->{replacement_for} }; | |||||||||||||||||||||||||||||||||||||||||
| 687 | } | ||||||||||||||||||||||||||||||||||||||||||
| 688 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 689 | } | ||||||||||||||||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||||||||||||||
| 691 | 1 | ▶ | sub qos_messages { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
qos_messages: called CC=6 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 692 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 693 | |||||||||||||||||||||||||||||||||||||||||||
| 694 | 1 | my @keys = sort keys %{ $self->{messages} }; | |||||||||||||||||||||||||||||||||||||||||
| 695 | my @msgs | ||||||||||||||||||||||||||||||||||||||||||
| 696 | 1 | = grep { $_->[1] =~ m{^[fq]$} } map { $self->{messages}{$_} } @keys; | |||||||||||||||||||||||||||||||||||||||||
| 697 | 1 | my @ret; | |||||||||||||||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||||||||||||||||
| 699 | 1 | for my $msg (@msgs) { | |||||||||||||||||||||||||||||||||||||||||
| 700 | 1 | for my $superseded ( $self->superseded_messages( $msg->[2] ) ) { | |||||||||||||||||||||||||||||||||||||||||
| 701 | 0 | @ret = grep { not( $_->[2] == $superseded ) } @ret; | |||||||||||||||||||||||||||||||||||||||||
| 702 | } | ||||||||||||||||||||||||||||||||||||||||||
| 703 | 0 | @ret = grep { $_->[2] != $msg->[2] } @ret; | |||||||||||||||||||||||||||||||||||||||||
| 704 | |||||||||||||||||||||||||||||||||||||||||||
| 705 | # 88 is "no qos shortcomings" and only required to cancel previous qos | ||||||||||||||||||||||||||||||||||||||||||
| 706 | # messages. Same for 84 ("correct wagon order") and 89 ("reservations | ||||||||||||||||||||||||||||||||||||||||||
| 707 | # display is working again"). | ||||||||||||||||||||||||||||||||||||||||||
| 708 | 1 | ▶ | if ( $msg->[2] != 84 and $msg->[2] != 88 and $msg->[2] != 89 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$msg->[2] != 84 and $msg->[2] != 88 and $msg->[2] != 89
$msg->[2] != 84 and $msg->[2] != 88
MC/DC0%0/3
$msg->[2] != 84 and $msg->[2] != 88 and $msg->[2] != 89
$msg->[2] != 84
$msg->[2] != 88
$msg->[2] != 89
Truth table25%1/4
A and B and C
A= $msg->[2] != 84B= $msg->[2] != 88C= $msg->[2] != 89
| |||||||||||||||||||||||||||||||||||||||||||
| 709 | 1 | push( @ret, $msg ); | |||||||||||||||||||||||||||||||||||||||||
| 710 | } | ||||||||||||||||||||||||||||||||||||||||||
| 711 | } | ||||||||||||||||||||||||||||||||||||||||||
| 712 | |||||||||||||||||||||||||||||||||||||||||||
| 713 | @ret | ||||||||||||||||||||||||||||||||||||||||||
| 714 | 1 | = map { [ $self->parse_ts( $_->[0] ), $self->translate_msg( $_->[2] ) ] } | |||||||||||||||||||||||||||||||||||||||||
| 715 | reverse @ret; | ||||||||||||||||||||||||||||||||||||||||||
| 716 | |||||||||||||||||||||||||||||||||||||||||||
| 717 | 1 | return @ret; | |||||||||||||||||||||||||||||||||||||||||
| 718 | } | ||||||||||||||||||||||||||||||||||||||||||
| 719 | |||||||||||||||||||||||||||||||||||||||||||
| 720 | 0 | ▶ | sub raw_messages { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
raw_messages: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 721 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 722 | |||||||||||||||||||||||||||||||||||||||||||
| 723 | 0 | my @messages = reverse sort keys %{ $self->{messages} }; | |||||||||||||||||||||||||||||||||||||||||
| 724 | my @ret = map { | ||||||||||||||||||||||||||||||||||||||||||
| 725 | 0 | [ | |||||||||||||||||||||||||||||||||||||||||
| 726 | $self->parse_ts( $self->{messages}->{$_}->[0] ), | ||||||||||||||||||||||||||||||||||||||||||
| 727 | 0 | $self->{messages}->{$_}->[2] | |||||||||||||||||||||||||||||||||||||||||
| 728 | ] | ||||||||||||||||||||||||||||||||||||||||||
| 729 | } @messages; | ||||||||||||||||||||||||||||||||||||||||||
| 730 | |||||||||||||||||||||||||||||||||||||||||||
| 731 | 0 | return @ret; | |||||||||||||||||||||||||||||||||||||||||
| 732 | } | ||||||||||||||||||||||||||||||||||||||||||
| 733 | |||||||||||||||||||||||||||||||||||||||||||
| 734 | 1 | ▶ | sub messages { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
messages: called CC=3 SCAR=11.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 735 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 736 | |||||||||||||||||||||||||||||||||||||||||||
| 737 | 1 | my @messages = reverse sort keys %{ $self->{messages} }; | |||||||||||||||||||||||||||||||||||||||||
| 738 | my @ret = map { | ||||||||||||||||||||||||||||||||||||||||||
| 739 | 1 | [ | |||||||||||||||||||||||||||||||||||||||||
| 740 | $self->parse_ts( $self->{messages}{$_}[0] ), | ||||||||||||||||||||||||||||||||||||||||||
| 741 | $self->translate_msg( | ||||||||||||||||||||||||||||||||||||||||||
| 742 | $self->{messages}{$_}[2], | ||||||||||||||||||||||||||||||||||||||||||
| 743 | $self->{messages}{$_}[1] | ||||||||||||||||||||||||||||||||||||||||||
| 744 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 745 | $_, | ||||||||||||||||||||||||||||||||||||||||||
| 746 | $self->{messages}{$_}[3] | ||||||||||||||||||||||||||||||||||||||||||
| 747 | ? $self->parse_ts( $self->{messages}{$_}[3] ) | ||||||||||||||||||||||||||||||||||||||||||
| 748 | : undef, | ||||||||||||||||||||||||||||||||||||||||||
| 749 | $self->{messages}{$_}[4] | ||||||||||||||||||||||||||||||||||||||||||
| 750 | 8 | ▶ | ? $self->parse_ts( $self->{messages}{$_}[4] ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 751 | : undef, | ||||||||||||||||||||||||||||||||||||||||||
| 752 | ] | ||||||||||||||||||||||||||||||||||||||||||
| 753 | } @messages; | ||||||||||||||||||||||||||||||||||||||||||
| 754 | |||||||||||||||||||||||||||||||||||||||||||
| 755 | 1 | return @ret; | |||||||||||||||||||||||||||||||||||||||||
| 756 | } | ||||||||||||||||||||||||||||||||||||||||||
| 757 | |||||||||||||||||||||||||||||||||||||||||||
| 758 | 1 | ▶ | sub info { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
info: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 759 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 760 | |||||||||||||||||||||||||||||||||||||||||||
| 761 | 1 | my @messages = sort keys %{ $self->{messages} }; | |||||||||||||||||||||||||||||||||||||||||
| 762 | 1 | my @ids = uniq( map { $self->{messages}{$_}->[2] } @messages ); | |||||||||||||||||||||||||||||||||||||||||
| 763 | |||||||||||||||||||||||||||||||||||||||||||
| 764 | 1 | my @info = map { $self->translate_msg($_) } @ids; | |||||||||||||||||||||||||||||||||||||||||
| 765 | |||||||||||||||||||||||||||||||||||||||||||
| 766 | 1 | return @info; | |||||||||||||||||||||||||||||||||||||||||
| 767 | } | ||||||||||||||||||||||||||||||||||||||||||
| 768 | |||||||||||||||||||||||||||||||||||||||||||
| 769 | 268 | ▶ | sub line { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
line: called CC=4 SCAR=16.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 770 | 268 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 771 | |||||||||||||||||||||||||||||||||||||||||||
| 772 | return sprintf( '%s %s', | ||||||||||||||||||||||||||||||||||||||||||
| 773 | $self->{type} // 'Zug', | ||||||||||||||||||||||||||||||||||||||||||
| 774 | 268 | ▶ | $self->{line_no} // $self->{train_no} // '-' ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition42%3/7
$self->{"type"} // "Zug"
($self->{"line_no"} // $self->{"train_no"}) // "-"
$self->{"line_no"} // $self->{"train_no"}
MC/DC0%0/1
$self->{"type"} // "Zug"
$self->{"type"}
MC/DC0%0/2
($self->{"line_no"} // $self->{"train_no"}) // "-"
$self->{"line_no"}
$self->{"train_no"}
Truth table50%1/2
A
A= $self->{"type"}
Truth table33%1/3
A // B
A= $self->{"line_no"}B= $self->{"train_no"}
| |||||||||||||||||||||||||||||||||||||||||||
| 775 | } | ||||||||||||||||||||||||||||||||||||||||||
| 776 | |||||||||||||||||||||||||||||||||||||||||||
| 777 | 4 | ▶ | sub route_pre { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
route_pre: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 778 | 4 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 779 | |||||||||||||||||||||||||||||||||||||||||||
| 780 | 4 | return @{ $self->{route_pre} }; | |||||||||||||||||||||||||||||||||||||||||
| 781 | } | ||||||||||||||||||||||||||||||||||||||||||
| 782 | |||||||||||||||||||||||||||||||||||||||||||
| 783 | 8 | ▶ | sub route_post { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
route_post: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 784 | 8 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 785 | |||||||||||||||||||||||||||||||||||||||||||
| 786 | 8 | return @{ $self->{route_post} }; | |||||||||||||||||||||||||||||||||||||||||
| 787 | } | ||||||||||||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||||||||||||
| 789 | 2 | ▶ | sub route { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
route: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 790 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 791 | |||||||||||||||||||||||||||||||||||||||||||
| 792 | 2 | return ( $self->route_pre, $self->{station}, $self->route_post ); | |||||||||||||||||||||||||||||||||||||||||
| 793 | } | ||||||||||||||||||||||||||||||||||||||||||
| 794 | |||||||||||||||||||||||||||||||||||||||||||
| 795 | 134 | ▶ | sub train { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
train: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 796 | 134 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 797 | |||||||||||||||||||||||||||||||||||||||||||
| 798 | 134 | return $self->line; | |||||||||||||||||||||||||||||||||||||||||
| 799 | } | ||||||||||||||||||||||||||||||||||||||||||
| 800 | |||||||||||||||||||||||||||||||||||||||||||
| 801 | 4 | ▶ | sub route_interesting { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
route_interesting: called CC=19 SCAR=29.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 802 | 4 | my ( $self, $max_parts ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 803 | |||||||||||||||||||||||||||||||||||||||||||
| 804 | 4 | my @via = $self->route_post; | |||||||||||||||||||||||||||||||||||||||||
| 805 | 4 | my ( @via_main, @via_show, $last_stop ); | |||||||||||||||||||||||||||||||||||||||||
| 806 | 4 | ▶ | $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
| |||||||||||||||||||||||||||||||||||||||||||
| 807 | |||||||||||||||||||||||||||||||||||||||||||
| 808 | # Centraal: dutch main station (Hbf in .nl) | ||||||||||||||||||||||||||||||||||||||||||
| 809 | # HB: swiss main station (Hbf in .ch) | ||||||||||||||||||||||||||||||||||||||||||
| 810 | # hl.n.: czech main station (Hbf in .cz) | ||||||||||||||||||||||||||||||||||||||||||
| 811 | 4 | for my $stop (@via) { | |||||||||||||||||||||||||||||||||||||||||
| 812 | 16 | ▶ | if ( $stop =~ m{ HB $ | hl\.n\. $ | Hbf | Centraal | Flughafen }x ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 813 | 9 | push( @via_main, $stop ); | |||||||||||||||||||||||||||||||||||||||||
| 814 | } | ||||||||||||||||||||||||||||||||||||||||||
| 815 | } | ||||||||||||||||||||||||||||||||||||||||||
| 816 | $last_stop | ||||||||||||||||||||||||||||||||||||||||||
| 817 | 4 | ▶ | = $self->{route_post_incomplete} ? $self->{route_end} : pop(@via); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 818 | |||||||||||||||||||||||||||||||||||||||||||
| 819 | 4 | ▶ | if ( @via_main and $via_main[-1] eq $last_stop ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@via_main and $via_main[-1] eq $last_stop
MC/DC100%2/2
@via_main and $via_main[-1] eq $last_stop
@via_main
$via_main[-1] eq $last_stop
Truth table100%3/3
A and B
A= @via_mainB= $via_main[-1] eq $last_stop
| |||||||||||||||||||||||||||||||||||||||||||
| 820 | 2 | pop(@via_main); | |||||||||||||||||||||||||||||||||||||||||
| 821 | } | ||||||||||||||||||||||||||||||||||||||||||
| 822 | 4 | ▶ | if ( @via and $via[-1] eq $last_stop ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@via and $via[-1] eq $last_stop
MC/DC50%1/2
@via and $via[-1] eq $last_stop
@via
$via[-1] eq $last_stop
Truth table66%2/3
A and B
A= @viaB= $via[-1] eq $last_stop
| |||||||||||||||||||||||||||||||||||||||||||
| 823 | 3 | pop(@via); | |||||||||||||||||||||||||||||||||||||||||
| 824 | } | ||||||||||||||||||||||||||||||||||||||||||
| 825 | |||||||||||||||||||||||||||||||||||||||||||
| 826 | 4 | ▶ | if ( @via_main and @via and $via[0] eq $via_main[0] ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
@via_main and @via and $via[0] eq $via_main[0]
@via_main and @via
MC/DC66%2/3
@via_main and @via and $via[0] eq $via_main[0]
@via_main
@via
$via[0] eq $via_main[0]
Truth table75%3/4
A and B and C
A= @via_mainB= @viaC= $via[0] eq $via_main[0]
| |||||||||||||||||||||||||||||||||||||||||||
| 827 | 1 | shift(@via_main); | |||||||||||||||||||||||||||||||||||||||||
| 828 | } | ||||||||||||||||||||||||||||||||||||||||||
| 829 | |||||||||||||||||||||||||||||||||||||||||||
| 830 | 4 | ▶ | if ( @via < $max_parts ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 831 | 2 | @via_show = @via; | |||||||||||||||||||||||||||||||||||||||||
| 832 | } | ||||||||||||||||||||||||||||||||||||||||||
| 833 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 834 | 2 | ▶ | if ( @via_main >= $max_parts ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 835 | 1 | @via_show = ( $via[0] ); | |||||||||||||||||||||||||||||||||||||||||
| 836 | } | ||||||||||||||||||||||||||||||||||||||||||
| 837 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 838 | 1 | @via_show = splice( @via, 0, $max_parts - @via_main ); | |||||||||||||||||||||||||||||||||||||||||
| 839 | } | ||||||||||||||||||||||||||||||||||||||||||
| 840 | |||||||||||||||||||||||||||||||||||||||||||
| 841 | 2 | ▶ | 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
| |||||||||||||||||||||||||||||||||||||||||||
| 842 | 4 | my $stop = shift(@via_main); | |||||||||||||||||||||||||||||||||||||||||
| 843 | 4 | ▶ | if ( any { $stop eq $_ } @via_show or $stop eq $last_stop ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.8
Branch: 1 branch
Condition33%1/3
&any(sub {
$stop eq $_;
}
, @via_show) or $stop eq $last_stop
MC/DC0%0/2
&any(sub {
$stop eq $_;
}
, @via_show) or $stop eq $last_stop
&any(sub {
$stop eq $_;
}
, @via_show)
$stop eq $last_stop
Truth table33%1/3
A or B
A= &any(sub {
$stop eq $_;
}
, @via_show)B= $stop eq $last_stop
| |||||||||||||||||||||||||||||||||||||||||||
| 844 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 845 | } | ||||||||||||||||||||||||||||||||||||||||||
| 846 | 4 | push( @via_show, $stop ); | |||||||||||||||||||||||||||||||||||||||||
| 847 | } | ||||||||||||||||||||||||||||||||||||||||||
| 848 | } | ||||||||||||||||||||||||||||||||||||||||||
| 849 | |||||||||||||||||||||||||||||||||||||||||||
| 850 | 4 | for (@via_show) { | |||||||||||||||||||||||||||||||||||||||||
| 851 | 6 | s{ \s? Hbf .* }{}x; | |||||||||||||||||||||||||||||||||||||||||
| 852 | } | ||||||||||||||||||||||||||||||||||||||||||
| 853 | |||||||||||||||||||||||||||||||||||||||||||
| 854 | 4 | return @via_show; | |||||||||||||||||||||||||||||||||||||||||
| 855 | |||||||||||||||||||||||||||||||||||||||||||
| 856 | } | ||||||||||||||||||||||||||||||||||||||||||
| 857 | |||||||||||||||||||||||||||||||||||||||||||
| 858 | 2 | ▶ | sub sched_route_pre { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sched_route_pre: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 859 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 860 | |||||||||||||||||||||||||||||||||||||||||||
| 861 | 2 | return @{ $self->{sched_route_pre} }; | |||||||||||||||||||||||||||||||||||||||||
| 862 | } | ||||||||||||||||||||||||||||||||||||||||||
| 863 | |||||||||||||||||||||||||||||||||||||||||||
| 864 | 2 | ▶ | sub sched_route_post { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sched_route_post: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 865 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 866 | |||||||||||||||||||||||||||||||||||||||||||
| 867 | 2 | return @{ $self->{sched_route_post} }; | |||||||||||||||||||||||||||||||||||||||||
| 868 | } | ||||||||||||||||||||||||||||||||||||||||||
| 869 | |||||||||||||||||||||||||||||||||||||||||||
| 870 | 1 | ▶ | sub sched_route { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sched_route: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 871 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 872 | |||||||||||||||||||||||||||||||||||||||||||
| 873 | return ( $self->sched_route_pre, $self->{station}, | ||||||||||||||||||||||||||||||||||||||||||
| 874 | 1 | $self->sched_route_post ); | |||||||||||||||||||||||||||||||||||||||||
| 875 | } | ||||||||||||||||||||||||||||||||||||||||||
| 876 | |||||||||||||||||||||||||||||||||||||||||||
| 877 | 14 | ▶ | sub translate_msg { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
translate_msg: called CC=4 SCAR=15.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 878 | 14 | my ( $self, $msg, $type ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 879 | |||||||||||||||||||||||||||||||||||||||||||
| 880 | 14 | ▶ | if ( $type and $type eq 'h' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$type and $type eq "h"
MC/DC0%0/2
$type and $type eq "h"
$type
$type eq "h"
Truth table66%2/3
A and B
A= $typeB= $type eq "h"
| |||||||||||||||||||||||||||||||||||||||||||
| 881 | 0 | return $msg; | |||||||||||||||||||||||||||||||||||||||||
| 882 | } | ||||||||||||||||||||||||||||||||||||||||||
| 883 | 14 | ▶ | return $translation{$msg} // "?($msg)"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$translation{$msg} // "?($msg)"
MC/DC0%0/1
$translation{$msg} // "?($msg)"
$translation{$msg}
Truth table50%1/2
A
A= $translation{$msg}
| |||||||||||||||||||||||||||||||||||||||||||
| 884 | } | ||||||||||||||||||||||||||||||||||||||||||
| 885 | |||||||||||||||||||||||||||||||||||||||||||
| 886 | 0 | ▶ | sub TO_JSON { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
TO_JSON: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 887 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 888 | |||||||||||||||||||||||||||||||||||||||||||
| 889 | 0 | my %copy = %{$self}; | |||||||||||||||||||||||||||||||||||||||||
| 890 | 0 | delete $copy{realtime_xml}; | |||||||||||||||||||||||||||||||||||||||||
| 891 | 0 | delete $copy{strptime_obj}; | |||||||||||||||||||||||||||||||||||||||||
| 892 | |||||||||||||||||||||||||||||||||||||||||||
| 893 | 0 | for my $ref_key ( | |||||||||||||||||||||||||||||||||||||||||
| 894 | qw(arrival_wings departure_wings replaced_by replacement_for)) | ||||||||||||||||||||||||||||||||||||||||||
| 895 | { | ||||||||||||||||||||||||||||||||||||||||||
| 896 | 0 | delete $copy{$ref_key}; | |||||||||||||||||||||||||||||||||||||||||
| 897 | 0 | ▶ | for my $train_ref ( @{ $self->{$ref_key} // [] } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{$ref_key} // []
MC/DC0%0/1
$self->{$ref_key} // []
$self->{$ref_key}
Truth table0%0/2
A
A= $self->{$ref_key}
| |||||||||||||||||||||||||||||||||||||||||||
| 898 | push( | ||||||||||||||||||||||||||||||||||||||||||
| 899 | 0 | @{ $copy{$ref_key} }, | |||||||||||||||||||||||||||||||||||||||||
| 900 | { | ||||||||||||||||||||||||||||||||||||||||||
| 901 | raw_id => $train_ref->raw_id, | ||||||||||||||||||||||||||||||||||||||||||
| 902 | train => $train_ref->train, | ||||||||||||||||||||||||||||||||||||||||||
| 903 | train_no => $train_ref->train_no, | ||||||||||||||||||||||||||||||||||||||||||
| 904 | type => $train_ref->type, | ||||||||||||||||||||||||||||||||||||||||||
| 905 | } | ||||||||||||||||||||||||||||||||||||||||||
| 906 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 907 | } | ||||||||||||||||||||||||||||||||||||||||||
| 908 | } | ||||||||||||||||||||||||||||||||||||||||||
| 909 | |||||||||||||||||||||||||||||||||||||||||||
| 910 | 0 | delete $copy{wing_of}; | |||||||||||||||||||||||||||||||||||||||||
| 911 | 0 | ▶ | if ( my $train_ref = $self->wing_of ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 912 | $copy{wing_of} = { | ||||||||||||||||||||||||||||||||||||||||||
| 913 | 0 | raw_id => $train_ref->raw_id, | |||||||||||||||||||||||||||||||||||||||||
| 914 | train => $train_ref->train, | ||||||||||||||||||||||||||||||||||||||||||
| 915 | train_no => $train_ref->train_no, | ||||||||||||||||||||||||||||||||||||||||||
| 916 | type => $train_ref->type, | ||||||||||||||||||||||||||||||||||||||||||
| 917 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 918 | } | ||||||||||||||||||||||||||||||||||||||||||
| 919 | |||||||||||||||||||||||||||||||||||||||||||
| 920 | 0 | for my $datetime_key ( | |||||||||||||||||||||||||||||||||||||||||
| 921 | qw(arrival departure sched_arrival sched_departure start datetime)) | ||||||||||||||||||||||||||||||||||||||||||
| 922 | { | ||||||||||||||||||||||||||||||||||||||||||
| 923 | 0 | ▶ | if ( defined $copy{$datetime_key} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 924 | 0 | $copy{$datetime_key} = $copy{$datetime_key}->epoch; | |||||||||||||||||||||||||||||||||||||||||
| 925 | } | ||||||||||||||||||||||||||||||||||||||||||
| 926 | } | ||||||||||||||||||||||||||||||||||||||||||
| 927 | |||||||||||||||||||||||||||||||||||||||||||
| 928 | 0 | return {%copy}; | |||||||||||||||||||||||||||||||||||||||||
| 929 | } | ||||||||||||||||||||||||||||||||||||||||||
| 930 | |||||||||||||||||||||||||||||||||||||||||||
| 931 | # }}} | ||||||||||||||||||||||||||||||||||||||||||
| 932 | |||||||||||||||||||||||||||||||||||||||||||
| 933 | 7 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 934 | |||||||||||||||||||||||||||||||||||||||||||
| 935 | __END__ | ||||||||||||||||||||||||||||||||||||||||||