« blib/lib/Games/RolePlay/MapGen/Generator/Blank.pm
↑ Summary
blib/lib/Games/RolePlay/MapGen/Editor/_jQuery.pm »
| 1 | # vi:filetype=perl: | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | package Games::RolePlay::MapGen::MapQueue::Object; | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use common::sense; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 0 | ▶ | use overload fallback => 1, bool => sub{1}, '0+' => \&n, '""' => \&q, "-=" => \&me, "+=" => \&pe; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
Subroutine
__ANON__: not called CC=1 SCAR=0.2
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 5 | ▶ | sub new { my $class = shift; my $val = shift; bless {q=>1, u=>1, v=>$val}, $class } | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 4 | ▶ | sub desc { | ||||||||||||||||||||||||||
|
Subroutine
desc: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 11 | 4 | my $this = shift; | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 4 | my $r = $this->{v}; | |||||||||||||||||||||||||||
| 14 | 4 | ▶ | $r .= " ($this->{q})" if $this->{q} != 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 15 | 4 | ▶ | $r .= " #$this->{c}" unless $this->{u}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 4 | return $r; | |||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 4 | ▶ | sub attr { | ||||||||||||||||||||||||||
|
Subroutine
attr: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 21 | 4 | my $this = shift; | |||||||||||||||||||||||||||
| 22 | 4 | my $name = shift; | |||||||||||||||||||||||||||
| 23 | 4 | my $that = shift; | |||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 4 | ▶ | return undef unless $name; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 4 | ▶ | $this->{a}{$name} = $that if defined $that; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 28 | 4 | $this->{a}{$name}; | |||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 8 | ▶ | sub q { | ||||||||||||||||||||||||||
|
Subroutine
q: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 32 | 8 | my $this = shift; | |||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 8 | ▶ | return lc("$this->{v} #$this->{c}") unless $this->{u}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | 3 | return lc($this->{v}); | |||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 6 | ▶ | sub n { | ||||||||||||||||||||||||||
|
Subroutine
n: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 39 | 6 | my $this = shift; | |||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 6 | return $this->{q}; | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 1 | ▶ | sub pe { | ||||||||||||||||||||||||||
|
Subroutine
pe: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 45 | 1 | my $this = shift; | |||||||||||||||||||||||||||
| 46 | 1 | my $that = shift; | |||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 1 | $this->{q} += $that; | |||||||||||||||||||||||||||
| 49 | 1 | $this; | |||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 1 | ▶ | sub me { | ||||||||||||||||||||||||||
|
Subroutine
me: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 53 | 1 | my $this = shift; | |||||||||||||||||||||||||||
| 54 | 1 | my $that = shift; | |||||||||||||||||||||||||||
| 55 | 1 | my $ordr = shift; | |||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 1 | ▶ | return ($this->{q} = ($that - $this->{q})) if $ordr; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 58 | 1 | $this->{q} -= $that; | |||||||||||||||||||||||||||
| 59 | 1 | $this; | |||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 1 | my %item_counts; | |||||||||||||||||||||||||||
| 63 | 2 | ▶ | sub quantity { my $this = shift; my $q = shift; $this->{q}=$q if defined $q; $this->{q} } | ||||||||||||||||||||||||||
|
Subroutine
quantity: called CC=2 SCAR=6.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 64 | 1 | ▶ | sub unique { my $this = shift; $this->{u}=1; } | ||||||||||||||||||||||||||
|
Subroutine
unique: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 65 | 5 | ▶ | sub nonunique { my $this = shift; $this->{u}=0; my $num = shift; | ||||||||||||||||||||||||||
|
Subroutine
nonunique: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 66 | 5 | ▶ | if( defined $num ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 67 | 1 | $this->set_item_number($num); | |||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | } else { | ||||||||||||||||||||||||||||
| 70 | 4 | ▶ | unless( exists $this->{c} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 71 | 3 | $this->{c} = ++ $item_counts{$this->{v}}; | |||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||
| 75 | 2 | ▶ | sub set_item_number { | ||||||||||||||||||||||||||
|
Subroutine
set_item_number: called CC=3 SCAR=12.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 76 | 2 | my $this = shift; | |||||||||||||||||||||||||||
| 77 | 2 | my $num = 0+shift; | |||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | 2 | ▶ | $item_counts{$this->{v}} = $num if not exists $item_counts{$this->{v}} or $num > $item_counts{$this->{v}}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not exists $item_counts{$this->{"v"}} or $num > $item_counts{$this->{"v"}}
MC/DC0%0/2
not exists $item_counts{$this->{"v"}} or $num > $item_counts{$this->{"v"}}
not exists $item_counts{$this->{"v"}}
$num > $item_counts{$this->{"v"}}
Truth table33%1/3
not(A) or B
A= not exists $item_counts{$this->{"v"}}B= $num > $item_counts{$this->{"v"}}
| |||||||||||||||||||||||||||||
| 80 | 2 | $this->{c} = $num; | |||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | 1 | "I like GD::Graph."; | |||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | __END__ | ||||||||||||||||||||||||||||