| 1 | package Box::Calc::Layer; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 12 | $Box::Calc::Layer::VERSION = '1.0205'; | |||||||||||||||||||||||||||||||||||||||||
| 3 | 12 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 12 | ▶ | use Moose; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 12 | ▶ | use Box::Calc::Row; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 12 | ▶ | use List::Util qw/sum/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 12 | ▶ | use Log::Any qw($log); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 12 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | Box::Calc::Layer - A box is packed with multiple layers. | ||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | version 1.0205 | ||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | my $row = Box::Calc::Row->new(max_x => 6); | ||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | =head2 new(params) | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | Constructor. | ||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | B<NOTE:> A layer is automatically created containing a single empty L<Box::Calc::Row>. | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | =item max_x | ||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | The maximimum width of the layer. This is equivalent to the C<x> or longest dimension of the containing box. | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | =item max_y | ||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | The maximimum depth of the layer. This is equivalent to the C<y> or middle dimension of the containing box. | ||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | =head2 fill_x() | ||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | Returns how full the layer is in the C<x> dimension. | ||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | sub fill_x { | ||||||||||||||||||||||||||||||||||||||||||
| 49 | 1641 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fill_x: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | 1641 | my $value = 0; | |||||||||||||||||||||||||||||||||||||||||
| 51 | 1641 | foreach my $row (@{$self->rows}) { | |||||||||||||||||||||||||||||||||||||||||
| 52 | 12097 | ▶ | $value = $row->fill_x if $row->fill_x > $value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | 1641 | return sprintf ("%.4f", $value); | |||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | =head2 fill_y() | ||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | Returns how full the layer is in the C<y> dimension. | ||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | sub fill_y { | ||||||||||||||||||||||||||||||||||||||||||
| 64 | 40256 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fill_y: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | 40256 | my $value = 0; | |||||||||||||||||||||||||||||||||||||||||
| 66 | 40256 | foreach my $row (@{$self->rows}) { | |||||||||||||||||||||||||||||||||||||||||
| 67 | 320848 | $value += $row->fill_y; | |||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||
| 69 | 40256 | return sprintf ("%.4f", $value); | |||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | =head2 fill_z() | ||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | Returns how full the layer is in the C<z> dimension. | ||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | sub fill_z { | ||||||||||||||||||||||||||||||||||||||||||
| 79 | 671874 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fill_z: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 80 | 671874 | my $value = 0; | |||||||||||||||||||||||||||||||||||||||||
| 81 | 671874 | foreach my $row (@{$self->rows}) { | |||||||||||||||||||||||||||||||||||||||||
| 82 | 4687751 | ▶ | $value = $row->fill_z if $row->fill_z > $value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||
| 84 | 671874 | return sprintf ("%.4f", $value); | |||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||
| 87 | =head2 max_x() | ||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | Returns the maximum C<x> dimension of this layer. See C<new> for details. | ||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | 12 | has max_x => ( | |||||||||||||||||||||||||||||||||||||||||
| 94 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||
| 95 | required => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 96 | isa => 'Num', | ||||||||||||||||||||||||||||||||||||||||||
| 97 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||
| 99 | =head2 max_y() | ||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | Returns the maximum C<y> dimension of this layer. See C<new> for details. | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | 12 | has max_y => ( | |||||||||||||||||||||||||||||||||||||||||
| 106 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||
| 107 | required => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 108 | isa => 'Num', | ||||||||||||||||||||||||||||||||||||||||||
| 109 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | =head2 rows() | ||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | Returns an array reference of the list of L<Box::Calc::Row> contained in this layer. | ||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | =head2 count_rows() | ||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||
| 117 | Returns the number of rows contained in this layer. | ||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | has rows => ( | ||||||||||||||||||||||||||||||||||||||||||
| 122 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 123 | isa => 'ArrayRef[Box::Calc::Row]', | ||||||||||||||||||||||||||||||||||||||||||
| 124 | 854 | ▶ | default => sub { [] }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 125 | 12 | traits => ['Array'], | |||||||||||||||||||||||||||||||||||||||||
| 126 | handles => { | ||||||||||||||||||||||||||||||||||||||||||
| 127 | count_rows => 'count', | ||||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||
| 129 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||
| 131 | =head2 create_row() | ||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | Adds a new L<Box::Calc::Row> to this layer. | ||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||
| 137 | sub create_row { | ||||||||||||||||||||||||||||||||||||||||||
| 138 | 5414 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_row: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | 5414 | push @{$self->rows}, Box::Calc::Row->new(max_x => $self->max_x); | |||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||
| 142 | sub BUILD { | ||||||||||||||||||||||||||||||||||||||||||
| 143 | 854 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BUILD: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 144 | 854 | $self->create_row; | |||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | =head2 calculate_weight() | ||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||
| 149 | Calculates and returns the weight of all the rows in this layer. | ||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | sub calculate_weight { | ||||||||||||||||||||||||||||||||||||||||||
| 154 | 528 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
calculate_weight: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 155 | 528 | my $weight = 0; | |||||||||||||||||||||||||||||||||||||||||
| 156 | 528 | foreach my $row (@{$self->rows}) { | |||||||||||||||||||||||||||||||||||||||||
| 157 | 3894 | $weight += $row->calculate_weight; | |||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||
| 159 | 528 | return $weight; | |||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||
| 162 | =head2 pack_item(item) | ||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||
| 164 | Add a L<Box::Calc::Item> to this layer. | ||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | Returns 1 on success or 0 on failure. | ||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||
| 168 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | =item item | ||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | The L<Box::Calc::Item> instance you want to add to this layer. | ||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||
| 176 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||
| 178 | sub pack_item { | ||||||||||||||||||||||||||||||||||||||||||
| 179 | 33222 | ▶ | my ($self, $item, $count) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pack_item: called CC=9 SCAR=22.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 180 | 33222 | ▶ | $count ||= 1; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$count ||= 1
MC/DC100%1/1
$count ||= 1
$count
Truth table100%2/2
A
A= $count
| |||||||||||||||||||||||||||||||||||||||||||
| 181 | 33222 | ▶ | if ($count > 5) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | $log->warn($item->{name}.' is causing infinite recursion in Box::Calc::Layer'); | |||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | $log->debug(Dumper($item)); | |||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||
| 186 | 33222 | my $fill_z = $self->fill_z; | |||||||||||||||||||||||||||||||||||||||||
| 187 | 33222 | my $fill_y = $self->fill_y; | |||||||||||||||||||||||||||||||||||||||||
| 188 | 33222 | ▶ | if ($item->y > $self->max_y - $fill_y + $self->rows->[-1]->fill_y # item would make the layer too wide | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | ) { | ||||||||||||||||||||||||||||||||||||||||||
| 190 | 3 | $log->info($item->{name}.' would make the layer too wide, requesting new layer.'); | |||||||||||||||||||||||||||||||||||||||||
| 191 | 3 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||
| 193 | 33219 | ▶ | if ($fill_z > 0 && $item->z > $fill_z * 1.75 && $item->y < $fill_y) { # item would make the layer substantially taller, unless the layer is currently pretty narrow | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$fill_z > 0 and $item->z > $fill_z * "1.75" and $item->y < $fill_y
$fill_z > 0 and $item->z > $fill_z * "1.75"
MC/DC66%2/3
$fill_z > 0 and $item->z > $fill_z * "1.75" and $item->y < $fill_y
$fill_z > 0
$item->z > $fill_z * "1.75"
$item->y < $fill_y
Truth table75%3/4
A and B and C
A= $fill_z > 0B= $item->z > $fill_z * "1.75"C= $item->y < $fill_y
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | 3 | $log->info($item->{name}.' would make this layer substantially taller, requesting new layer.'); | |||||||||||||||||||||||||||||||||||||||||
| 195 | 3 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||
| 197 | 33216 | ▶ | if ($self->rows->[-1]->pack_item($item)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | 27823 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||
| 200 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 201 | 5393 | ▶ | if ($item->y > $self->max_y - $self->fill_y) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | 833 | $log->info($item->{name}.' will not fit in a new row in this layer, requesting new layer.'); | |||||||||||||||||||||||||||||||||||||||||
| 203 | 833 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||
| 205 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 206 | 4560 | $self->create_row; | |||||||||||||||||||||||||||||||||||||||||
| 207 | 4560 | return $self->pack_item($item, $count + 1); | |||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||
| 212 | =head2 packing_list(weight, list) | ||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||
| 214 | Updates a scalar reference with the weight of the layer and a hash reference of all the items in this layer. | ||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||
| 216 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||
| 218 | sub packing_list { | ||||||||||||||||||||||||||||||||||||||||||
| 219 | 515 | ▶ | my ($self, $weight, $list) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
packing_list: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 220 | 515 | foreach my $row (@{$self->rows}) { | |||||||||||||||||||||||||||||||||||||||||
| 221 | 3872 | $row->packing_list($weight, $list) | |||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | =head2 packing_instructions() | ||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | Returns a description of the layer. | ||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | { | ||||||||||||||||||||||||||||||||||||||||||
| 230 | fill_x => 3, | ||||||||||||||||||||||||||||||||||||||||||
| 231 | fill_y => 3, | ||||||||||||||||||||||||||||||||||||||||||
| 232 | fill_z => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 233 | rows => [ ... ], | ||||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||
| 236 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||
| 238 | sub packing_instructions { | ||||||||||||||||||||||||||||||||||||||||||
| 239 | 522 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
packing_instructions: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | return { | ||||||||||||||||||||||||||||||||||||||||||
| 241 | 522 | rows => [ map { $_->packing_instructions } @{ $self->rows } ], | |||||||||||||||||||||||||||||||||||||||||
| 242 | fill_x => $self->fill_x, | ||||||||||||||||||||||||||||||||||||||||||
| 243 | fill_y => $self->fill_y, | ||||||||||||||||||||||||||||||||||||||||||
| 244 | fill_z => $self->fill_z, | ||||||||||||||||||||||||||||||||||||||||||
| 245 | calculated_weight => $self->calculate_weight, | ||||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||
| 250 | =head2 used_volume | ||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||
| 252 | Returns the real used volume for this layer. | ||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | =head2 volume | ||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||
| 256 | Returns the exact volume needed for this layer. | ||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||
| 258 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||
| 261 | sub used_volume { | ||||||||||||||||||||||||||||||||||||||||||
| 262 | 522 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
used_volume: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 263 | 522 | ▶ | return sum map { $_->used_volume || 0 } @{ $self->rows }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||
| 267 | sub volume { | ||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | ▶ | return $_[0]->fill_x * $_[0]->fill_y * $_[0]->fill_z; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
volume: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||
| 271 | 12 | ▶ | no Moose; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 272 | 12 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||
| 274 | =for Pod::Coverage BUILD | ||||||||||||||||||||||||||||||||||||||||||