| 1 | package WWW::EFA::LineFactory; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 2 | ▶ | use Moose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use WWW::EFA::Line; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use WWW::EFA::Location; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use YAML; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | A Factory for creating L<WWW::EFA::Line> objects. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | Version 0.01 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 2 | our $VERSION = '0.01'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | my $factory = WWW::EFA::LineFactory->new(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | =head1 ATTRIBUTES | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | TODO: RCL 2012-01-22 Documentation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | has 'mot_mapping' => ( is => 'ro', isa => 'HashRef', required => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | ▶ | default => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | 1 => 'S', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 2 => 'U', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 3 => 'T', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 4 => 'T', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 5 => 'B', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 6 => 'B', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 7 => 'B', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 10 => 'B', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 8 => 'C', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 9 => 'F', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 11 => '?', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | -1 => '?', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 2 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | has 'train_name_mapping' => ( is => 'ro', isa => 'HashRef', required => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | default => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | 'S-Bahn' => 'S', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 'U-Bahn' => 'U', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 'Straßenbahn' => 'T', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | # TODO: RCL 2011-11-07 Complete this list from AbstractEfaProvider... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 2 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | has 'mot0_mapping' => ( is => 'ro', isa => 'HashRef', required => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | default => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | 'EC' => 'I', # Eurocity | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 'EN' => 'I', # Euronight | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 'IC' => 'I', # Intercity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 'ICE' => 'I', # Intercity Express | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 'IR' => 'R', # Interregio | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 'IRE' => 'R', # Interregio-Express | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 'RE' => 'R', # Regional-Express | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | # TODO: RCL 2011-11-07 Complete this list from AbstractEfaProvider | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 2 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | =head2 line_from_itdServingLine | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | Returns a L<WWW::EFA::Line> object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | my $location = $factory->line_from_itdServingLine( $doc->findnodes( 'itdServingLine' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | Expects an XML::LibXML::Element of XML like this: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | <itdServingLine selected="1" code="2" number="S1" symbol="S1" motType="1" realtime="0" direction="Ostbahnhof" valid="Fahrplan (2011)" compound="0" TTB="0" STT="0" ROP="0" type="unknown" spTr="" destID="5" stateless="mvv:01001: :H:s11" trainName="" index="1:0"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | <itdNoTrain name="S-Bahn"/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | <motDivaParams line="01001" project="s11" direction="H" supplement=" " network="mvv"/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | <itdRouteDescText>Freising - Neufahrn - Hauptbahnhof - Ostbahnhof</itdRouteDescText> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | <itdOperator> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | <code>01</code> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | <name>DB Regio AG </name> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | </itdOperator> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | </itdServingLine> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | sub line_from_itdServingLine { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
line_from_itdServingLine: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | my $element = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | my( $diva_params_elem ) = $element->findnodes( 'motDivaParams[position()=1]' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | my( $route_desc_elem ) = $element->findnodes( 'itdRouteDescText[position()=1]' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | my( $no_train_elem ) = $element->findnodes( 'itdNoTrain[position()=1]' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | my %location_params = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | id => $element->getAttribute( 'destID' ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | name => $element->getAttribute( 'direction' ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | my $destination = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | if( $location_params{id} ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | $destination = WWW::EFA::Location->new( %location_params ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | my $label = $self->_label_for_line( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | mot => $element->getAttribute( 'motType' ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | name => $element->getAttribute( 'number' ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | name_long => $element->getAttribute( 'number' ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | no_train_name => $no_train_elem->getAttribute( 'name' ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | my $colour = '>no colour<'; # TODO: RCL 2011-11-09 Find real colour | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | my %line_params = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | id => $element->getAttribute( 'stateless' ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | mot => $element->getAttribute( 'motType' ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | realtime => $element->getAttribute( 'realtime' ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | number => $element->getAttribute( 'number' ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | symbol => $element->getAttribute( 'symbol' ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | code => $element->getAttribute( 'code' ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | label => $label, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | # colour => $colour, # TODO: RCL 2011-11-07 when real colour available, reactivate | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | direction => $diva_params_elem->getAttribute( 'direction' ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | line => $diva_params_elem->getAttribute( 'line' ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | ▶ | $line_params{destination} = $destination if $destination; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | ▶ | $line_params{route_description} = $route_desc_elem->textContent() if( $route_desc_elem ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | my $line = WWW::EFA::Line->new( %line_params ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | return $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | # Generate a standardised line description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | # Expect some combination of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | # %params = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | # mot => 'motType', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | # name => 'name', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | # long_name => 'name', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | # no_train_name => 'no_train_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | # ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | sub _label_for_line { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_label_for_line: not called CC=24 SCAR=64.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | my %params = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | if( not $params{mot} ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | if( not $params{no_train_name} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$params{"no_train_name"} and $self->train_name_mapping->{$params{"no_train_name"}}
MC/DC0%0/2
$params{"no_train_name"} and $self->train_name_mapping->{$params{"no_train_name"}}
$params{"no_train_name"}
$self->train_name_mapping->{$params{"no_train_name"}}
Truth table0%0/3
A and B
A= $params{"no_train_name"}B= $self->train_name_mapping->{$params{"no_train_name"}}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | or not $self->train_name_mapping->{ $params{no_train_name} } ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | croak( "Cannot normalise mot: " . Dump( \%params ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | return sprintf( '%s%s', $self->train_name_mapping->{ $params{no_train_name} }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | ( $params{name} || '' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$params{'name'} || ''
MC/DC0%0/1
$params{'name'} || ''
$params{'name'}
Truth table0%0/2
A
A= $params{'name'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | if( $params{mot} eq '0' ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | # TODO: RCL 2011-11-07 Test this in the wild and refine - no data tested yet... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | my @parts = split( ' ', $params{long_name} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | my $type = $parts[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | ▶ | my $num = ( scalar( @parts ) >= 2 ? $parts[1] : undef ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | my $str = sprintf( '%s%s', $type, ( $num || '' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$num || ''
MC/DC0%0/1
$num || ''
$num
Truth table0%0/2
A
A= $num
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | if( not $self->mot0_mapping->{ $type } ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | croak( "Cannot normalise mot: " . Dump( \%params ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | return sprintf( '%s%s', $self->mot0_mapping->{ $type }, $str ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | # TODO: RCL 2011-11-09 use $self->mot_mapping | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | ▶ | if( $params{mot} eq '1' ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | ▶ | if( $params{name} =~ m/^(S\d+)/ ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | return $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | return 'S' . $params{name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | if( $params{mot} eq '2' ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | if( $params{name} =~ m/^(U\d+)/ ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | return $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | return 'U' . $params{name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | if( $params{mot} eq '3' or $params{mot} eq '4' ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$params{"mot"} eq 3 or $params{"mot"} eq 4
MC/DC0%0/2
$params{"mot"} eq 3 or $params{"mot"} eq 4
$params{"mot"} eq 3
$params{"mot"} eq 4
Truth table0%0/3
A or B
A= $params{"mot"} eq 3B= $params{"mot"} eq 4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | return 'T' . $params{name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | if( $params{mot} eq '5' or $params{mot} eq '6' or $params{mot} eq '7' or $params{mot} eq '10' ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$params{"mot"} eq 5 or $params{"mot"} eq 6 or $params{"mot"} eq 7 or $params{"mot"} eq 10
$params{"mot"} eq 5 or $params{"mot"} eq 6 or $params{"mot"} eq 7
$params{"mot"} eq 5 or $params{"mot"} eq 6
MC/DC0%0/4
$params{"mot"} eq 5 or $params{"mot"} eq 6 or $params{"mot"} eq 7 or $params{"mot"} eq 10
$params{"mot"} eq 5
$params{"mot"} eq 6
$params{"mot"} eq 7
$params{"mot"} eq 10
Truth table0%0/5
A or B or C or D
A= $params{"mot"} eq 5B= $params{"mot"} eq 6C= $params{"mot"} eq 7D= $params{"mot"} eq 10
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | ▶ | if( $params{name} eq 'Schienenersatzverkehr' ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | return 'BSEV'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | }else{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | return 'B' . $params{name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | ▶ | if( $params{mot} eq '8' ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | return 'C' . $params{name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | ▶ | if( $params{mot} eq '9' ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | return 'F' . $params{name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | ▶ | if( $params{mot} eq '11' or $params{mot} eq '-1' ){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$params{"mot"} eq 11 or $params{"mot"} eq -1
MC/DC0%0/2
$params{"mot"} eq 11 or $params{"mot"} eq -1
$params{"mot"} eq 11
$params{"mot"} eq -1
Truth table0%0/3
A or B
A= $params{"mot"} eq 11B= $params{"mot"} eq -1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | return '?' . $params{name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | croak( "Cannot normalise mot: " . Dump( \%params ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | Copyright 2011, Robin Clarke, Munich, Germany | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | Robin Clarke <perl@robinclarke.net> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||