| 1 | package Graph::Maker::Grid; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 4 | ▶ | use Carp qw/croak/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 4 | ▶ | use base qw/Graph::Maker/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 4 | ▶ | use Graph; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 4 | ▶ | use Graph::Maker; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 4 | ▶ | use Graph::Maker::Utils qw/cartesian_product/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 4 | ▶ | use Graph::Maker::Cycle; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 4 | ▶ | use Graph::Maker::Linear; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 4 | our $VERSION = '0.01'; | |||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | sub init | ||||||||||||||||||||||||||||||||||||||||||
| 16 | 13 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=7 SCAR=20.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 13 | my ($self, %params) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | 13 | my $dims = delete($params{dims}); | |||||||||||||||||||||||||||||||||||||||||
| 20 | 13 | ▶ | my $per = delete($params{cyclic}) ? 'cycle' : 'linear'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | croak "dims must be an ARRAYREF specifying the dimension with positive numbers" unless defined($dims) | ||||||||||||||||||||||||||||||||||||||||||
| 23 | && ref($dims) eq 'ARRAY' | ||||||||||||||||||||||||||||||||||||||||||
| 24 | 13 | ▶ | && 0 == grep {$_ <= 0} @$dims; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $dims and ref $dims eq "ARRAY" and 0 == grep({$_ <= 0;} @$dims)
defined $dims and ref $dims eq "ARRAY"
MC/DC0%0/3
defined $dims and ref $dims eq "ARRAY" and 0 == grep({$_ <= 0;} @$dims)
defined $dims
ref $dims eq "ARRAY"
0 == grep({$_ <= 0;} @$dims)
Truth table25%1/4
A and B and C
A= defined $dimsB= ref $dims eq "ARRAY"C= 0 == grep({$_ <= 0;} @$dims)
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 13 | my $g = new Graph::Maker($per, N => $dims->[0], %params); | |||||||||||||||||||||||||||||||||||||||||
| 27 | 13 | ▶ | return $g if @$dims == 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | 13 | my ($gn, $go); | |||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 13 | foreach my $d(@$dims[1..@$dims-1]) | |||||||||||||||||||||||||||||||||||||||||
| 32 | { | ||||||||||||||||||||||||||||||||||||||||||
| 33 | 17 | $gn = Graph::Maker->new($per, N => $d, %params); | |||||||||||||||||||||||||||||||||||||||||
| 34 | 17 | $go = $g->copy(); | |||||||||||||||||||||||||||||||||||||||||
| 35 | 17 | $g = cartesian_product($gn, $go); | |||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | 13 | return $g; | |||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | 4 | Graph::Maker->add_factory_type( 'grid' => __PACKAGE__ ); | |||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | __DATA__ | ||||||||||||||||||||||||||||||||||||||||||