| 1 | package Data::Sheet; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use 5.012001; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 1 | require Exporter; | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 1 | our @ISA = qw(Exporter); | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | # Items to export into callers namespace by default. Note: do not export | ||||||||||||||||||||||||||||
| 12 | # names by default without a very good reason. Use EXPORT_OK instead. | ||||||||||||||||||||||||||||
| 13 | # Do not simply export all your public functions/methods/constants. | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | # This allows declaration use Data::Table ':all'; | ||||||||||||||||||||||||||||
| 16 | # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK | ||||||||||||||||||||||||||||
| 17 | # will save memory. | ||||||||||||||||||||||||||||
| 18 | 1 | our %EXPORT_TAGS = ( 'all' => [ qw( | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | ) ] ); | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 1 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 1 | our @EXPORT = qw( | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | ); | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 1 | our $VERSION = '0.01'; | |||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | # Preloaded methods go here. | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=5 SCAR=16.4
Pod
documented
| |||||||||||||||||||||||||||||
| 33 | 1 | my $class = shift; | |||||||||||||||||||||||||||
| 34 | 1 | my ($w, $h, $init) = @_; | |||||||||||||||||||||||||||
| 35 | 1 | ▶ | my $self = { | ||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||
| 36 | width => defined $w ? $w : 1, | ||||||||||||||||||||||||||||
| 37 | height => defined $h ? $h : 1, | ||||||||||||||||||||||||||||
| 38 | initVar => defined $init ? $init : 0, | ||||||||||||||||||||||||||||
| 39 | table1 => [], | ||||||||||||||||||||||||||||
| 40 | table2 => [], | ||||||||||||||||||||||||||||
| 41 | flag => 0, | ||||||||||||||||||||||||||||
| 42 | }; | ||||||||||||||||||||||||||||
| 43 | # Initialize | ||||||||||||||||||||||||||||
| 44 | 1 | ▶ | for(my $i = 0; $i < ($self->{width} * $self->{height}); $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 45 | 12 | push(@{ $self->{table1} }, $self->{initVar}); | |||||||||||||||||||||||||||
| 46 | 12 | push(@{ $self->{table2} }, $self->{initVar}); | |||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | 1 | return bless($self, $class); | |||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 0 | ▶ | sub resize { | ||||||||||||||||||||||||||
|
Subroutine
resize: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||||||||||||||||||||
| 52 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 53 | 0 | my ($w, $h) = @_; | |||||||||||||||||||||||||||
| 54 | 0 | my ($now_x, $now_y); | |||||||||||||||||||||||||||
| 55 | # initialize data | ||||||||||||||||||||||||||||
| 56 | $self->{flag} == 1 ? | ||||||||||||||||||||||||||||
| 57 | $self->{table2} = [] : #initialize table2 | ||||||||||||||||||||||||||||
| 58 | 0 | ▶ | $self->{table1} = []; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 59 | 0 | ▶ | for(my $i = 0; $i < ($w * $h); $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | 0 | ▶ | if($self->{flag} == 1) { #if using table1 | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 61 | 0 | push(@{$self->{table2}}, $self->{initVar}); | |||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | else { | ||||||||||||||||||||||||||||
| 64 | 0 | push(@{$self->{table1}}, $self->{initVar}); | |||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||
| 67 | # copying data | ||||||||||||||||||||||||||||
| 68 | 0 | my $i = 0; | |||||||||||||||||||||||||||
| 69 | 0 | while(1) { | |||||||||||||||||||||||||||
| 70 | 0 | $now_x = $i % $self->{width}; | |||||||||||||||||||||||||||
| 71 | 0 | $now_y = int($i / $self->{width}); | |||||||||||||||||||||||||||
| 72 | 0 | ▶ | if($now_x >= $self->{width} || | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$now_x >= $self->{"width"} or $now_y >= $self->{"height"}
MC/DC0%0/2
$now_x >= $self->{"width"} or $now_y >= $self->{"height"}
$now_x >= $self->{"width"}
$now_y >= $self->{"height"}
Truth table0%0/3
A or B
A= $now_x >= $self->{"width"}B= $now_y >= $self->{"height"}
| |||||||||||||||||||||||||||||
| 73 | $now_y >= $self->{height}) { | ||||||||||||||||||||||||||||
| 74 | 0 | last; | |||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | 0 | ▶ | if($self->{flag} == 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 77 | $self->{table2}[$now_x + $now_y * $w] | ||||||||||||||||||||||||||||
| 78 | 0 | = $self->{table1}[$i]; | |||||||||||||||||||||||||||
| 79 | } else { | ||||||||||||||||||||||||||||
| 80 | $self->{table1}[$now_x + $now_y * $w] | ||||||||||||||||||||||||||||
| 81 | 0 | = $self->{table2}[$i]; | |||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | 0 | $i++; | |||||||||||||||||||||||||||
| 84 | }; | ||||||||||||||||||||||||||||
| 85 | # change flag | ||||||||||||||||||||||||||||
| 86 | 0 | ▶ | if($self->{flag} == 1) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 87 | 0 | $self->{flag} = 0; | |||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||
| 89 | elsif($self->{flag} == 0) { | ||||||||||||||||||||||||||||
| 90 | 0 | $self->{flag} = 1; | |||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||
| 92 | # Resize | ||||||||||||||||||||||||||||
| 93 | 0 | $self->{width} = $w; | |||||||||||||||||||||||||||
| 94 | 0 | $self->{height} = $h; | |||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | 1 | ▶ | sub setCell { | ||||||||||||||||||||||||||
|
Subroutine
setCell: called CC=3 SCAR=11.8
Pod
documented
| |||||||||||||||||||||||||||||
| 98 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 99 | 1 | my ($x, $y, $var) = @_; | |||||||||||||||||||||||||||
| 100 | 1 | ▶ | if($self->{width} * $self->{height} < $x * $y) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 101 | # bad status | ||||||||||||||||||||||||||||
| 102 | 0 | return undef; | |||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||
| 104 | else { | ||||||||||||||||||||||||||||
| 105 | $self->{flag} == 1 ? | ||||||||||||||||||||||||||||
| 106 | $self->{table1}[$y * $self->{width} + $x] = $var : | ||||||||||||||||||||||||||||
| 107 | 1 | ▶ | $self->{table2}[$y * $self->{width} + $x] = $var; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 108 | # good status | ||||||||||||||||||||||||||||
| 109 | 1 | return 0; | |||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | 1 | ▶ | sub getCell { | ||||||||||||||||||||||||||
|
Subroutine
getCell: called CC=3 SCAR=12.0
Pod
documented
| |||||||||||||||||||||||||||||
| 114 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 115 | 1 | my ($x, $y) = @_; | |||||||||||||||||||||||||||
| 116 | 1 | ▶ | if($self->{width} * $self->{height} < $x * $y) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 117 | 0 | return undef; | |||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||
| 119 | else { | ||||||||||||||||||||||||||||
| 120 | $self->{flag} == 1 ? | ||||||||||||||||||||||||||||
| 121 | return $self->{table1}[$y * $self->{width} + $x] : | ||||||||||||||||||||||||||||
| 122 | 1 | ▶ | return $self->{table2}[$y * $self->{width} + $x]; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | 0 | ▶ | sub printSheet { | ||||||||||||||||||||||||||
|
Subroutine
printSheet: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 127 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 128 | 0 | ▶ | for(my $j = 0; $j < $self->{height}; $j++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 129 | 0 | ▶ | for(my $i = 0; $i < $self->{width}; $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 130 | 0 | ▶ | $self->{flag} == 1 ? | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 131 | 0 | print "[@{ $self->{table1} }[$j | |||||||||||||||||||||||||||
| 132 | * $self->{width} + $i]]" : | ||||||||||||||||||||||||||||
| 133 | 0 | print "[@{ $self->{table2} }[$j | |||||||||||||||||||||||||||
| 134 | * $self->{width} + $i]]"; | ||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||
| 136 | 0 | print "\n"; | |||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | 1 | ▶ | sub turnRight { | ||||||||||||||||||||||||||
|
Subroutine
turnRight: called CC=7 SCAR=20.2
Pod
documented
| |||||||||||||||||||||||||||||
| 141 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 142 | 1 | my ($now_x, $now_y); | |||||||||||||||||||||||||||
| 143 | 1 | my ($new_x, $new_y); | |||||||||||||||||||||||||||
| 144 | # initialize data | ||||||||||||||||||||||||||||
| 145 | $self->{flag} == 1 ? | ||||||||||||||||||||||||||||
| 146 | $self->{table2} = [] : | ||||||||||||||||||||||||||||
| 147 | 1 | ▶ | $self->{table1} = []; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 148 | 1 | ▶ | for(my $i = 0; $i < ($self->{width} * $self->{height}); $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 149 | 12 | ▶ | if($self->{flag} == 1) { #if using table1 | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 150 | 0 | push(@{$self->{table2}}, $self->{initVar}); | |||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||
| 152 | else { | ||||||||||||||||||||||||||||
| 153 | 12 | push(@{$self->{table1}}, $self->{initVar}); | |||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||
| 156 | # copy Data | ||||||||||||||||||||||||||||
| 157 | 1 | my $i = 0; | |||||||||||||||||||||||||||
| 158 | 1 | ▶ | while($i < ($self->{width} * $self->{height})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 159 | # Calc current position | ||||||||||||||||||||||||||||
| 160 | 12 | $now_x = $i % $self->{width}; | |||||||||||||||||||||||||||
| 161 | 12 | $now_y = int($i / $self->{width}); | |||||||||||||||||||||||||||
| 162 | # Calc new position | ||||||||||||||||||||||||||||
| 163 | 12 | $new_x = ($self->{height} - 1 - $now_y); | |||||||||||||||||||||||||||
| 164 | 12 | $new_y = $now_x; | |||||||||||||||||||||||||||
| 165 | 12 | ▶ | if($self->{flag} == 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 166 | $self->{table2}[$new_x + $new_y * $self->{height}] | ||||||||||||||||||||||||||||
| 167 | 0 | = $self->{table1}[$i]; | |||||||||||||||||||||||||||
| 168 | } else { | ||||||||||||||||||||||||||||
| 169 | $self->{table1}[$new_x + $new_y * $self->{height}] | ||||||||||||||||||||||||||||
| 170 | 12 | = $self->{table2}[$i]; | |||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||
| 172 | 12 | $i++; | |||||||||||||||||||||||||||
| 173 | }; | ||||||||||||||||||||||||||||
| 174 | ($self->{width}, $self->{height}) = | ||||||||||||||||||||||||||||
| 175 | 1 | ($self->{height}, $self->{width}); | |||||||||||||||||||||||||||
| 176 | #change Flag | ||||||||||||||||||||||||||||
| 177 | 1 | ▶ | if($self->{flag} == 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 178 | 0 | $self->{flag} = 0; | |||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||
| 180 | else { | ||||||||||||||||||||||||||||
| 181 | 1 | $self->{flag} = 1; | |||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||
| 185 | 1 | ▶ | sub turnLeft { | ||||||||||||||||||||||||||
|
Subroutine
turnLeft: called CC=7 SCAR=20.2
Pod
documented
| |||||||||||||||||||||||||||||
| 186 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 187 | 1 | my ($now_x, $now_y); | |||||||||||||||||||||||||||
| 188 | 1 | my ($new_x, $new_y); | |||||||||||||||||||||||||||
| 189 | # initialize data | ||||||||||||||||||||||||||||
| 190 | $self->{flag} == 1 ? | ||||||||||||||||||||||||||||
| 191 | $self->{table2} = [] : | ||||||||||||||||||||||||||||
| 192 | 1 | ▶ | $self->{table1} = []; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 193 | 1 | ▶ | for(my $i = 0; $i < ($self->{width} * $self->{height}); $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 194 | 12 | ▶ | if($self->{flag} == 1) { #if using table1 | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 195 | 12 | push(@{$self->{table2}}, $self->{initVar}); | |||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||
| 197 | else { | ||||||||||||||||||||||||||||
| 198 | 0 | push(@{$self->{table1}}, $self->{initVar}); | |||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||
| 201 | # copy Data | ||||||||||||||||||||||||||||
| 202 | 1 | my $i = 0; | |||||||||||||||||||||||||||
| 203 | 1 | ▶ | while($i < ($self->{width} * $self->{height})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 204 | # Calc current position | ||||||||||||||||||||||||||||
| 205 | 12 | $now_x = $i % $self->{width}; | |||||||||||||||||||||||||||
| 206 | 12 | $now_y = int($i / $self->{width}); | |||||||||||||||||||||||||||
| 207 | # Calc new position | ||||||||||||||||||||||||||||
| 208 | 12 | $new_x = $now_y; | |||||||||||||||||||||||||||
| 209 | 12 | $new_y = ($self->{width} - 1 - $now_x); | |||||||||||||||||||||||||||
| 210 | 12 | ▶ | if($self->{flag} == 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 211 | $self->{table2}[$new_x + $new_y * $self->{height}] | ||||||||||||||||||||||||||||
| 212 | 12 | = $self->{table1}[$i]; | |||||||||||||||||||||||||||
| 213 | } else { | ||||||||||||||||||||||||||||
| 214 | $self->{table1}[$new_x + $new_y * $self->{height}] | ||||||||||||||||||||||||||||
| 215 | 0 | = $self->{table2}[$i]; | |||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||
| 217 | 12 | $i++; | |||||||||||||||||||||||||||
| 218 | }; | ||||||||||||||||||||||||||||
| 219 | ($self->{width}, $self->{height}) = | ||||||||||||||||||||||||||||
| 220 | 1 | ($self->{height}, $self->{width}); | |||||||||||||||||||||||||||
| 221 | #change Flag | ||||||||||||||||||||||||||||
| 222 | 1 | ▶ | if($self->{flag} == 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 223 | 1 | $self->{flag} = 0; | |||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||
| 225 | else { | ||||||||||||||||||||||||||||
| 226 | 0 | $self->{flag} = 1; | |||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | 0 | ▶ | sub getRow { | ||||||||||||||||||||||||||
|
Subroutine
getRow: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 231 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 232 | 0 | my $row = shift; | |||||||||||||||||||||||||||
| 233 | 0 | ▶ | if($row > ($self->{height} - 1) || | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$row > $self->{"height"} - 1 or $row < 0
MC/DC0%0/2
$row > $self->{"height"} - 1 or $row < 0
$row > $self->{"height"} - 1
$row < 0
Truth table0%0/3
A or B
A= $row > $self->{"height"} - 1B= $row < 0
| |||||||||||||||||||||||||||||
| 234 | $row < 0) { | ||||||||||||||||||||||||||||
| 235 | 0 | return undef; | |||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||
| 237 | 0 | my @rowArray = (); | |||||||||||||||||||||||||||
| 238 | 0 | ▶ | for(my $i = 0; $i < $self->{width}; $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 239 | $self->{flag} == 1 ? | ||||||||||||||||||||||||||||
| 240 | 0 | push(@rowArray, @{$self->{table1}}[$row * $self->{width} + $i]) : | |||||||||||||||||||||||||||
| 241 | 0 | ▶ | push(@rowArray, @{$self->{table2}}[$row * $self->{width} + $i]); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||
| 243 | 0 | return @rowArray; | |||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||
| 246 | 2 | ▶ | sub getCol { | ||||||||||||||||||||||||||
|
Subroutine
getCol: called CC=5 SCAR=16.6
Pod
documented
| |||||||||||||||||||||||||||||
| 247 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 248 | 2 | my $col = shift; | |||||||||||||||||||||||||||
| 249 | 2 | ▶ | if($col > ($self->{width} - 1) || | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$col > $self->{"width"} - 1 or $col < 0
MC/DC0%0/2
$col > $self->{"width"} - 1 or $col < 0
$col > $self->{"width"} - 1
$col < 0
Truth table33%1/3
A or B
A= $col > $self->{"width"} - 1B= $col < 0
| |||||||||||||||||||||||||||||
| 250 | $col < 0) { | ||||||||||||||||||||||||||||
| 251 | 0 | return undef; | |||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||
| 253 | 2 | my @colArray = (); | |||||||||||||||||||||||||||
| 254 | 2 | ▶ | for(my $i = 0; $i < $self->{height}; $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 255 | $self->{flag} == 1 ? | ||||||||||||||||||||||||||||
| 256 | 3 | push(@colArray, @{$self->{table1}}[$col + $self->{width} * $i]) : | |||||||||||||||||||||||||||
| 257 | 7 | ▶ | push(@colArray, @{$self->{table2}}[$col + $self->{width} * $i]); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||
| 259 | 2 | return @colArray; | |||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | 0 | ▶ | sub setRow { | ||||||||||||||||||||||||||
|
Subroutine
setRow: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 263 | 0 | my ($self,$row,$data) = @_; | |||||||||||||||||||||||||||
| 264 | 0 | ▶ | if($row > ($self->{height} - 1) || | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$row > $self->{"height"} - 1 or $row < 0
MC/DC0%0/2
$row > $self->{"height"} - 1 or $row < 0
$row > $self->{"height"} - 1
$row < 0
Truth table0%0/3
A or B
A= $row > $self->{"height"} - 1B= $row < 0
| |||||||||||||||||||||||||||||
| 265 | $row < 0) { | ||||||||||||||||||||||||||||
| 266 | 0 | return 1; | |||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||
| 268 | 0 | ▶ | for(my $i = 0; $i < $self->{width} && $i < ($#{$data} + 1); $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$i < $self->{"width"} and $i < $#{$data;} + 1
MC/DC0%0/2
$i < $self->{"width"} and $i < $#{$data;} + 1
$i < $self->{"width"}
$i < $#{$data;} + 1
Truth table0%0/3
A and B
A= $i < $self->{"width"}B= $i < $#{$data;} + 1
| |||||||||||||||||||||||||||||
| 269 | 0 | ▶ | if($self->{flag} == 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 270 | 0 | @{$self->{table1}}[$row * $self->{width} + $i] = ${$data}[$i]; | |||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||
| 272 | else { | ||||||||||||||||||||||||||||
| 273 | 0 | @{$self->{table2}}[$row * $self->{width} + $i] = ${$data}[$i]; | |||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||
| 276 | 0 | return 0; | |||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||
| 279 | 0 | ▶ | sub setCol { | ||||||||||||||||||||||||||
|
Subroutine
setCol: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 280 | 0 | my ($self, $col, $data) = @_; | |||||||||||||||||||||||||||
| 281 | 0 | ▶ | if($col > ($self->{width} - 1) || | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$col > $self->{"width"} - 1 or $col < 0
MC/DC0%0/2
$col > $self->{"width"} - 1 or $col < 0
$col > $self->{"width"} - 1
$col < 0
Truth table0%0/3
A or B
A= $col > $self->{"width"} - 1B= $col < 0
| |||||||||||||||||||||||||||||
| 282 | $col < 0) { | ||||||||||||||||||||||||||||
| 283 | 0 | return 1; | |||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||
| 285 | 0 | ▶ | for(my $i = 0; $i < $self->{height} && $i < ($#{$data} + 1); $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$i < $self->{"height"} and $i < $#{$data;} + 1
MC/DC0%0/2
$i < $self->{"height"} and $i < $#{$data;} + 1
$i < $self->{"height"}
$i < $#{$data;} + 1
Truth table0%0/3
A and B
A= $i < $self->{"height"}B= $i < $#{$data;} + 1
| |||||||||||||||||||||||||||||
| 286 | 0 | ▶ | if($self->{flag} == 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 287 | 0 | @{$self->{table1}}[$col + $self->{width} * $i] = ${$data}[$i]; | |||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||
| 289 | else { | ||||||||||||||||||||||||||||
| 290 | 0 | @{$self->{table2}}[$col + $self->{width} * $i] = ${$data}[$i]; | |||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||
| 293 | 0 | return 0; | |||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||
| 296 | 1 | 1; | |||||||||||||||||||||||||||
| 297 | __END__ | ||||||||||||||||||||||||||||