« blib/lib/BalanceOfPower/Role/Diplomat.pm
↑ Summary
lib/BalanceOfPower/Commands/RecallMilitarySupport.pm »
| 1 | package BalanceOfPower::Relations::TradeRoute; | ||||||||||||||
| 2 | 11 | $BalanceOfPower::Relations::TradeRoute::VERSION = '0.300010'; | |||||||||||||
| 3 | 11 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | 11 | ▶ | use v5.10; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 5 | |||||||||||||||
| 6 | 11 | ▶ | use Moo; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 7 | |||||||||||||||
| 8 | 11 | has factor1 => ( | |||||||||||||
| 9 | is => 'ro' | ||||||||||||||
| 10 | ); | ||||||||||||||
| 11 | 11 | has factor2 => ( | |||||||||||||
| 12 | is => 'ro' | ||||||||||||||
| 13 | ); | ||||||||||||||
| 14 | |||||||||||||||
| 15 | 11 | with 'BalanceOfPower::Relations::Role::Relation'; | |||||||||||||
| 16 | |||||||||||||||
| 17 | sub factor_for_node | ||||||||||||||
| 18 | { | ||||||||||||||
| 19 | 0 | ▶ | my $self = shift; | ||||||||||||
|
Subroutine
factor_for_node: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||
| 20 | 0 | my $node = shift; | |||||||||||||
| 21 | 0 | ▶ | if ($self->node1 eq $node) | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 22 | { | ||||||||||||||
| 23 | 0 | return $self->factor1; | |||||||||||||
| 24 | } | ||||||||||||||
| 25 | elsif ($self->node2 eq $node) | ||||||||||||||
| 26 | { | ||||||||||||||
| 27 | 0 | return $self->factor2; | |||||||||||||
| 28 | } | ||||||||||||||
| 29 | else | ||||||||||||||
| 30 | { | ||||||||||||||
| 31 | 0 | return undef; | |||||||||||||
| 32 | } | ||||||||||||||
| 33 | } | ||||||||||||||
| 34 | sub print | ||||||||||||||
| 35 | { | ||||||||||||||
| 36 | 0 | ▶ | my $self = shift; | ||||||||||||
|
Subroutine
print: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||
| 37 | 0 | my $from = shift; | |||||||||||||
| 38 | 0 | ▶ | if($from eq $self->node1) | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 39 | { | ||||||||||||||
| 40 | 0 | return $from . " -[x" . $self->factor1 . "]-> " . $self->node2; | |||||||||||||
| 41 | } | ||||||||||||||
| 42 | elsif($from eq $self->node2) | ||||||||||||||
| 43 | { | ||||||||||||||
| 44 | 0 | return $from . " -[x" . $self->factor2 . "]-> " . $self->node1; | |||||||||||||
| 45 | } | ||||||||||||||
| 46 | } | ||||||||||||||
| 47 | sub dump | ||||||||||||||
| 48 | { | ||||||||||||||
| 49 | 0 | ▶ | my $self = shift; | ||||||||||||
|
Subroutine
dump: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||
| 50 | 0 | my $io = shift; | |||||||||||||
| 51 | 0 | ▶ | my $indent = shift || ""; | ||||||||||||
|
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||
| 52 | 0 | print {$io} $indent . join(";", $self->node1, $self->node2, $self->factor1, $self->factor2) . "\n"; | |||||||||||||
| 53 | } | ||||||||||||||
| 54 | sub load | ||||||||||||||
| 55 | { | ||||||||||||||
| 56 | 0 | ▶ | my $self = shift; | ||||||||||||
|
Subroutine
load: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||
| 57 | 0 | my $data = shift; | |||||||||||||
| 58 | 0 | $data =~ s/^\s+//; | |||||||||||||
| 59 | 0 | chomp $data; | |||||||||||||
| 60 | 0 | my ($node1, $node2, $factor1, $factor2) = split ";", $data; | |||||||||||||
| 61 | 0 | return $self->new(node1 => $node1, node2 => $node2, factor1 => $factor1, factor2 => $factor2); | |||||||||||||
| 62 | } | ||||||||||||||
| 63 | |||||||||||||||
| 64 | |||||||||||||||
| 65 | |||||||||||||||
| 66 | |||||||||||||||
| 67 | |||||||||||||||
| 68 | |||||||||||||||
| 69 | 11 | 1; | |||||||||||||
| 70 | |||||||||||||||
| 71 | |||||||||||||||