blib/lib/StorageDisplay/Role.pm

filter: Statementstmt 90.9% 464 / 510 Branchbran 68.0% 68 / 100 Conditioncond 63.6% 28 / 44 MC/DCmcdc 36.0% 9 / 25 Subroutinesub 93.6% 89 / 95 Podpod 0.0% 0 / 19 totaltotal 82.9% 658 / 793 CC 74 SCAR 17.3
CC
74
Cov
86%
__ANON__
21.4
_compute_next
21.4
__ANON__
9.2
CRAP 5.7
« blib/lib/StorageDisplay/Data/FS.pm ↑ Summary blib/lib/StorageDisplay/Data/Elem.pm »
1 #
2 # This file is part of StorageDisplay
3 #
4 # This software is copyright (c) 2014-2023 by Vincent Danjean.
5 #
6 # This is free software; you can redistribute it and/or modify it under
7 # the same terms as the Perl 5 programming language system itself.
8 #
9 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 package StorageDisplay::Role;
13 # ABSTRACT: Load all roles used in StorageDisplay
14  
15 10 our $VERSION = '2.06'; # VERSION
16  
17 10 1;
18  
19 ##################################################################
20 package StorageDisplay::Role::ProvideName::Plain;
21  
22 10 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 sub name; # forward decl for 'requires'
25 10 has 'name' => (
26 is => 'ro',
27 isa => 'Str',
28 init_arg => 'name',
29 required => 1,
30 );
31  
32 10 1;
33  
34 ##################################################################
35 package StorageDisplay::Role::ProvideName::Recursive;
36  
37 10 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
38 10 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
39  
40 10 requires 'has_parent';
41  
42 has '_name' => (
43 is => 'ro',
44 isa => 'Str',
45 init_arg => 'name',
46 required => 1,
47 lazy => 1,
48 0 ▶ default => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
49 0 my $self = shift;
50 0 ▶ if (!$self->ignore_name) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->ignore_name) 0 0 0
51 0 confess "no name provided and ignore_name not set in $self\n";
52 }
53 0 return "NONAME";
54 },
55 10 );
56  
57 sub name; # forward decl for 'requires'
58 has 'name' => (
59 is => 'ro',
60 isa => 'Str',
61 init_arg => undef,
62 required => 1,
63 lazy => 1,
64 557 ▶ default => sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
65 557 my $self = shift;
66 557 my $lname = $self->name_prefix;
67 557 ▶ if (!$self->ignore_name) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->ignore_name) 495 62 557
68 495 $lname .= '@'.$self->_name;
69 }
70 #print STDERR "In $self\t: using $lname as name\n";
71 557 return $lname;
72 },
73 10 );
74  
75 has 'fullname' => (
76 is => 'ro',
77 isa => 'Str',
78 init_arg => undef,
79 required => 1,
80 lazy => 1,
81 418 ▶ default => sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
82 418 my $self = shift;
83 418 my $lname = $self->fullname_prefix;
84 418 ▶ if (!$self->ignore_name) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->ignore_name) 377 41 418
85 377 $lname .= '@'.$self->_name;
86 }
87 418 ▶ if (! $self->has_parent) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->has_parent) 7 411 418
88 #print STDERR "no parent in fullname for $self\n";
89 7 return $lname;
90 }
91 411 my $fullname = join('|', $self->parent->fullname, $lname);
92 #print STDERR "In $self\t: using $fullname as fullname\n";
93 411 return $fullname;
94 },
95 10 );
96  
97 has 'name_prefix' => (
98 is => 'ro',
99 isa => 'Str',
100 required => 1,
101 lazy => 1,
102 550 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
103 550 my $self = shift;
104 550 my $kind = ref($self);
105 550 $kind =~ s/^StorageDisplay::Data:://;
106 550 return $kind;
107 },
108 10 );
109  
110 has 'fullname_prefix' => (
111 is => 'ro',
112 isa => 'Str',
113 init_arg => undef,
114 required => 1,
115 lazy => 1,
116 418 ▶ default => sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
117 418 my $self = shift;
118 418 my $kind = ref($self);
119 418 $kind =~ s/^StorageDisplay::Data:://;
120 418 my $name_prefix = $self->name_prefix;
121 418 ▶ if ($kind ne $name_prefix) {
Branch: 1 branch
BranchTrueFalseTotal
if ($kind ne $name_prefix) 7 411 418
122 7 return $name_prefix;
123 }
124 411 ▶ if ($self->has_parent) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->has_parent) 411 0 411
125 411 my $pkind = ref($self->parent);
126 411 $pkind =~ s/^StorageDisplay::Data:://;
127 411 $kind =~ s/^$pkind//;
128 }
129 411 return $kind;
130 },
131 10 );
132  
133 10 has 'ignore_name' => (
134 is => 'ro',
135 isa => 'Bool',
136 required => 1,
137 lazy => 1,
138 default => 0,
139 );
140  
141 10 1;
142  
143 ##################################################################
144 package StorageDisplay::Role::WithName;
145  
146 10 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
147  
148 10 requires 'name';
149  
150 10 1;
151  
152 ##################################################################
153 package StorageDisplay::Role::Iterable;
154  
155 10 ▶use MooseX::Role::Parameterized;
Subroutine BEGIN: called CC=1 SCAR=0.0
156 10 ▶use Types::Standard qw(Enum);
Subroutine BEGIN: called CC=1 SCAR=0.0
157  
158 10 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
159  
160 10 parameter iterable => (
161 isa => 'Str',
162 required => 1,
163 );
164  
165 10 parameter _kindname => (
166 is => 'ro',
167 isa => Enum[qw/Plain Recursive/],
168 init_arg => 'name',
169 required => 1,
170 #default => "Plain",
171 );
172  
173 19 ▶role {
Subroutine __ANON__: called CC=1 SCAR=0.1
174 19 my $p = shift;
175 19 my $role_provide = "StorageDisplay::Role::ProvideName::".$p->_kindname;
176  
177 19 with (
178 $role_provide,
179 "StorageDisplay::Role::WithName",
180 );
181  
182 19 my $iterable = $p->iterable;
183 19 my $iterator = $iterable.'::Iterator';
184 19 my $iteratorframe = $iterator.'::Frame';
185  
186 has '_parents' => (
187 traits => [ 'Hash' ],
188 is => 'ro',
189 isa => "HashRef[$iterable]",
190 required => 1,
191 1530 ▶ default => sub { return {}; },
Subroutine __ANON__: called CC=1 SCAR=0.0
192 19 handles => {
193 '_add_parents' => 'set',
194 'hasParent' => 'exists',
195 '_getParent' => 'get',
196 }
197 );
198  
199 has '_parents_tab' => (
200 traits => [ 'Array' ],
201 is => 'ro',
202 isa => "ArrayRef[$iterable]",
203 required => 1,
204 1530 ▶ default => sub { return []; },
Subroutine __ANON__: called CC=1 SCAR=0.0
205 19 handles => {
206 '_add_parents_tab' => 'push',
207 'parents' => 'elements',
208 'nb_parents' => 'count',
209 }
210 );
211  
212 321 ▶ method "_addParent" => sub {
Subroutine _addParent: called CC=3 SCAR=11.3
213 321 my $self = shift;
214 321 my $parent = shift;
215 321 my $parent_name = $parent->name;
216 321 ▶ if ($self->hasParent($parent_name)) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->hasParent($parent_name)) { } 34 287 321
if ($self->hasParent($parent_name)) { } 0 361 361
217 34 ▶ if ($parent != $self->_getParent($parent_name)) {
Branch: 2 branches
BranchTrueFalseTotal
if ($parent != $self->_getParent($parent_name)) 0 34 34
if ($parent != $self->_getParent($parent_name)) 0 252 252
218 0 croak "Two different parents with name $parent_name for ".$self->name;
219 }
220 } else {
221 287 $self->_add_parents($parent_name, $parent);
222 0 $self->_add_parents_tab($parent);
223 }
224 19 };
225  
226 has '_children' => (
227 traits => [ 'Hash' ],
228 is => 'ro',
229 isa => "HashRef[$iterable]",
230 required => 1,
231 1530 ▶ default => sub { return {}; },
Subroutine __ANON__: called CC=1 SCAR=0.0
232 19 handles => {
233 '_addChild' => 'set',
234 'hasChild' => 'exists',
235 '_getChild' => 'get',
236 }
237 );
238  
239 has '_children_tab' => (
240 traits => [ 'Array' ],
241 is => 'ro',
242 isa => "ArrayRef[$iterable]",
243 required => 1,
244 1530 ▶ default => sub { return []; },
Subroutine __ANON__: called CC=1 SCAR=0.0
245 19 handles => {
246 '_addChild_tab' => 'push',
247 'children' => 'elements',
248 }
249 );
250  
251 948 ▶ method "addChild" => sub {
Subroutine addChild: called CC=3 SCAR=11.9
252 0 my $self = shift;
253 0 my $child = shift;
254 0 my $child_name = $child->name;
255 0 ▶ if ($self->hasChild($child_name)) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->hasChild($child_name)) { } 143 805 948
if ($self->hasChild($child_name)) { } 74 252 326
256 0 ▶ if ($child != $self->_getChild($child_name)) {
Branch: 2 branches
BranchTrueFalseTotal
if ($child != $self->_getChild($child_name)) 0 143 143
if ($child != $self->_getChild($child_name)) 0 74 74
257 0 croak "Two different children with name $child_name for ".$self->name;
258 }
259 } else {
260 805 $self->_addChild($child_name, $child);
261 805 $self->_addChild_tab($child);
262 }
263 948 $child->_addParent($self);
264 948 return $child;
265 19 };
266  
267 585 ▶ method "iterator" => sub {
Subroutine iterator: called CC=1 SCAR=0.0
268 585 my $self = shift;
269  
270 585 return "$iterator"->new(
271 $self,
272 @_,
273 );
274 19 };
275 ######################################################
276 ######################################################
277 # ::Iterator class
278 19 my $iteratorclass = Moose::Meta::Class->create(
279 $iterator,
280 #attributes => [],
281 #roles => [],
282 #methods => {},
283 superclasses => ["Moose::Object"],
284 );
285  
286 19 $iteratorclass->add_attribute(
287 'recurse' => (
288 is => 'ro',
289 isa => 'Bool',
290 required => 1,
291 default => 1,
292 ));
293 19 $iteratorclass->add_attribute(
294 'with-self' => (
295 is => 'bare',
296 reader => 'with_self',
297 isa => 'Bool',
298 required => 1,
299 default => 0,
300 ));
301 $iteratorclass->add_attribute(
302 '_seen' => (
303 traits => [ 'Hash' ],
304 is => 'ro',
305 isa => 'HashRef[Bool]',
306 required => 1,
307 585 ▶ default => sub { return {}; },
Subroutine __ANON__: called CC=1 SCAR=0.0
308 19 handles => {
309 '_found' => 'exists',
310 '_mark' => 'set',
311 }
312 ));
313 19 $iteratorclass->add_attribute(
314 'uniq' => (
315 is => 'ro',
316 isa => 'Bool',
317 required => 1,
318 default => 0,
319 ));
320 19 $iteratorclass->add_attribute(
321 'postfix' => (
322 is => 'ro',
323 isa => 'Bool',
324 required => 1,
325 default => 0,
326 ));
327 $iteratorclass->add_attribute(
328 '_stack_frame' => (
329 traits => [ 'Array' ],
330 is => 'ro',
331 isa => "ArrayRef[$iteratorframe]",
332 required => 1,
333 585 ▶ default => sub { return []; },
Subroutine __ANON__: called CC=1 SCAR=0.0
334 19 handles => {
335 '_push_frame' => 'push',
336 '_pop_frame' => 'pop',
337 }
338 ));
339 19 $iteratorclass->add_attribute(
340 '_init_block' => (
341 is => 'ro',
342 isa => $iterable,
343 required => 1,
344 ));
345 $iteratorclass->add_attribute(
346 '_cur_frame' => (
347 is => 'rw',
348 isa => "Maybe[$iteratorframe]",
349 required => 1,
350 lazy => 1,
351 543 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
352 543 my $self = shift;
353 543 return $iteratorframe->new(
354 $self->_init_block,
355 $self,
356 );
357 },
358 19 ));
359 19 $iteratorclass->add_attribute(
360 '_next_computed' => (
361 is => 'rw',
362 isa => 'Bool',
363 required => 0,
364 default => 0,
365 ));
366 19 $iteratorclass->add_attribute(
367 '_next' => (
368 is => 'rw',
369 isa => "Maybe[$iterable]",
370 required => 0,
371 default => undef,
372 ));
373 $iteratorclass->add_method(
374 0 ▶ 'has_next' => sub {
Subroutine has_next: not called CC=2 SCAR=11.6
375 0 my $self = shift;
376 0 ▶ if (! $self->_next_computed) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($self->_next_computed) 0 0 0
unless ($self->_next_computed) 0 0 0
377 0 $self->_compute_next;
378 }
379 0 return defined($self->_next);
380 19 });
381 $iteratorclass->add_method(
382 2768 ▶ 'next' => sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
Subroutine next: called CC=2 SCAR=6.9
383 2768 my $self = shift;
384 2768 ▶ if (! $self->_next_computed) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($self->_next_computed) 2768 0 2768
unless ($self->_next_computed) 1664 808 2472
385 2768 $self->_compute_next;
386 }
387 2768 $self->_next_computed(0);
388 2768 return $self->_next;
389 19 });
390 $iteratorclass->add_attribute(
391 'filter' => (
392 traits => ['Code'],
393 is => 'ro',
394 isa => 'CodeRef',
395 543 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
396 3707 ▶ sub { 1; }
Subroutine __ANON__: called CC=1 SCAR=0.0
397 543 },
398 19 handles => {
399 do_filter => 'execute',
400 },
401 ));
402 $iteratorclass->add_method(
403 4033 ▶ '_compute_next' => sub {
Subroutine _compute_next: called CC=15 SCAR=30.6
404 4033 my $self = shift;
405  
406 4033 $self->_next_computed(1);
407 4033 ▶ if (!defined($self->_cur_frame)) {
Branch: 2 branches
BranchTrueFalseTotal
unless (defined $self->_cur_frame) 0 4033 4033
unless (defined $self->_cur_frame) 38 36 74
408 0 $self->_next(undef);
409 0 return;
410 }
411 #print STDERR "****\nBegin compute: ", $self->_cur_frame->dump, "\n";
412 0 ▶ do {
Branch: 2 branches
BranchTrueFalseTotal
$self->with_self || $self->_next != $self->_init_block and not $self->do_filter($self->_next) and do { do { do { my $n = $self->_cur_frame->next_child; until (defined $n) { my $cur_frame = $self->_cur_frame; $self->_cur_frame($self->_pop_frame); if ($self->postfix) { $n = $cur_frame->current; if ($n == $self->_init_block) { $self->_next(undef); return; } ; $self->_next($n); $n = undef; last; } else { unless (defined $self->_cur_frame) { $self->_next(undef); return; } ; $n = $self->_cur_frame->next_child; } ; } ; while (defined $n) { my(@children) = $n->children; if (not $self->recurse or scalar @children == 0) { $self->_next($n); last; } else { my $new_frame = $iteratorframe->new($n, $self); $self->_push_frame($self->_cur_frame); $self->_cur_frame($new_frame); if (not $self->postfix) { $self->_next($n); last; } else { $n = $new_frame->next_child; } ; } ; } } while $self->uniq and $self->_found($self->_next); $self->_mark($self->_next, 1) } } 2 3689 3691
$self->with_self || $self->_next != $self->_init_block and not $self->do_filter($self->_next) and do { do { do { my $n = $self->_cur_frame->next_child; until (defined $n) { my $cur_frame = $self->_cur_frame; $self->_cur_frame($self->_pop_frame); if ($self->postfix) { $n = $cur_frame->current; if ($n == $self->_init_block) { $self->_next(undef); return; } ; $self->_next($n); $n = undef; last; } else { unless (defined $self->_cur_frame) { $self->_next(undef); return; } ; $n = $self->_cur_frame->next_child; } ; } ; while (defined $n) { my(@children) = $n->children; if (not $self->recurse or scalar @children == 0) { $self->_next($n); last; } else { my $new_frame = $iteratorframe->new($n, $self); $self->_push_frame($self->_cur_frame); $self->_cur_frame($new_frame); if (not $self->postfix) { $self->_next($n); last; } else { $n = $new_frame->next_child; } ; } ; } } while $self->uniq and $self->_found($self->_next); $self->_mark($self->_next, 1) } } 252 0 252
Condition41%5/12
$self->with_self || $self->_next != $self->_init_block and not $self->do_filter($self->_next)
!ll&&!rl&&r
036892
$self->with_self or $self->_next != $self->_init_block
l!l&&r!l&&!r
036910
$self->with_self || $self->_next != $self->_init_block and not $self->do_filter($self->_next)
!ll&&!rl&&r
02520
$self->with_self or $self->_next != $self->_init_block
l!l&&r!l&&!r
02520
MC/DC33%1/3
$self->with_self || $self->_next != $self->_init_block and not $self->do_filter($self->_next)
$self->with_self $self->_next != $self->_init_block not $self->do_filter($self->_next)
MC/DC0%0/3
$self->with_self || $self->_next != $self->_init_block and not $self->do_filter($self->_next)
$self->with_self $self->_next != $self->_init_block not $self->do_filter($self->_next)
Truth table40%2/5
A or B and not(C)
A= $self->with_selfB= $self->_next != $self->_init_blockC= not $self->do_filter($self->_next)
ABCresult
00X0
1X00
0100
1X11
0111
Truth table20%1/5
A or B and not(C)
A= $self->with_selfB= $self->_next != $self->_init_blockC= not $self->do_filter($self->_next)
ABCresult
00X0
1X00
0100
1X11
0111
413 4035 ▶ do {
Branch: 2 branches
BranchTrueFalseTotal
$self->uniq and $self->_found($self->_next) and do { do { my $n = $self->_cur_frame->next_child; until (defined $n) { my $cur_frame = $self->_cur_frame; $self->_cur_frame($self->_pop_frame); if ($self->postfix) { $n = $cur_frame->current; if ($n == $self->_init_block) { $self->_next(undef); return; } ; $self->_next($n); $n = undef; last; } else { unless (defined $self->_cur_frame) { $self->_next(undef); return; } ; $n = $self->_cur_frame->next_child; } ; } ; while (defined $n) { my(@children) = $n->children; if (not $self->recurse or scalar @children == 0) { $self->_next($n); last; } else { my $new_frame = $iteratorframe->new($n, $self); $self->_push_frame($self->_cur_frame); $self->_cur_frame($new_frame); if (not $self->postfix) { $self->_next($n); last; } else { $n = $new_frame->next_child; } ; } ; } } } 0 3691 3691
$self->uniq and $self->_found($self->_next) and do { do { my $n = $self->_cur_frame->next_child; until (defined $n) { my $cur_frame = $self->_cur_frame; $self->_cur_frame($self->_pop_frame); if ($self->postfix) { $n = $cur_frame->current; if ($n == $self->_init_block) { $self->_next(undef); return; } ; $self->_next($n); $n = undef; last; } else { unless (defined $self->_cur_frame) { $self->_next(undef); return; } ; $n = $self->_cur_frame->next_child; } ; } ; while (defined $n) { my(@children) = $n->children; if (not $self->recurse or scalar @children == 0) { $self->_next($n); last; } else { my $new_frame = $iteratorframe->new($n, $self); $self->_push_frame($self->_cur_frame); $self->_cur_frame($new_frame); if (not $self->postfix) { $self->_next($n); last; } else { $n = $new_frame->next_child; } ; } ; } } } 216 36 252
Condition66%4/6
$self->uniq and $self->_found($self->_next)
!ll&&!rl&&r
35401510
$self->uniq and $self->_found($self->_next)
!ll&&!rl&&r
221310
MC/DC0%0/2
$self->uniq and $self->_found($self->_next)
$self->uniq $self->_found($self->_next)
MC/DC0%0/2
$self->uniq and $self->_found($self->_next)
$self->uniq $self->_found($self->_next)
Truth table66%2/3
A and B
A= $self->uniqB= $self->_found($self->_next)
ABresult
0X0
100
111
Truth table66%2/3
A and B
A= $self->uniqB= $self->_found($self->_next)
ABresult
0X0
100
111
414 4035 my $n = $self->_cur_frame->next_child;
415 4035 ▶ while (! defined($n)) {
Branch: 2 branches
BranchTrueFalseTotal
unless (defined $n) 802 3691 4493
unless (defined $n) 36 0 36
416 # nothing more in this frame. Poping it.
417 802 my $cur_frame = $self->_cur_frame;
418 802 $self->_cur_frame($self->_pop_frame);
419 802 ▶ if ($self->postfix) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->postfix) { } 0 802 802
420 0 $n=$cur_frame->current;
421 #print STDERR "Poping frame and found: ", $n->name, "\n";
422 0 ▶ if ($n == $self->_init_block) {
Branch: 1 branch
BranchTrueFalseTotal
if ($n == $self->_init_block) 0 0 0
423 0 $self->_next(undef);
424 0 return;
425 }
426 0 $self->_next($n);
427 0 $n=undef;
428 0 last;
429 } else {
430 802 ▶ if (!defined($self->_cur_frame)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->_cur_frame) 344 458 802
431 344 $self->_next(undef);
432 344 return;
433 }
434 #print STDERR "Poping frame: ", $self->_cur_frame->dump, "\n";
435 458 $n = $self->_cur_frame->next_child;
436 }
437 }
438 3691 ▶ while (defined($n)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $n) 3691 0 3691
439 # $n : next in _cur_frame
440 3691 my @children = ($n->children);
441 3691 ▶ if (! $self->recurse || scalar(@children) == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->recurse or scalar @children == 0) { } 3233 458 3691
Condition100%6/6
not $self->recurse or scalar @children == 0
l!l&&r!l&&!r
19541279458
not $self->recurse or scalar @children == 0
l!l&&r!l&&!r
10311336
MC/DC100%2/2
not $self->recurse or scalar @children == 0
not $self->recurse scalar @children == 0
MC/DC100%2/2
not $self->recurse or scalar @children == 0
not $self->recurse scalar @children == 0
Truth table100%3/3
not(A) or B
A= not $self->recurseB= scalar @children == 0
ABresult
1X1
011
000
Truth table100%3/3
not(A) or B
A= not $self->recurseB= scalar @children == 0
ABresult
1X1
011
000
442 # no children for current node (or no recursion), just using it and go
443 3233 $self->_next($n);
444 #print STDERR "Found no children: ", $n->name, "\n";
445 3233 last;
446 } else {
447 # Building new frame
448 458 my $new_frame = $iteratorframe->new(
449 $n,
450 $self,
451 );
452 #print STDERR "Building new frame: ", $new_frame->dump, "\n";
453 458 $self->_push_frame($self->_cur_frame);
454 458 $self->_cur_frame($new_frame);
455 458 ▶ if (! $self->postfix) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->postfix) { } 458 0 458
456 458 $self->_next($n);
457 458 last;
458 } else {
459 0 $n = $new_frame->next_child;
460 }
461 }
462 }
463 } while ($self->uniq && $self->_found($self->_next));
464 3691 $self->_mark($self->_next, 1);
465 #FIXME# if not a real bloc, accept it
466 #last if not $self->_next->isa($iterable);
467 } while (
468 ($self->with_self || $self->_next != $self->_init_block)
469 && !$self->do_filter($self->_next)
470 );
471  
472  
473 #if ($self->has_next) {
474 # print STDERR "Found: ", $self->_next->name, "\n";
475 #}
476 #use Data::Dumper;
477 #$Data::Dumper::Maxdepth = 3;
478 #print STDERR Dumper($self);
479 19 });
480 $iteratorclass->add_around_method_modifier(
481 585 ▶ 'BUILDARGS' => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
482 585 my $orig = shift;
483 585 my $class = shift;
484 585 my $init_block = shift;
485 585 my %args = (@_);
486  
487 585 return $class->$orig(
488 @_,
489 '_init_block' => $init_block,
490 );
491 19 });
492 ######################################################
493 ######################################################
494 # ::Iterator::Frame class
495 19 my $iteratorframeclass = Moose::Meta::Class->create(
496 $iteratorframe,
497 #attributes => [],
498 #roles => [],
499 #methods => {},
500 superclasses => ["Moose::Object"],
501 );
502 19 $iteratorframeclass->add_attribute(
503 'current' => (
504 is => 'ro',
505 isa => $iterable,
506 required => 1,
507 ));
508 19 $iteratorframeclass->add_attribute(
509 '_children' => (
510 traits => [ 'Array' ],
511 is => 'ro',
512 isa => "ArrayRef[$iterable]",
513 required => 1,
514 handles => {
515 'next_child' => 'shift',
516 '_all_children' => 'elements',
517 }
518 ));
519 19 $iteratorframeclass->add_attribute(
520 'it' => (
521 is => 'ro',
522 isa => $iterator,
523 required => 1,
524 ));
525 $iteratorframeclass->add_around_method_modifier(
526 1037 ▶ 'BUILDARGS' => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
527 1037 my $orig = shift;
528 1037 my $class = shift;
529 1037 my $current = shift;
530 1037 my $it = shift;
531  
532 1037 return $class->$orig(
533 'current' => $current,
534 'it' => $it,
535 '_children' => [ $current->children ],
536 @_
537 );
538 19 });
539 10 };
540  
541 10 1;
542  
543 package StorageDisplay::Role::Elem::Kind;
544  
545 10 ▶use MooseX::Role::Parameterized;
Subroutine BEGIN: called CC=1 SCAR=0.0
546  
547 10 parameter kind => (
548 isa => 'Str',
549 required => 1,
550 );
551  
552 18 ▶role {
Subroutine __ANON__: called CC=1 SCAR=0.0
553 18 my $role = shift;
554  
555 18 my $kind = $role->kind;
556  
557 7 ▶ around 'BUILDARGS' => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
558 7 my $orig = shift;
559 7 my $class = shift;
560  
561 7 return $class->$orig(@_, 'name_prefix' => $kind);
562 18 };
563 10 };
564  
565 10 1;
566  
567 ##################################################################
568 package StorageDisplay::Role::HasBlock;
569  
570 10 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
571  
572 10 has 'block' => (
573 is => 'ro',
574 isa => 'StorageDisplay::Block',
575 required => 1,
576 );
577  
578 10 1;
579  
580 ##################################################################
581 package StorageDisplay::Role::Style::Base;
582  
583 10 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
584  
585 10 1;
586  
587 ##################################################################
588 package StorageDisplay::Role::Style::Base::Elem;
589  
590 10 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
591  
592 10 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
593  
594 286 ▶sub dotJoinStyle {
Subroutine dotJoinStyle: called CC=2 SCAR=7.0
Pod undocumented
595 286 my $self = shift;
596 286 ▶ my $t = shift // "\t";
Condition50%1/2
shift() // "\t"
l!l
2860
MC/DC0%0/1
shift() // "\t"
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
597  
598 286 return join(';', grep { defined($_) } @_);
599 }
600  
601 1195 ▶sub dotIndent {
Subroutine dotIndent: called CC=2 SCAR=6.9
Pod undocumented
602 1195 my $self = shift;
603 1195 ▶ my $t = shift // "\t";
Condition100%2/2
shift() // "\t"
l!l
11914
MC/DC100%1/1
shift() // "\t"
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
604  
605 1195 return map { $t.$_ } @_;
606 }
607  
608 0 ▶sub dotLabel {
Subroutine dotLabel: not called CC=1 SCAR=6.9
Pod undocumented
609 0 my $self = shift;
610 0 return ($self->_dotDefaultLabel(@_));
611 }
612  
613 1065 ▶sub dotFullLabel {
Subroutine dotFullLabel: called CC=1 SCAR=0.0
Pod undocumented
614 1065 my $self = shift;
615 1065 return $self->_dotDefaultFullLabel(@_);
616 }
617  
618 871 ▶sub dotNode {
Subroutine dotNode: called CC=1 SCAR=0.0
Pod undocumented
619 871 my $self = shift;
620 #print STDERR "dotNode in ".__PACKAGE__." for ".$self->name."\n";
621 871 return $self->_dotDefaultNode(@_);
622 }
623  
624 761 ▶sub dotStyleNode {
Subroutine dotStyleNode: called CC=1 SCAR=0.0
Pod undocumented
625 761 my $self = shift;
626 761 return $self->_dotDefaultStyleNode(@_);
627 }
628  
629 562 ▶sub dotStyleNodeState {
Subroutine dotStyleNodeState: called CC=1 SCAR=0.0
Pod undocumented
630 562 my $self = shift;
631  
632 562 return $self->_dotDefaultStyleNodeState;
633 }
634  
635 1065 ▶sub dotFormatedFullLabel {
Subroutine dotFormatedFullLabel: called CC=1 SCAR=0.0
Pod undocumented
636 1065 my $self = shift;
637 1065 my $t = shift;
638  
639 return join($self->_dotLabelNL,
640 1065 grep {defined($_)} $self->dotFullLabel);
641 }
642  
643 # default implementations
644  
645 # will be overrided when a Table is generated
646 234 ▶sub _dotTableLabel {
Subroutine _dotTableLabel: called CC=1 SCAR=0.0
647 234 my $self = shift;
648 234 return $self->dotFormatedFullLabel(@_);
649 }
650  
651 0 ▶sub _dotDefaultLabel {
Subroutine _dotDefaultLabel: not called CC=1 SCAR=6.9
652 0 my $self = shift;
653 0 return ($self->name);
654 }
655  
656 362 ▶sub _dotDefaultStyleNodeState {
Subroutine _dotDefaultStyleNodeState: called CC=1 SCAR=0.0
657 362 my $self = shift;
658  
659 362 return ();
660 }
661  
662 562 ▶sub _dotDefaultStyleNode {
Subroutine _dotDefaultStyleNode: called CC=1 SCAR=0.0
663 562 my $self = shift;
664 562 my @style = grep { $_ !~ m/[node]/ } $self->dotStyle(@_);
665  
666 562 push @style, $self->dotStyleNodeState(@_);
667 562 return @style;
668 }
669  
670 787 ▶sub _dotLabelNL {
Subroutine _dotLabelNL: called CC=1 SCAR=0.0
671 787 my $self = shift;
672 787 return '\n';
673 }
674  
675 # will be overrided with Size, Used, Free infos
676 1065 ▶sub _dotDefaultFullLabel {
Subroutine _dotDefaultFullLabel: called CC=1 SCAR=0.0
677 1065 my $self = shift;
678  
679 1065 return ($self->dotLabel(@_));
680 }
681  
682 # will be overrided for HTML
683 787 ▶sub _dotDefaultLabelLine {
Subroutine _dotDefaultLabelLine: called CC=3 SCAR=11.3
684 787 my $self = shift;
685 787 my @label = $self->dotFormatedFullLabel(@_);
686 787 ▶ confess "Multiline formated label!" if scalar(@label) > 1;
Branch: 1 branch
BranchTrueFalseTotal
if scalar @label > 1 0 787 787
687 787 ▶ return 'label="";' if scalar(@label) == 0;
Branch: 1 branch
BranchTrueFalseTotal
if scalar @label == 0 0 787 787
688  
689 787 return ('label="'.$label[0].'";');
690 }
691  
692 # will be overrided when another node kind is selected
693 564 ▶sub _dotDefaultNode {
Subroutine _dotDefaultNode: called CC=2 SCAR=7.0
694 564 my $self = shift;
695 564 ▶ my $t = shift // "\t";
Condition50%1/2
shift() // "\t"
l!l
5640
MC/DC0%0/1
shift() // "\t"
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
696  
697 #print STDERR "coucou2 from ".$self->name."\n";
698 564 my @text = (
699 "{ ".$self->linkname.' [',
700 $self->dotIndent(
701 $t,
702 $self->_dotDefaultLabelLine($t, @_),
703 $self->dotStyleNode(),
704 ),
705 ']; }',
706 );
707 564 return @text;
708 }
709  
710 10 1;
711  
712 ##################################################################
713 package StorageDisplay::Role::Style::Base::HTML;
714  
715 10 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
716  
717 278 ▶around '_dotLabelNL' => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
718 278 my $orig = shift;
719 278 my $self = shift;
720 278 return '<BR/>';
721 10 };
722  
723 42 ▶around '_dotDefaultLabelLine' => sub {
Subroutine __ANON__: called CC=2 SCAR=7.0
724 42 my $orig = shift;
725 42 my $self = shift;
726 42 my $t = shift;
727  
728 42 my @text=$self->dotIndent($t, $self->_dotTableLabel($t, @_));
729  
730 42 ▶ if (scalar(@text) == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @text == 0) 0 42 42
731 0 return ('label=<>;')
732 }
733  
734 42 $text[0] =~ s/^\s+//;
735 42 $text[0] = 'label=<'.$text[0];
736 42 push @text, '>;';
737  
738 42 return @text;
739 10 };
740  
741 10 1;
742  
743 ##################################################################
744 package StorageDisplay::Role::Style::IsLabel;
745  
746 10 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
747  
748 10 with (
749 'StorageDisplay::Role::Style::Base',
750 );
751  
752 278 ▶around '_dotDefaultNode' => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
753 278 my $orig = shift;
754 278 my $self = shift;
755  
756 #print STDERR "coucou from ".$self->name."\n";
757 278 return $self->_dotTableLabel(@_);
758 10 };
759  
760 10 1;
761  
762 ##################################################################
763 package StorageDisplay::Role::Style::IsSubGraph;
764  
765 10 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
766  
767 258 ▶sub dotSubGraph {
Subroutine dotSubGraph: called CC=1 SCAR=0.0
Pod undocumented
768 258 my $self = shift;
769 258 return $self->_dotDefaultSubGraph(@_);
770 }
771  
772 258 ▶sub _dotDefaultSubGraph {
Subroutine _dotDefaultSubGraph: called CC=2 SCAR=6.9
773 258 my $self = shift;
774 258 my $t = shift;
775  
776 258 my @text;
777 258 my $it = $self->iterator(recurse => 0);
778 258 ▶ while (defined(my $e = $it->next)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $e = $it->next)) 698 258 956
779 698 push @text, $e->dotNode($t, @_);
780 }
781 258 return @text;
782 }
783  
784 265 ▶around '_dotDefaultNode' => sub {
Subroutine __ANON__: called CC=2 SCAR=7.0
785 265 my $orig = shift;
786 265 my $self = shift;
787 265 ▶ my $t = shift // "\t";
Condition50%1/2
shift() // "\t"
l!l
2650
MC/DC0%0/1
shift() // "\t"
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
788  
789 265 my @text = (
790 'subgraph "cluster_'.$self->rawlinkname.'" {',
791 $self->dotIndent(
792 $t,
793 $self->dotStyle($t, @_),
794 $self->dotSubGraph($t, @_),
795 $self->_dotDefaultLabelLine($t, @_),
796 $self->dotStyleNode(),
797 ),
798 '}',
799 );
800 265 return @text;
801 10 };
802  
803 241 ▶around '_dotDefaultStyleNode' => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
804 241 my $orig = shift;
805 241 my $self = shift;
806  
807 241 return ();
808 10 };
809  
810 10 with (
811 'StorageDisplay::Role::Style::Base',
812 );
813  
814 10 1;
815  
816 ##################################################################
817 package StorageDisplay::Role::Style::Label::HTML;
818  
819 10 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
820  
821 10 with (
822 'StorageDisplay::Role::Style::Base::HTML',
823 'StorageDisplay::Role::Style::Base',
824 );
825  
826 10 1;
827  
828 ##################################################################
829 package StorageDisplay::Role::Style::Label::HTML::Table;
830  
831 10 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
832  
833 44 ▶sub dotStyleTable {
Subroutine dotStyleTable: called CC=1 SCAR=0.0
Pod undocumented
834 44 return '';
835 };
836  
837 86 ▶around '_dotTableLabel' => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
838 86 my $orig = shift;
839 86 my $self = shift;
840 86 my $t = shift;
841 86 my $it = $self->iterator(recurse => 0);
842  
843 86 return ('<TABLE '.$self->dotStyleTable(@_).'>',
844 $self->dotIndent(
845 $t,
846 $self->dotTable($t, $it, @_),
847 ),
848 '</TABLE>',
849 );
850 10 };
851  
852 0 ▶sub dotTable {
Subroutine dotTable: not called CC=1 SCAR=6.9
Pod undocumented
853 0 my $self=shift;
854  
855 0 return $self->_dotDefaultTable(@_);
856 }
857  
858 0 ▶sub _dotDefaultTable {
Subroutine _dotDefaultTable: not called CC=2 SCAR=17.9
859 0 my $self=shift;
860 0 my $t = shift;
861 0 my $it = shift;
862  
863 0 my @text;
864 0 ▶ while (defined(my $e = $it->next)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $e = $it->next)) 0 0 0
865 0 push @text, '<TR><TD>',
866 $self->dotIndent($t, $e->dotNode($t, @_)),
867 '</TD></TR>'
868 }
869  
870 0 return @text;
871 }
872  
873 10 with (
874 'StorageDisplay::Role::Style::Base::HTML',
875 'StorageDisplay::Role::Style::Base',
876 );
877  
878 10 1;
879  
880 ##################################################################
881 package StorageDisplay::Role::Style::Plain;
882  
883 10 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
884  
885 70 ▶sub dotStyle {
Subroutine dotStyle: called CC=1 SCAR=0.0
Pod undocumented
886 70 my $orig = shift;
887 70 my $self = shift;
888  
889 70 return ( );
890 };
891  
892 10 with (
893 'StorageDisplay::Role::Style::Base',
894 );
895  
896 10 1;
897  
898 ##################################################################
899 package StorageDisplay::Role::Style::WithSize;
900  
901 10 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
902  
903 10 has 'size' => (
904 is => 'ro',
905 isa => 'Int',
906 required => 1,
907 );
908  
909 288 ▶sub dotStyle {
Subroutine dotStyle: called CC=1 SCAR=0.0
Pod undocumented
910 288 my $orig = shift;
911 288 my $self = shift;
912  
913 return (
914 288 "style=filled;",
915 "color=lightgrey;",
916 "fillcolor=lightgrey;",
917 "node [style=filled,color=lightgrey,fillcolor=lightgrey,shape=rectangle];",
918 );
919 };
920  
921 752 ▶sub sizeLabel {
Subroutine sizeLabel: called CC=1 SCAR=0.0
Pod undocumented
922 752 my $self = shift;
923 752 return ("Size: ".$self->disp_size($self->size));
924 }
925  
926 774 ▶around '_dotDefaultFullLabel' => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
927 774 my $orig = shift;
928 774 my $self = shift;
929  
930 return (
931 774 $self->$orig(@_),
932 $self->sizeLabel(),
933 );
934 10 };
935  
936 10 with (
937 'StorageDisplay::Role::Style::Base',
938 );
939  
940 10 1;
941  
942 ##################################################################
943 package StorageDisplay::Role::Style::WithFree;
944  
945 10 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
946  
947 10 with 'StorageDisplay::Role::Style::WithSize';
948  
949 10 has 'free' => (
950 is => 'ro',
951 isa => 'Int',
952 required => 1,
953 );
954  
955 152 ▶sub fillcolor {
Subroutine fillcolor: called CC=2 SCAR=6.9
Pod undocumented
956 152 my $self = shift;
957  
958 152 my $fillcolor='"green"';
959 152 ▶ if ($self->size != $self->free) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->size != $self->free) 144 8 152
960 144 $fillcolor=
961 '"pink;'.
962 sprintf("%f.2", ($self->size - $self->free) / $self->size).
963 ':green"';
964 }
965 152 return $fillcolor;
966 }
967  
968 152 ▶around _dotDefaultStyleNode => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
969 152 my $orig = shift;
970 152 my $self = shift;
971  
972 152 return $self->dotJoinStyle(
973 $self->$orig(@_),
974 'shape=rectangle',
975 'style=striped',
976 'fillcolor='.$self->fillcolor,
977 );
978 10 };
979  
980 152 ▶around '_dotDefaultFullLabel' => sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
981 152 my $orig = shift;
982 152 my $self = shift;
983  
984 152 my @labels = $self->$orig(@_);
985 152 ▶ if ($self->size !=0 || $self->free != 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->size != 0 or $self->free != 0) 148 4 152
Condition66%2/3
$self->size != 0 or $self->free != 0
l!l&&r!l&&!r
14804
MC/DC50%1/2
$self->size != 0 or $self->free != 0
$self->size != 0 $self->free != 0
Truth table66%2/3
A or B
A= $self->size != 0B= $self->free != 0
ABresult
1X1
011
000
986 148 push @labels, "Free: ".$self->disp_size($self->free);
987 }
988 152 return @labels;
989 10 };
990  
991 10 1;
992  
993 ##################################################################
994 package StorageDisplay::Role::Style::WithUsed;
995  
996 10 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
997  
998 10 with 'StorageDisplay::Role::Style::WithFree';
999  
1000 10 has 'used' => (
1001 is => 'ro',
1002 isa => 'Int',
1003 required => 1,
1004 );
1005  
1006 has 'reserved' => (
1007 is => 'ro',
1008 isa => 'Int',
1009 required => 1,
1010 lazy => 1,
1011 67 ▶ default => sub {
Subroutine __ANON__: called CC=2 SCAR=7.9
1012 67 my $self = shift;
1013 67 my $reserved = $self->size - $self->used - $self->free;
1014 67 ▶ if ($reserved < 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($reserved < 0) 0 67 67
1015 0 print STDERR "Reserved: $reserved\n";
1016 0 $reserved = 0;
1017 }
1018 67 return $reserved;
1019 },
1020 10 );
1021  
1022 134 ▶around _dotDefaultStyleNode => sub {
Subroutine __ANON__: called CC=9 SCAR=22.1
1023 134 my $orig = shift;
1024 134 my $self = shift;
1025 134 my $fillcolor;
1026 134 my $part='@@@@@@@';
1027  
1028 134 ▶ if ($self->used > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->used > 0) 126 8 134
1029 126 ▶ if (defined($fillcolor)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $fillcolor) 0 126 126
1030 0 $fillcolor .= $part;
1031 }
1032 126 $fillcolor.='pink';
1033 126 $part=';'.sprintf("%f.2", $self->used / $self->size).':';
1034 }
1035 134 ▶ if ($self->free > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->free > 0) 122 12 134
1036 122 ▶ if (defined($fillcolor)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $fillcolor) 118 4 122
1037 118 $fillcolor .= $part;
1038 }
1039 122 $fillcolor.='green';
1040 122 $part=';'.sprintf("%f.2", $self->free / $self->size).':';
1041 }
1042 134 ▶ if ($self->reserved > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->reserved > 0) 66 68 134
1043 66 ▶ if (defined($fillcolor)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $fillcolor) 66 0 66
1044 66 $fillcolor .= $part;
1045 }
1046 66 $fillcolor.='orange';
1047 66 $part=';'.sprintf("%f.2", $self->reserved / $self->size).':';
1048 }
1049 134 ▶ if (not defined($fillcolor)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $fillcolor) 4 130 134
1050 4 ▶ if ($self->size == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->size == 0) { } 4 0 4
1051 4 $fillcolor='yellow';
1052 } else {
1053 0 $fillcolor='red';
1054 }
1055 }
1056  
1057 134 return $self->dotJoinStyle(
1058 $self->$orig(@_),
1059 'shape=rectangle',
1060 'style=striped',
1061 'fillcolor="'.$fillcolor.'"',
1062 );
1063 10 };
1064  
1065 134 ▶sub dotStyle {
Subroutine dotStyle: called CC=1 SCAR=0.0
Pod undocumented
1066 134 my $orig = shift;
1067 134 my $self = shift;
1068  
1069 return (
1070 134 "style=filled;",
1071 "color=lightgrey;",
1072 "fillcolor=lightgrey;",
1073 "node [style=filled,color=lightgrey,fillcolor=lightgrey,shape=rectangle];",
1074 );
1075 };
1076  
1077 134 ▶around '_dotDefaultFullLabel' => sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
1078 134 my $orig = shift;
1079 134 my $self = shift;
1080  
1081 134 my @labels = $self->$orig(@_);
1082 134 ▶ if ($self->size !=0 || $self->used != 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->size != 0 or $self->used != 0) 130 4 134
Condition66%2/3
$self->size != 0 or $self->used != 0
l!l&&r!l&&!r
13004
MC/DC50%1/2
$self->size != 0 or $self->used != 0
$self->size != 0 $self->used != 0
Truth table66%2/3
A or B
A= $self->size != 0B= $self->used != 0
ABresult
1X1
011
000
1083 130 push @labels, "Used: ".$self->disp_size($self->used);
1084 }
1085 134 return @labels;
1086 10 };
1087  
1088 10 1;
1089  
1090 ##################################################################
1091 package StorageDisplay::Role::Style::SubInternal;
1092  
1093 10 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
1094  
1095 130 ▶sub dotStyle {
Subroutine dotStyle: called CC=2 SCAR=7.1
Pod undocumented
1096 130 my $self = shift;
1097 130 ▶ my $t = shift // "\t";
Condition50%1/2
shift() // "\t"
l!l
1300
MC/DC0%0/1
shift() // "\t"
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
1098  
1099 return (
1100 #"style=filled;",
1101 130 "color=white;",
1102 "fillcolor=white;",
1103 #"node [style=filled,color=lightgrey,fillcolor=lightgrey,shape=rectangle];",
1104 );
1105 }
1106  
1107 10 with (
1108 'StorageDisplay::Role::Style::Base',
1109 );
1110  
1111 10 1;
1112  
1113 ##################################################################
1114 package StorageDisplay::Role::Style::Grey;
1115  
1116 10 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
1117  
1118 198 ▶sub dotStyle {
Subroutine dotStyle: called CC=2 SCAR=6.9
Pod undocumented
1119 198 my $self = shift;
1120 198 ▶ my $t = shift // "\t";
Condition100%2/2
shift() // "\t"
l!l
82116
MC/DC100%1/1
shift() // "\t"
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
1121  
1122 return (
1123 198 "style=filled;",
1124 "color=lightgrey;",
1125 "fillcolor=lightgrey;",
1126 "node [style=filled,color=white,fillcolor=lightgrey,shape=rectangle];",
1127 );
1128 }
1129  
1130 10 with (
1131 'StorageDisplay::Role::Style::Base',
1132 );
1133  
1134 10 1;
1135  
1136 ##################################################################
1137 package StorageDisplay::Role::Style::Machine;
1138  
1139 10 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
1140  
1141 7 ▶sub dotStyle {
Subroutine dotStyle: called CC=2 SCAR=7.1
Pod undocumented
1142 7 my $self = shift;
1143 7 ▶ my $t = shift // "\t";
Condition50%1/2
shift() // "\t"
l!l
70
MC/DC0%0/1
shift() // "\t"
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
1144  
1145 return (
1146 7 "style=filled;",
1147 "color=lightgrey;",
1148 "fillcolor=white;",
1149 "node [style=filled,color=white,fillcolor=white,shape=rectangle];",
1150 );
1151 }
1152  
1153 10 with (
1154 'StorageDisplay::Role::Style::Base',
1155 );
1156  
1157 10 1;
1158  
1159 ##################################################################
1160 package StorageDisplay::Role::Style::FromBlockState;
1161  
1162 10 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
1163  
1164 200 ▶sub _dotDefaultStyleNodeState {
Subroutine _dotDefaultStyleNodeState: called CC=2 SCAR=7.0
1165 200 my $self = shift;
1166  
1167 200 my $state = "unknown";
1168 200 ▶ if (defined($self->block)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->block) 200 0 200
1169 200 $state = $self->block->state;
1170 }
1171  
1172 200 return 'fillcolor="'.$self->statecolor($state).'"';
1173 }
1174  
1175 10 1;
1176  
1177 __END__
« blib/lib/StorageDisplay/Data/FS.pm ↑ Summary blib/lib/StorageDisplay/Data/Elem.pm »