PartialOrder/CMasked.pm

filter: Statementstmt 66.0% 401 / 607 Branchbran 37.7% 99 / 262 Conditioncond 27.5% 46 / 167 MC/DCmcdc 10.9% 10 / 91 Subroutinesub 61.2% 60 / 98 Podpod 94.7% 36 / 38 totaltotal 51.6% 652 / 1263 CC 201 SCAR 50.9
CC
201
Cov
53%
dump
1260.0
get_strata
132.0
subsort
72.0
CRAP 162.3
« PartialOrder/CEnum.pm ↑ Summary PartialOrder/Loader.pm »
1 # -*- Mode: Perl -*-
2  
3 #
4 # Copyright (c) 2001, Bryan Jurish. All rights reserved.
5 #
6 # This package is free software. You may redistribute it
7 # and/or modify it under the same terms as Perl itself.
8 #
9  
10 ###############################################################
11 #
12 # File: Math::PartialOrder::CMasked.pm
13 # Author: Bryan Jurish <jurish@ling.uni-potsdam.de>
14 #
15 # Description: Compilingt Math::PartialOrder class using
16 # Bit::Vector objects to store hierarchy information,
17 # internal storage of parents/children as 'Enum' strings.
18 #
19 ###############################################################
20  
21  
22 package Math::PartialOrder::CMasked;
23 # System modules
24 7 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 7 require Exporter;
26 # 3rd party exstensions
27 7 ▶use Bit::Vector;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 # user extension modules
29 7 ▶use Math::PartialOrder::Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
30 7 ▶use Math::PartialOrder::Loader qw(:trvars);
Subroutine BEGIN: called CC=1 SCAR=0.0
31 7 @ISA = qw(Math::PartialOrder::Base);
32 7 @EXPORT = qw();
33 7 @EXPORT_OK = (
34 qw($INITIAL_VECTOR_SIZE $VECTOR_GROW_STEP),
35 qw(%BIN_COMPAT &_get_bin_compat $_tr_index),
36 qw(&_bv_make_comparable &_bv_ensure_size
37 &_bv_bit_test &_bv_bit_on &_bv_bit_off
38 &_bv_union_d &_bv_intersection_d &_bv_difference_d),
39 qw(&_enum2indices &_enum_bit_test &_enum_bit_on &_enum_bit_off
40 &_enum_union &_enum_intersection &_enum_difference),
41 );
42 7 %EXPORT_TAGS =
43 (
44 sizevars => [qw($INITIAL_VECTOR_SIZE $VECTOR_GROW_STEP)],
45 bincompat => [qw(%BIN_COMPAT &_get_bin_compat $_tr_index)],
46 bvutils => [qw(&_bv_make_comparable &_bv_ensure_size
47 &_bv_bit_test &_bv_bit_on &_bv_bit_off
48 &_bv_union_d &_bv_intersection_d &_bv_difference_d)],
49 enumutils => [qw(&_enum2indices &_enum_bit_test &_enum_bit_on &_enum_bit_off
50 &_enum_union &_enum_intersection &_enum_difference)],
51 );
52  
53  
54 ###############################################################
55 # Package Variables
56 ###############################################################
57  
58 7 our $VERSION = 0.01;
59  
60 7 our $INITIAL_VECTOR_SIZE = 32;
61 7 our $VECTOR_GROW_STEP = 32;
62  
63 # for storage/binary compatibility
64 7 our %BIN_COMPAT =
65 (
66 Math::PartialOrder::CMasked => 0.01,
67 Math::PartialOrder::CEnum => 0.01,
68 QuD::Hierarchy::CMasked => 0.03,
69 QuD::Hierarchy::CEnum => 0.04,
70 QuD::Hierarchy::CVec => 0.02,
71 );
72 7 our $_tr_index = 3;
73  
74  
75 ###############################################################
76 # Initialization
77 # + object structure:
78 # {
79 # indices => { Type0 => Index0, ... }
80 # types => [ Type0, Type1, ... ]
81 # root => scalar type-name
82 # parents => [ Type0Parents, Type1Parents, ... ]
83 # children => [ Type0Children, Type1Children, ... ]
84 # attributes => [ { attr1.1 => val1.1, ... }, ... ]
85 # removed => [ FirstFreeIndex, SecondFreeIndex, ... ]
86 # vectors => [ Bit::Vector0, Bit::Vector1 ]
87 # ancestors => [ Type0Ancs, Type1Ancs, ... ] #-- Ancs are Bit::Vectors!
88 # descendants => [ Type0Decs, Type1Decs, ... ] #-- Decs are Bit::Vectors!
89 # compiled => scalar boolean
90 # hattributes => { a1 => v1, ... }
91 # }
92 ###############################################################
93 #----------------------------------------------------------------------
94 # new( {root=>$r} )
95 #----------------------------------------------------------------------
96 22 ▶sub new ($;$) {
Subroutine new: called CC=3 SCAR=11.2
Pod documented
97 22 my $proto = shift;
98 22 my $args = shift;
99 22 ▶ my $self = bless {
Condition33%1/3
ref $proto || $proto
l!l&&r!l&&!r
0220
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
100 indices => {},
101 types => [],
102 root => undef,
103 parents => [],
104 children => [],
105 attributes => [],
106 removed => [],
107 vectors =>
108 [
109 Bit::Vector->new($INITIAL_VECTOR_SIZE), # [0]: vector(0)
110 Bit::Vector->new($INITIAL_VECTOR_SIZE), # [1]: vector(1)
111 ],
112 # --- new ---
113 ancestors => [],
114 descendants => [],
115 compiled => 0,
116 hattributes => {}
117 }, ref($proto)||$proto;
118 # root node
119 22 ▶ $self->_root($args->{root}||'BOTTOM');
Condition100%2/2
$args->{'root'} || 'BOTTOM'
l!l
1012
MC/DC100%1/1
$args->{'root'} || 'BOTTOM'
$args->{'root'}
Truth table100%2/2
A
A= $args->{'root'}
Aresult
11
00
120 22 return $self;
121 }
122  
123  
124  
125 #--------------------------------------------------------------
126 10 ▶sub compile ($) {
Subroutine compile: called CC=17 SCAR=29.9
Pod documented
127 10 my $self = shift;
128  
129 # variables
130 10 my $size = $self->_size;
131 10 my $ancs = $self->{ancestors};
132 10 my $dscs = $self->{descendants};
133 10 my ($i);
134  
135 10 $self->_ensure_vector_sizes();
136 10 my ($psv, $csv) = @{$self->{vectors}}; # working vectors
137 10 my ($pse,$cse); # enums
138 10 my ($j,$jmin,$jmax); # interval-indices
139 10 my $q = Bit::Vector->new($psv->Size); # queue as a bit-vector
140 10 my $hv = Bit::Vector->new($psv->Size); # hierarchy-vector
141  
142 # tc-encoding masks: initialization
143 10 ▶ for ($i = 0; $i < $size; ++$i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $size) 66 10 76
144 66 ▶ next unless (exists($self->{types}[$i]));
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"types"}[$i] 0 66 66
145 # initialize ancestors
146 66 ▶ if (exists($ancs->[$i])) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $ancs->[$i]) { } 0 66 66
147 0 _bv_ensure_size($ancs->[$i], $psv->Size);
148 0 $ancs->[$i]->Empty;
149 } else {
150 66 $ancs->[$i] = $psv->Shadow; # new empty vector, same size
151 }
152 # intialize descendants
153 66 ▶ if (exists($dscs->[$i])) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $dscs->[$i]) { } 0 66 66
154 0 _bv_ensure_size($dscs->[$i], $psv->Size);
155 0 $dscs->[$i]->Empty;
156 } else {
157 66 $dscs->[$i] = $psv->Shadow
158 }
159 }
160  
161 10 $hv->Fill;
162 10 $hv->Index_List_Remove(@{$self->{removed}});
163  
164 10 $q->Bit_On($self->_indices->{$self->{root}});
165 10 ▶ while (!$q->is_empty) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($q->is_empty) 66 10 76
166 66 $i = $q->Min;
167 66 $q->Bit_Off($i);
168  
169 66 $pse = $self->{parents}[$i];
170 66 $cse = $self->{children}[$i];
171  
172 66 ▶ $psv->from_Enum($pse || '');
Condition100%2/2
$pse || ''
l!l
3432
MC/DC100%1/1
$pse || ''
$pse
Truth table100%2/2
A
A= $pse
Aresult
11
00
173 66 ▶ $csv->from_Enum($cse || '');
Condition100%2/2
$cse || ''
l!l
4422
MC/DC100%1/1
$cse || ''
$cse
Truth table100%2/2
A
A= $cse
Aresult
11
00
174  
175 # sanity-check
176 66 ▶ if (($ancs->[$i]->equal($hv) && $cse) || ($dscs->[$i]->equal($hv) && $pse))
Branch: 1 branch
BranchTrueFalseTotal
if ($ancs->[$i]->equal($hv) and $cse or $dscs->[$i]->equal($hv) and $pse) 0 66 66
Condition33%3/9
$ancs->[$i]->equal($hv) and $cse or $dscs->[$i]->equal($hv) and $pse
l!l&&r!l&&!r
0066
$ancs->[$i]->equal($hv) and $cse
!ll&&!rl&&r
6600
$dscs->[$i]->equal($hv) and $pse
!ll&&!rl&&r
6600
MC/DC0%0/4
$ancs->[$i]->equal($hv) and $cse or $dscs->[$i]->equal($hv) and $pse
$ancs->[$i]->equal($hv) $cse $dscs->[$i]->equal($hv) $pse
Truth table14%1/7
A and B or C and D
A= $ancs->[$i]->equal($hv)B= $cseC= $dscs->[$i]->equal($hv)D= $pse
ABCDresult
11XX1
0X111
10111
0X0X0
0X100
100X0
10100
177 {
178 0 carp("PartialOrder compilation error: circularity detected for type `$t'");
179 0 $self->decompile;
180 0 return 0;
181 }
182  
183 66 ▶ if ($cse) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cse) 44 22 66
184 44 $ancs->[$i]->Union($ancs->[$i],$psv);
185 44 $dscs->[$i]->Union($dscs->[$i],$csv);
186  
187 # propagate all known ancestors to direct descendants
188 44 foreach ($csv->Index_List_Read) {
189 66 $ancs->[$_]->Union($ancs->[$_], $ancs->[$i]);
190 66 $ancs->[$_]->Bit_On($i);
191 }
192  
193 # propagate (direct) descendants to all known ancestors
194 44 $j = 0;
195 44 ▶ while ($j <= $size && (($jmin,$jmax) = $ancs->[$i]->Interval_Scan_inc($j)))
Branch: 1 branch
BranchTrueFalseTotal
if ($j <= $size and () = $ancs->[$i]->Interval_Scan_inc($j)) 46 44 90
Condition66%2/3
$j <= $size and () = $ancs->[$i]->Interval_Scan_inc($j)
!ll&&!rl&&r
04446
MC/DC50%1/2
$j <= $size and () = $ancs->[$i]->Interval_Scan_inc($j)
$j <= $size () = $ancs->[$i]->Interval_Scan_inc($j)
Truth table66%2/3
A and B
A= $j <= $sizeB= () = $ancs->[$i]->Interval_Scan_inc($j)
ABresult
0X0
100
111
196 {
197 46 ▶ for ($j = $jmin; $j <= $jmax; ++$j) {
Branch: 1 branch
BranchTrueFalseTotal
if ($j <= $jmax) 58 46 104
198 58 $dscs->[$j]->Union($dscs->[$j], $dscs->[$i]);
199 }
200 46 $j = $jmax + 2;
201 }
202 # ...and keep going
203 44 $q->Union($q,$csv);
204 }
205 }
206 10 return $self->_compiled(1);
207 }
208  
209 #--------------------------------------------------------------
210 0 ▶sub decompile ($) {
Subroutine decompile: not called CC=1 SCAR=6.9
Pod documented
211 0 @{$_[0]->{ancestors}} = qw();
212 0 @{$_[0]->{descendants}} = qw();
213 0 return $_[0]->{compiled} = 0; # and set the compiled-flag
214 }
215 7 *uncompile = \&decompile;
216  
217  
218 #--------------------------------------------------------------
219 # $bool = compiled(), compiled($bool)
220 131 ▶sub compiled ($;$) {
Subroutine compiled: called CC=5 SCAR=16.1
Pod documented
221 131 ▶ return $_[0]->{compiled} unless (exists($_[1]));
Branch: 1 branch
BranchTrueFalseTotal
unless exists $_[1] 4 127 131
222 127 ▶ if ($_[1]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[1]) 57 70 127
223 # do compile
224 57 ▶ return $_[0]->compile unless ($_[0]->{compiled});
Branch: 1 branch
BranchTrueFalseTotal
unless $_[0]{"compiled"} 8 49 57
225 49 return 1; # we're already compiled...
226 }
227 70 ▶ return $_[0]->decompile if ($_[0]->{compiled});
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]{"compiled"} 0 70 70
228 70 return 0;
229 }
230  
231  
232  
233 ###############################################################
234 # Hierarchy Maintainance: Type Operations
235 ###############################################################
236  
237 #--------------------------------------------------------------
238 # @types = $h->types()
239 120 ▶sub types ($) { return grep { defined($_) } @{$_[0]->{types}}; }
Subroutine types: called CC=1 SCAR=0.0
Pod documented
240  
241 #--------------------------------------------------------------
242 # $h = $h->add($t,@ps)
243 176 ▶sub add {
Subroutine add: called CC=5 SCAR=16.2
Pod documented
244 176 my $self = shift;
245 176 my $type = shift;
246  
247 # sanity checks
248 176 ▶ return $self->move($type, @_) if ($self->has_type($type));
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_type($type) 24 152 176
249 152 ▶ unless (defined($type)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $type) 0 152 152
250 0 carp("Undefined type not supported in ".ref($self)."::add()");
251 0 return $self;
252 }
253 152 $self->{compiled} = 0;
254  
255 # add this type
256 152 my $i = $self->_next_index();
257 152 $self->{types}[$i] = $type;
258 152 $self->{indices}{$type} = $i;
259  
260 # ensure parents are well-defined & well-placed
261 152 @_ = $self->ensure_types(@_);
262  
263 # set parents-relation for new $type
264 152 $self->_ensure_vector_sizes();
265 152 $self->{parents}[$i] = $self->_types2enum(@_);
266  
267 # set children-relation for new $type
268 152 my $kids = $self->{children};
269 152 $kids->[$i] = '';
270 152 foreach (@{$self->{indices}}{@_}) {
271 174 ▶ if ($kids->[$_]) { $kids->[$_] .= ",$i"; }
Branch: 1 branch
BranchTrueFalseTotal
if ($kids->[$_]) { } 54 120 174
272 120 else { $kids->[$_] = $i; }
273 }
274 152 return $self;
275 }
276  
277  
278  
279 #--------------------------------------------------------------
280 # $bool = $h->has_type($t)
281 2596 ▶sub has_type ($$) {
Subroutine has_type: called CC=3 SCAR=11.7
Pod documented
282 return
283 defined($_[1]) &&
284 defined($_[0]->{indices}{$_[1]}) &&
285 2596 ▶ defined($_[0]->{types}[$_[0]->{indices}{$_[1]}]);
Condition66%4/6
defined $_[1] && defined $_[0]{'indices'}{$_[1]} && defined $_[0]{'types'}[$_[0]{'indices'}{$_[1]}]
!ll&&!rl&&r
22002376
defined $_[1] and defined $_[0]{"indices"}{$_[1]}
!ll&&!rl&&r
02202376
MC/DC33%1/3
defined $_[1] && defined $_[0]{'indices'}{$_[1]} && defined $_[0]{'types'}[$_[0]{'indices'}{$_[1]}]
defined $_[1] defined $_[0]{"indices"}{$_[1]} defined $_[0]{'types'}[$_[0]{'indices'}{$_[1]}]
Truth table50%2/4
A and B && C
A= defined $_[1]B= defined $_[0]{"indices"}{$_[1]}C= defined $_[0]{'types'}[$_[0]{'indices'}{$_[1]}]
ABCresult
0XX0
10X0
1100
1111
286 }
287  
288  
289 #--------------------------------------------------------------
290 # $h = $h->add_parents($t,@ps)
291 4 ▶sub add_parents ($$@) {
Subroutine add_parents: called CC=4 SCAR=14.1
Pod documented
292 4 my $self = shift;
293 4 my $type = shift;
294  
295 # sanity check(s)
296 4 ▶ return $self->add($type,@_) unless ($self->has_type($type));
Branch: 1 branch
BranchTrueFalseTotal
unless $self->has_type($type) 0 4 4
297 4 ▶ unless (defined($type)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $type) 0 4 4
298 0 carp("Undefined type not supported in ".ref($self)."::add_parents()");
299 0 return $self;
300 }
301 4 $self->compiled(0);
302  
303 4 my $i = $self->{indices}{$type};
304  
305 # ensure parents are well-defined & well-placed
306 4 @_ = $self->ensure_types(@_);
307  
308 # ensure that our vectors can handle this
309 4 $self->_ensure_vector_sizes();
310  
311 # set parents-relation for new $type
312 $self->{parents}[$i] =
313 _enum_union($self->{parents}[$i],
314 4 join(',',@{$self->{indices}}{@_}),
315 4 @{$self->{vectors}}[0..1]);
316  
317 # set children-relation for new $type
318 4 my $kids = $self->{children};
319 4 foreach (@{$self->{indices}}{@_}) {
320 4 $kids->[$_] = _enum_bit_on($kids->[$_], $i, $self->{vectors}[0]);
321 }
322 4 return $self;
323 }
324  
325  
326 #--------------------------------------------------------------
327 # $h = $h->replace($old,$new)
328 12 ▶sub replace ($$$) {
Subroutine replace: called CC=4 SCAR=14.4
Pod documented
329 12 my ($h, $old, $new) = @_;
330 12 ▶ unless (defined($old)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $old) 0 12 12
331 0 carp("Undefined type not supported in ".ref($self)."::replace()");
332 0 return $h;
333 }
334 12 my $i = $h->{indices}{$old};
335 12 ▶ return $h->add($new,$h->{root}) unless (defined($i));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $i 0 12 12
336 12 $h->{indices}{$new} = $i;
337 12 $h->{types}[$i] = $new;
338 12 ▶ if ($old eq $h->{root}) { $h->{root} = $new; }
Branch: 1 branch
BranchTrueFalseTotal
if ($old eq $h->{"root"}) 10 2 12
339 12 return $h;
340 }
341  
342 #--------------------------------------------------------------
343 # $h = $h->move($t,@ps)
344 40 ▶sub move ($$@) {
Subroutine move: called CC=8 SCAR=21.5
Pod documented
345 40 my $self = shift;
346 40 my $type = shift;
347  
348 # sanity check(s)
349 40 ▶ if (!defined($type)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $type) 0 40 40
350 0 carp("Undefined type not supported in ".ref($self)."::move()");
351 0 return $h;
352 }
353 40 ▶ if ($type eq $self->{root}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($type eq $self->{"root"}) 8 32 40
354 0 ▶ if (@_) { croak("Cannot move hierarchy root in ".ref($self)." object"); }
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 8 8
355 8 else { return $self; }
356 }
357 32 ▶ return $self->add($type, @_) unless ($self->has_type($type));
Branch: 1 branch
BranchTrueFalseTotal
unless $self->has_type($type) 0 32 32
358 32 $self->compiled(0);
359  
360 # ensure parents are well-defined & well-placed
361 32 @_ = $self->ensure_types(@_);
362  
363 # adjust old child-relations for moved $type
364 32 my $i = $self->{indices}{$type};
365 32 my $v = $self->{vectors}[0];
366 32 my $kids = $self->{children};
367 32 foreach (@$kids[$self->_parents_indices($type)])
368 {
369 34 ▶ next unless (defined($_));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_ 0 34 34
370 34 $_ = _enum_bit_off($_,$i,$v);
371 }
372  
373 # add new child-relations for moved $type
374 32 my @pindices = @{$self->{indices}}{@_};
375 32 foreach (@$kids[@pindices]) {
376 34 $_ = _enum_bit_on($_, $i, $v);
377 }
378  
379 # adjust parent-relation for moved $type
380 32 $self->{parents}[$i] = join(',',@pindices);
381 32 return $self;
382 }
383  
384  
385 #--------------------------------------------------------------
386 # remove(???): inherited from CEnum
387 2 ▶sub remove ($@) {
Subroutine remove: called CC=8 SCAR=21.5
Pod documented
388 2 my $self = shift;
389  
390 @_ =
391 grep {
392 # sanity check
393 2 ▶ $self->has_type($_) &&
Condition25%2/8
$self->has_type($_) && ($_ ne $self->root || carp('attempt to remove hierarchy root!') && 0)
!ll&&!rl&&r
002
$_ ne $self->root or carp("attempt to remove hierarchy root!") and 0
l!l&&r!l&&!r
200
carp("attempt to remove hierarchy root!") and 0
!ll
00
MC/DC0%0/3
$self->has_type($_) && ($_ ne $self->root || carp('attempt to remove hierarchy root!') && 0)
$self->has_type($_) $_ ne $self->root carp("attempt to remove hierarchy root!")
Truth table25%1/4
A && B or C
A= $self->has_type($_)B= $_ ne $self->rootC= carp("attempt to remove hierarchy root!")
ABCresult
0XX0
1000
11X1
1011
394 ($_ ne $self->root || (carp("attempt to remove hierarchy root!") &&
395 0))
396 } @_;
397 2 ▶ return $self unless (@_); # not really deleting anything
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 2 2
398  
399 2 $self->compiled(0);
400  
401 2 my ($kids,$parents,$type,$idx);
402 2 my ($v0,$v1) = @{$self->{vectors}}[0,1];
403 2 foreach $type (@_) {
404 # get type-information
405 2 $idx = $self->{indices}{$type};
406 2 $kids = $self->{children}[$idx];
407 2 $parents = $self->{parents}[$idx];
408  
409 # adopt orphans
410 2 foreach (@{$self->{parents}}[_enum2indices($kids,$v0)]) {
411 # $_ is the parents-enum of an orphaned child
412 2 $_ = _enum_bit_off(_enum_union($_, $parents, $v0, $v1), $idx, $v0);
413 }
414 2 foreach (@{$self->{children}}[_enum2indices($parents,$v0)]) {
415 # $_ is the kids-enum of an adopting grandparent
416 2 $_ = _enum_bit_off(_enum_union($_, $kids, $v0, $v1), $idx, $v0);
417 }
418  
419 # actually remove the type
420 2 delete($self->{indices}{$type});
421 2 delete($self->{types}[$idx]);
422 2 delete($self->{parents}[$idx]);
423 2 delete($self->{children}[$idx]);
424  
425 # ... and mark its index as re-usable
426 2 push(@{$self->{removed}}, $idx);
427 }
428 # ensure 'removed' is sorted...
429 0 @{$self->{removed}} = sort { $a <=> $b } @{$self->{removed}};
430 2 return $self;
431 }
432  
433 #--------------------------------------------------------------
434 # @prts = $h->parents($type)
435 834 ▶sub parents ($$) {
Subroutine parents: called CC=2 SCAR=7.6
Pod documented
436 return
437 $_[0]->has_type($_[1])
438 ? $_[0]->_enum2types($_[0]->{parents}[$_[0]->{indices}{$_[1]}],
439 #$_[0]->_parents_enum($_[1]),
440 834 ▶ $_[0]->{vectors}[0])
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->has_type($_[1]) ? : 834 0 834
441 : qw();
442 }
443  
444 #--------------------------------------------------------------
445 # @kids = $h->children($type)
446 28 ▶sub children ($$) {
Subroutine children: called CC=2 SCAR=7.6
Pod documented
447 $_[0]->has_type($_[1])
448 ? $_[0]->_enum2types($_[0]->{children}[$_[0]->{indices}{$_[1]}],
449 #$_[0]->_children_enum($_[1]),
450 28 ▶ $_[0]->{vectors}[0])
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->has_type($_[1]) ? : 28 0 28
451 : qw();
452 }
453  
454  
455 #--------------------------------------------------------------
456 1 ▶sub ancestors ($$) {
Subroutine ancestors: called CC=4 SCAR=17.9
Pod documented
457 1 my ($i);
458 return
459 defined($_[1]) && defined($i = $_[0]->{indices}{$_[1]}) &&
460 $_[0]->compiled(1)
461 1 ▶ ? $_[0]->mask2types($_[0]->{ancestors}[$i])
Branch: 1 branch
BranchTrueFalseTotal
defined $_[1] && defined($i = $_[0]{'indices'}{$_[1]}) && $_[0]->compiled(1) ? : 1 0 1
Condition33%2/6
defined $_[1] and defined($i = $_[0]{"indices"}{$_[1]}) and $_[0]->compiled(1)
!ll&&!rl&&r
001
defined $_[1] and defined($i = $_[0]{"indices"}{$_[1]})
!ll&&!rl&&r
001
MC/DC0%0/3
defined $_[1] and defined($i = $_[0]{"indices"}{$_[1]}) and $_[0]->compiled(1)
defined $_[1] defined($i = $_[0]{"indices"}{$_[1]}) $_[0]->compiled(1)
Truth table25%1/4
A and B and C
A= defined $_[1]B= defined($i = $_[0]{"indices"}{$_[1]})C= $_[0]->compiled(1)
ABCresult
0XX0
10X0
1100
1111
462 : qw();
463 }
464  
465 #--------------------------------------------------------------
466 1 ▶sub descendants ($$) {
Subroutine descendants: called CC=3 SCAR=13.1
Pod documented
467 1 my ($i);
468 return
469 defined($i = $_[0]->{indices}{$_[1]}) &&
470 $_[0]->compiled(1)
471 1 ▶ ? $_[0]->mask2types($_[0]->{descendants}[$i])
Branch: 1 branch
BranchTrueFalseTotal
defined($i = $_[0]{'indices'}{$_[1]}) && $_[0]->compiled(1) ? : 1 0 1
Condition33%1/3
defined($i = $_[0]{"indices"}{$_[1]}) and $_[0]->compiled(1)
!ll&&!rl&&r
001
MC/DC0%0/2
defined($i = $_[0]{"indices"}{$_[1]}) and $_[0]->compiled(1)
defined($i = $_[0]{"indices"}{$_[1]}) $_[0]->compiled(1)
Truth table33%1/3
A and B
A= defined($i = $_[0]{"indices"}{$_[1]})B= $_[0]->compiled(1)
ABresult
0X0
100
111
472 : qw();
473 }
474  
475 #--------------------------------------------------------------
476 # $bool = $h->has_parent($typ,$prt)
477 402 ▶sub has_parent ($$$) {
Subroutine has_parent: called CC=2 SCAR=9.2
Pod documented
478 return
479 $_[0]->has_types(@_[1,2]) &&
480 _enum_bit_test($_[0]->{parents}[$_[0]->{indices}{$_[1]}],
481 $_[0]->{indices}{$_[2]},
482 402 ▶ $_[0]->{vectors}[0]);
Condition33%1/3
$_[0]->has_types(@_[1, 2]) && &_enum_bit_test($_[0]{'parents'}[$_[0]{'indices'}{$_[1]}], $_[0]{'indices'}{$_[2]}, $_[0]{'vectors'}[0])
!ll&&!rl&&r
00402
MC/DC0%0/2
$_[0]->has_types(@_[1, 2]) && &_enum_bit_test($_[0]{'parents'}[$_[0]{'indices'}{$_[1]}], $_[0]{'indices'}{$_[2]}, $_[0]{'vectors'}[0])
$_[0]->has_types(@_[1, 2]) &_enum_bit_test($_[0]{'parents'}[$_[0]{'indices'}{$_[1]}], $_[0]{'indices'}{$_[2]}, $_[0]{'vectors'}[0])
Truth table33%1/3
A && B
A= $_[0]->has_types(@_[1, 2])B= &_enum_bit_test($_[0]{'parents'}[$_[0]{'indices'}{$_[1]}], $_[0]{'indices'}{$_[2]}, $_[0]{'vectors'}[0])
ABresult
0X0
100
111
483 }
484  
485  
486 #--------------------------------------------------------------
487 # $bool = $h->has_child($typ,$kid)
488 2 ▶sub has_child ($$$) {
Subroutine has_child: called CC=2 SCAR=9.2
Pod documented
489 return
490 $_[0]->has_types(@_[1,2]) &&
491 _enum_bit_test($_[0]->{children}[$_[0]->{indices}{$_[1]}],
492 $_[0]->{indices}{$_[2]},
493 2 ▶ $_[0]->{vectors}[0]);
Condition33%1/3
$_[0]->has_types(@_[1, 2]) && &_enum_bit_test($_[0]{'children'}[$_[0]{'indices'}{$_[1]}], $_[0]{'indices'}{$_[2]}, $_[0]{'vectors'}[0])
!ll&&!rl&&r
002
MC/DC0%0/2
$_[0]->has_types(@_[1, 2]) && &_enum_bit_test($_[0]{'children'}[$_[0]{'indices'}{$_[1]}], $_[0]{'indices'}{$_[2]}, $_[0]{'vectors'}[0])
$_[0]->has_types(@_[1, 2]) &_enum_bit_test($_[0]{'children'}[$_[0]{'indices'}{$_[1]}], $_[0]{'indices'}{$_[2]}, $_[0]{'vectors'}[0])
Truth table33%1/3
A && B
A= $_[0]->has_types(@_[1, 2])B= &_enum_bit_test($_[0]{'children'}[$_[0]{'indices'}{$_[1]}], $_[0]{'indices'}{$_[2]}, $_[0]{'vectors'}[0])
ABresult
0X0
100
111
494 }
495  
496  
497  
498 #--------------------------------------------------------------
499 # $bool = $h->has_ancestor($typ,$anc)
500 6 ▶sub has_ancestor ($$$) {
Subroutine has_ancestor: called CC=2 SCAR=7.2
Pod documented
501 return
502 $_[0]->has_types(@_[1,2])
503 && $_[0]->has_ancestor_index($_[0]->{indices}{$_[1]},
504 6 ▶ $_[0]->{indices}{$_[2]});
Condition66%2/3
$_[0]->has_types(@_[1, 2]) && $_[0]->has_ancestor_index($_[0]{'indices'}{$_[1]}, $_[0]{'indices'}{$_[2]})
!ll&&!rl&&r
024
MC/DC50%1/2
$_[0]->has_types(@_[1, 2]) && $_[0]->has_ancestor_index($_[0]{'indices'}{$_[1]}, $_[0]{'indices'}{$_[2]})
$_[0]->has_types(@_[1, 2]) $_[0]->has_ancestor_index($_[0]{'indices'}{$_[1]}, $_[0]{'indices'}{$_[2]})
Truth table66%2/3
A && B
A= $_[0]->has_types(@_[1, 2])B= $_[0]->has_ancestor_index($_[0]{'indices'}{$_[1]}, $_[0]{'indices'}{$_[2]})
ABresult
0X0
100
111
505  
506 }
507  
508  
509 #--------------------------------------------------------------
510 # $bool = $h->has_descendent($typ,$dsc)
511 2 ▶sub has_descendant ($$$) {
Subroutine has_descendant: called CC=2 SCAR=9.2
Pod documented
512 return
513 $_[0]->has_types(@_[1,2])
514 && $_[0]->has_descendant_index($_[0]->{indices}{$_[1]},
515 2 ▶ $_[0]->{indices}{$_[2]});
Condition33%1/3
$_[0]->has_types(@_[1, 2]) && $_[0]->has_descendant_index($_[0]{'indices'}{$_[1]}, $_[0]{'indices'}{$_[2]})
!ll&&!rl&&r
002
MC/DC0%0/2
$_[0]->has_types(@_[1, 2]) && $_[0]->has_descendant_index($_[0]{'indices'}{$_[1]}, $_[0]{'indices'}{$_[2]})
$_[0]->has_types(@_[1, 2]) $_[0]->has_descendant_index($_[0]{'indices'}{$_[1]}, $_[0]{'indices'}{$_[2]})
Truth table33%1/3
A && B
A= $_[0]->has_types(@_[1, 2])B= $_[0]->has_descendant_index($_[0]{'indices'}{$_[1]}, $_[0]{'indices'}{$_[2]})
ABresult
0X0
100
111
516  
517 }
518  
519 #--------------------------------------------------------------
520 # @sorted = subsort(@types)
521 0 ▶sub subsort ($@) {
Subroutine subsort: not called CC=8 SCAR=42.8
Pod documented
522 0 my $h = shift;
523 0 ▶ return qw() unless (@_);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 0 0
524 0 $h->compiled(1);
525 0 ▶ my @indices = map { defined($_) ? $h->{indices}{$_} : undef } @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 0 0 0
526 0 my @other = qw();
527 0 my ($i,$j);
528 0 ▶ for ($i = 0; $i <= $#_; ++$i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#_) 0 0 0
529 0 ▶ for ($j = $i+1; $j <= $#_; ++$j) {
Branch: 1 branch
BranchTrueFalseTotal
if ($j <= $#_) 0 0 0
530 0 ▶ if (!defined($indices[$i])
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $indices[$i] or defined $indices[$j] and $h->{"ancestors"}[$indices[$i]]->bit_test($indices[$j])) 0 0 0
Condition0%0/6
not defined $indices[$i] or defined $indices[$j] and $h->{"ancestors"}[$indices[$i]]->bit_test($indices[$j])
l!l&&r!l&&!r
000
defined $indices[$j] and $h->{"ancestors"}[$indices[$i]]->bit_test($indices[$j])
!ll&&!rl&&r
000
MC/DC0%0/3
not defined $indices[$i] or defined $indices[$j] and $h->{"ancestors"}[$indices[$i]]->bit_test($indices[$j])
not defined $indices[$i] defined $indices[$j] $h->{"ancestors"}[$indices[$i]]->bit_test($indices[$j])
Truth table0%0/4
not(A) or B and C
A= not defined $indices[$i]B= defined $indices[$j]C= $h->{"ancestors"}[$indices[$i]]->bit_test($indices[$j])
ABCresult
1XX1
0111
00X0
0100
531 ||
532 (defined($indices[$j]) &&
533 $h->{ancestors}[$indices[$i]]->bit_test($indices[$j])))
534 {
535 0 @indices[$i,$j] = @indices[$j,$i];
536 0 @_[$i,$j] = @_[$j,$i];
537 }
538 }
539 }
540 0 return @_, @other;
541 }
542  
543  
544  
545 #--------------------------------------------------------------
546 # \%strata = get_strata(@types)
547 0 ▶sub get_strata ($@) {
Subroutine get_strata: not called CC=11 SCAR=48.8
Pod documented
548 0 my $h = shift;
549 0 $h->compiled(1);
550 0 ▶ my @indices = @{$h->{indices}}{grep { defined($_) && exists($h->{indices}{$_}) } @_};
Condition0%0/3
defined $_ && exists $h->{'indices'}{$_}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $_ && exists $h->{'indices'}{$_}
defined $_ exists $h->{'indices'}{$_}
Truth table0%0/3
A && B
A= defined $_B= exists $h->{'indices'}{$_}
ABresult
0X0
100
111
551 0 my (@strata);
552 0 foreach (@indices) { $strata[$_] = 0; }
553 0 my ($cmp,$i,$j);
554 0 my $changed = 1;
555 0 my $step = 1;
556  
557 0 ▶ while ($changed) {
Branch: 1 branch
BranchTrueFalseTotal
if ($changed) 0 0 0
558 0 ▶ last if ($step > scalar(@_));
Branch: 1 branch
BranchTrueFalseTotal
if $step > scalar @_ 0 0 0
559 0 $changed = 0;
560  
561 0 ▶ for ($i = 0; $i < $#indices; ++$i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $#indices) 0 0 0
562 0 ▶ for ($j = $i+1; $j <= $#indices; ++$j) {
Branch: 1 branch
BranchTrueFalseTotal
if ($j <= $#indices) 0 0 0
563  
564 0 ▶ if ($h->{ancestors}[$indices[$j]]->bit_test($indices[$i])) {
Branch: 2 branches
BranchTrueFalseTotal
if ($h->{'ancestors'}[$indices[$j]]->bit_test($indices[$i])) { } 0 0 0
elsif ($h->{'ancestors'}[$indices[$i]]->bit_test($indices[$j])) { } 0 0 0
565 0 ▶ next if ($strata[$indices[$i]] < $strata[$indices[$j]]);
Branch: 1 branch
BranchTrueFalseTotal
if $strata[$indices[$i]] < $strata[$indices[$j]] 0 0 0
566 0 $changed = 1;
567 0 $strata[$indices[$j]] = $strata[$indices[$i]] + 1;
568 }
569 elsif ($h->{ancestors}[$indices[$i]]->bit_test($indices[$j])) {
570 0 ▶ next if ($strata[$indices[$i]] > $strata[$indices[$j]]);
Branch: 1 branch
BranchTrueFalseTotal
if $strata[$indices[$i]] > $strata[$indices[$j]] 0 0 0
571 0 $changed = 1;
572 0 $strata[$indices[$i]] = $strata[$indices[$j]] + 1;
573 }
574 }
575 }
576 }
577 my %strata =
578 0 (map { $h->{types}[$_] => $strata[$_] } @indices);
579 0 return \%strata;
580 }
581  
582  
583 #--------------------------------------------------------------
584 # $h->_compare_index($i1,$i2);
585 0 ▶sub _compare_index ($$$) {
Subroutine _compare_index: not called CC=8 SCAR=42.8
586 0 ▶ return 0 if (# object-equality is easy
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[1] and defined $_[2] and $_[1] == $_[2] or not defined $_[1] || defined $_[2] 0 0 0
Condition0%0/12
defined $_[1] and defined $_[2] and $_[1] == $_[2] or not defined $_[1] || defined $_[2]
l!l&&r!l&&!r
000
defined $_[1] and defined $_[2] and $_[1] == $_[2]
!ll&&!rl&&r
000
defined $_[1] and defined $_[2]
!ll&&!rl&&r
000
defined $_[1] || defined $_[2]
l!l&&r!l&&!r
000
MC/DC0%0/5
defined $_[1] and defined $_[2] and $_[1] == $_[2] or not defined $_[1] || defined $_[2]
defined $_[1] defined $_[2] $_[1] == $_[2] defined $_[1] defined $_[2]
Truth table0%0/10
A and B and C or not(D || E)
A= defined $_[1]B= defined $_[2]C= $_[1] == $_[2]D= defined $_[1]E= defined $_[2]
ABCDEresult
111XX1
0XX001
10X001
110001
0XX1X0
0XX010
10X1X0
10X010
1101X0
110010
587 (defined($_[1]) and defined($_[2]) and $_[1] == $_[2])
588 or
589 # so is undef
590 (!defined($_[1]) and !defined($_[2])));
591 0 ▶ return 1 if ($_[0]->has_ancestor_index($_[1],$_[2]));
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]->has_ancestor_index($_[1], $_[2]) 0 0 0
592 0 ▶ return -1 if ($_[0]->has_ancestor_index($_[2],$_[1]));
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]->has_ancestor_index($_[2], $_[1]) 0 0 0
593 0 return undef; # incomparable
594 }
595  
596  
597 #--------------------------------------------------------------
598 # @min = $h->min(@types)
599 0 ▶sub min ($@) {
Subroutine min: not called CC=1 SCAR=6.9
Pod documented
600 return
601 0 $_[0]->mask2types
602 ($_[0]->_minimize($_[0]->types2mask(@_[1..$#_])));
603 }
604  
605  
606 #--------------------------------------------------------------
607 # @max = $h->max(@types)
608 0 ▶sub max ($@) {
Subroutine max: not called CC=1 SCAR=6.9
Pod documented
609 return
610 0 $_[0]->mask2types
611 ($_[0]->_maximize($_[0]->types2mask(@_[1..$#_])));
612 }
613  
614  
615 #--------------------------------------------------------------
616 # $bv = $h->_minimize($bv,$tmp)
617 5 ▶sub _minimize ($$) {
Subroutine _minimize: called CC=6 SCAR=18.0
618 5 my $self = shift;
619 5 my $bv = shift;
620 5 $self->compiled(1);
621 5 my $vecary = $self->{descendants};
622 5 my ($bmin,$bmax);
623 5 my $i = 0;
624 5 ▶ while ($i < $self->_size && (($bmin,$bmax) = $bv->Interval_Scan_inc($i)))
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $self->_size and () = $bv->Interval_Scan_inc($i)) 2 5 7
Condition100%3/3
$i < $self->_size and () = $bv->Interval_Scan_inc($i)
!ll&&!rl&&r
232
MC/DC100%2/2
$i < $self->_size and () = $bv->Interval_Scan_inc($i)
$i < $self->_size () = $bv->Interval_Scan_inc($i)
Truth table100%3/3
A and B
A= $i < $self->_sizeB= () = $bv->Interval_Scan_inc($i)
ABresult
0X0
100
111
625 {
626 2 ▶ for ($i = $bmin; $i <= $bmax; ++$i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $bmax) 3 2 5
627 3 ▶ last unless ($bv->bit_test($i)); # it might already have been removed
Branch: 1 branch
BranchTrueFalseTotal
unless $bv->bit_test($i) 0 3 3
628 3 $bv->Difference($bv, $vecary->[$i]);
629 }
630 2 ▶ if ($i >= $bmax) { $i = $bmax + 2; }
Branch: 1 branch
BranchTrueFalseTotal
if ($i >= $bmax) { } 2 0 2
631 0 else { ++$i; }
632 }
633 5 return $bv;
634 }
635  
636 #--------------------------------------------------------------
637 # $bv = $h->_maximize($bv,$tmp)
638 1 ▶sub _maximize ($$) {
Subroutine _maximize: called CC=6 SCAR=18.2
639 1 my $self = shift;
640 1 my $bv = shift;
641 1 $self->compiled(1);
642 1 my ($bmin,$bmax);
643 1 my $vecary = $self->{ancestors};
644 1 my $i = $self->_size;
645 1 ▶ while ($i >= 0 && (($bmin,$bmax) = $bv->Interval_Scan_dec($i)))
Branch: 1 branch
BranchTrueFalseTotal
if ($i >= 0 and () = $bv->Interval_Scan_dec($i)) 1 1 2
Condition66%2/3
$i >= 0 and () = $bv->Interval_Scan_dec($i)
!ll&&!rl&&r
101
MC/DC50%1/2
$i >= 0 and () = $bv->Interval_Scan_dec($i)
$i >= 0 () = $bv->Interval_Scan_dec($i)
Truth table66%2/3
A and B
A= $i >= 0B= () = $bv->Interval_Scan_dec($i)
ABresult
0X0
100
111
646 {
647 1 ▶ for ($i = $bmax; $i >= $bmin; --$i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i >= $bmin) 1 1 2
648 1 ▶ last unless ($bv->bit_test($i)); # it might already have been removed
Branch: 1 branch
BranchTrueFalseTotal
unless $bv->bit_test($i) 0 1 1
649 1 $bv->Difference($bv, $vecary->[$i]);
650 }
651 1 ▶ if ($i <= $bmin) { $i = $bmin - 2; }
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $bmin) { } 1 0 1
652 0 else { --$i; }
653 }
654 1 return $bv;
655 }
656  
657  
658 #--------------------------------------------------------------
659 # get_attribute($t,$a) : inherited from Base
660  
661 #--------------------------------------------------------------
662 # set_attribute($t,$a,$v) : inherited from Base
663  
664 #--------------------------------------------------------------
665 # $h1 = $h1->assign($h2)
666 12 ▶sub assign ($$) {
Subroutine assign: called CC=4 SCAR=14.0
Pod documented
667 12 my ($h1,$h2) = @_;
668 12 ▶ return $h1->SUPER::assign($h2) unless (ref($h1) eq ref($h2));
Branch: 1 branch
BranchTrueFalseTotal
unless ref $h1 eq ref $h2 8 4 12
669 #$h1->clear();
670  
671 4 %{$h1->{indices}} = %{$h2->{indices}};
672 4 @{$h1->{types}} = @{$h2->{types}};
673 4 @{$h1->{removed}} = @{$h2->{removed}};
674 4 @{$h1->{attributes}} = @{$h2->{attributes}};
675  
676 4 @{$h1->{parents}} = @{$h2->{parents}};
677 4 @{$h1->{children}} = @{$h2->{children}};
678  
679 4 @{$h1->{ancestors}} =
680 map {
681 0 ▶ defined($_) ? $_->Clone : undef
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 0 0 0
682 4 } @{$h2->{ancestors}};
683 4 @{$h1->{descendants}} =
684 map {
685 0 ▶ defined($_) ? $_->Clone : undef
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 0 0 0
686 4 } @{$h2->{descendants}};
687  
688 4 @$h1{qw(root compiled)} = @$h2{qw(root compiled)};
689  
690 4 %{$h1->{hattributes}} = %{$h2->{hattributes}};
691  
692 4 $h1->_ensure_vector_sizes();
693 4 return $h1;
694 }
695  
696  
697 #--------------------------------------------------------------
698 # $h1 = $h1->merge($h2,...) : inherited from Base
699  
700  
701 #--------------------------------------------------------------
702 # $h = $h->clear();
703 10 ▶sub clear ($) {
Subroutine clear: called CC=1 SCAR=0.0
Pod documented
704 10 my $self = shift;
705 10 @{$self->{types}} = qw();
706 10 %{$self->{indices}} = ();
707 10 @{$self->{parents}} = qw();
708 10 @{$self->{children}} = qw();
709 10 @{$self->{attributes}} = qw();
710 10 @{$self->{removed}} = qw();
711 10 @{$self->{ancestors}} = qw();
712 10 @{$self->{descendants}} = qw();
713 10 $self->{compiled} = 0;
714 10 %{$self->{hattributes}} = ();
715  
716 # make sure we still have the root type!
717 10 $self->_root($self->{root});
718 10 return $self;
719 }
720  
721  
722 ###############################################################
723 # Additional Hierarchy Info/Maintainence Operations
724 ###############################################################
725  
726 #--------------------------------------------------------------
727 # $root = $h->ensure_types(@types): inherited from Base
728  
729 #--------------------------------------------------------------
730 # has_types: inherited from Base
731  
732 # $bool = $h->has_ancestor_index($typ_idx,$anc_idx);
733 3 ▶sub has_ancestor_index ($$$) {
Subroutine has_ancestor_index: called CC=6 SCAR=25.2
Pod documented
734 return
735 defined($_[0]) && defined($_[1]) && defined($_[2]) &&
736 $_[0]->compiled(1) &&
737 defined($_[0]->{ancestors}[$_[1]]) &&
738 3 ▶ $_[0]->{ancestors}[$_[1]]->bit_test($_[2]);
Condition40%6/15
defined $_[0] && defined $_[1] && defined $_[2] && $_[0]->compiled(1) && defined $_[0]{'ancestors'}[$_[1]] && $_[0]{'ancestors'}[$_[1]]->bit_test($_[2])
!ll&&!rl&&r
012
defined $_[0] and defined $_[1] and defined $_[2] and $_[0]->compiled(1) and defined $_[0]{"ancestors"}[$_[1]]
!ll&&!rl&&r
003
defined $_[0] and defined $_[1] and defined $_[2] and $_[0]->compiled(1)
!ll&&!rl&&r
003
defined $_[0] and defined $_[1] and defined $_[2]
!ll&&!rl&&r
003
defined $_[0] and defined $_[1]
!ll&&!rl&&r
003
MC/DC16%1/6
defined $_[0] && defined $_[1] && defined $_[2] && $_[0]->compiled(1) && defined $_[0]{'ancestors'}[$_[1]] && $_[0]{'ancestors'}[$_[1]]->bit_test($_[2])
defined $_[0] defined $_[1] defined $_[2] $_[0]->compiled(1) defined $_[0]{"ancestors"}[$_[1]] $_[0]{'ancestors'}[$_[1]]->bit_test($_[2])
Truth table28%2/7
A and B and C and D and E && F
A= defined $_[0]B= defined $_[1]C= defined $_[2]D= $_[0]->compiled(1)E= defined $_[0]{"ancestors"}[$_[1]]F= $_[0]{'ancestors'}[$_[1]]->bit_test($_[2])
ABCDEFresult
0XXXXX0
10XXXX0
110XXX0
1110XX0
11110X0
1111100
1111111
739 }
740  
741 # $bool = $h->has_descendant_index($typ_idx,$dsc_idx);
742 1 ▶sub has_descendant_index ($$$) {
Subroutine has_descendant_index: called CC=6 SCAR=26.9
Pod documented
743 return
744 defined($_[0]) && defined($_[1]) && defined($_[2]) &&
745 $_[0]->compiled(1) &&
746 defined($_[0]->{descendants}[$_[1]]) &&
747 1 ▶ $_[0]->{descendants}[$_[1]]->bit_test($_[2]);
Condition33%5/15
defined $_[0] && defined $_[1] && defined $_[2] && $_[0]->compiled(1) && defined $_[0]{'descendants'}[$_[1]] && $_[0]{'descendants'}[$_[1]]->bit_test($_[2])
!ll&&!rl&&r
001
defined $_[0] and defined $_[1] and defined $_[2] and $_[0]->compiled(1) and defined $_[0]{"descendants"}[$_[1]]
!ll&&!rl&&r
001
defined $_[0] and defined $_[1] and defined $_[2] and $_[0]->compiled(1)
!ll&&!rl&&r
001
defined $_[0] and defined $_[1] and defined $_[2]
!ll&&!rl&&r
001
defined $_[0] and defined $_[1]
!ll&&!rl&&r
001
MC/DC0%0/6
defined $_[0] && defined $_[1] && defined $_[2] && $_[0]->compiled(1) && defined $_[0]{'descendants'}[$_[1]] && $_[0]{'descendants'}[$_[1]]->bit_test($_[2])
defined $_[0] defined $_[1] defined $_[2] $_[0]->compiled(1) defined $_[0]{"descendants"}[$_[1]] $_[0]{'descendants'}[$_[1]]->bit_test($_[2])
Truth table14%1/7
A and B and C and D and E && F
A= defined $_[0]B= defined $_[1]C= defined $_[2]D= $_[0]->compiled(1)E= defined $_[0]{"descendants"}[$_[1]]F= $_[0]{'descendants'}[$_[1]]->bit_test($_[2])
ABCDEFresult
0XXXXX0
10XXXX0
110XXX0
1110XX0
11110X0
1111100
1111111
748 }
749  
750 # $bv = $h->ancestors_mask($typ_idx)
751 0 ▶sub ancestors_mask ($$) {
Subroutine ancestors_mask: not called CC=3 SCAR=24.8
Pod documented
752 return
753 (defined($_[0]->{types}[$_[1]]) && $_[0]->compiled(1)
754 0 ▶ ? $_[0]->{ancestors}[$_[1]]->Clone
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0]{'types'}[$_[1]] && $_[0]->compiled(1) ? : 0 0 0
Condition0%0/3
defined $_[0]{"types"}[$_[1]] and $_[0]->compiled(1)
!ll&&!rl&&r
000
MC/DC0%0/2
defined $_[0]{"types"}[$_[1]] and $_[0]->compiled(1)
defined $_[0]{"types"}[$_[1]] $_[0]->compiled(1)
Truth table0%0/3
A and B
A= defined $_[0]{"types"}[$_[1]]B= $_[0]->compiled(1)
ABresult
0X0
100
111
755 : undef);
756 }
757  
758 # $bv = $h->descendants_mask($typ_idx)
759 0 ▶sub descendants_mask ($$) {
Subroutine descendants_mask: not called CC=3 SCAR=24.8
Pod documented
760 return
761 (defined($_[0]->{types}[$_[1]]) && $_[0]->compiled(1)
762 0 ▶ ? $_[0]->{ancestors}[$_[1]]->Clone
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0]{'types'}[$_[1]] && $_[0]->compiled(1) ? : 0 0 0
Condition0%0/3
defined $_[0]{"types"}[$_[1]] and $_[0]->compiled(1)
!ll&&!rl&&r
000
MC/DC0%0/2
defined $_[0]{"types"}[$_[1]] and $_[0]->compiled(1)
defined $_[0]{"types"}[$_[1]] $_[0]->compiled(1)
Truth table0%0/3
A and B
A= defined $_[0]{"types"}[$_[1]]B= $_[0]->compiled(1)
ABresult
0X0
100
111
763 : undef);
764 }
765  
766  
767 #--------------------------------------------------------------
768 # $rv = $h->iterate_i(\&next,\&callback,\%args)
769 0 ▶sub iterate_i ($&&;$) {
Subroutine iterate_i: not called CC=5 SCAR=34.0
Pod documented
770 0 my ($self,$next,$callback,$args) = @_;
771 0 my ($i,$r);
772 my @q = defined($args->{start})
773 ? ref($args->{start})
774 0 ? @{$args->{start}}
775 : ($args->{start})
776 0 ▶ : ($self->{indices}{$self->root});
Branch: 2 branches
BranchTrueFalseTotal
defined $args->{'start'} ? : 0 0 0
ref $args->{'start'} ? : 0 0 0
777 0 ▶ while (@q) {
Branch: 1 branch
BranchTrueFalseTotal
if (@q) 0 0 0
778 0 $i = shift(@q);
779 0 $r = &$callback($self, $i, $args);
780 0 ▶ return $r if (defined($r));
Branch: 1 branch
BranchTrueFalseTotal
if defined $r 0 0 0
781 0 push(@q, &$next($self,$i,$args));
782 }
783 0 return $args->{return};
784 }
785  
786 #--------------------------------------------------------------
787 # $rv = $h->iterate_pc_i(\&callback,\%args)
788 0 ▶sub iterate_pc_i ($&;$) {
Subroutine iterate_pc_i: not called CC=1 SCAR=6.9
Pod documented
789 return
790 0 $_[0]->iterate_i(\&_iterate_pc_i_next, $_[1], $_[2]);
791 }
792 0 ▶sub _iterate_pc_i_next ($$) {
Subroutine _iterate_pc_i_next: not called CC=2 SCAR=17.9
793 return
794 _enum2indices($_[0]->{children}[$_[1]],
795 $_[0]->{vectors}[0])
796 0 ▶ if (defined($_[0]->{children}[$_[1]]));
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[0]{"children"}[$_[1]] 0 0 0
797 }
798  
799  
800 #--------------------------------------------------------------
801 # $rv = $h->iterate_cp_i(\&sub,\%args)
802 0 ▶sub iterate_cp_i ($&;$) {
Subroutine iterate_cp_i: not called CC=1 SCAR=6.9
Pod documented
803 return
804 0 $_[0]->iterate_i(\&_iterate_cp_i_next, $_[1], $_[2]);
805 }
806 0 ▶sub _iterate_cp_i_next ($$) {
Subroutine _iterate_cp_i_next: not called CC=2 SCAR=17.9
807 return
808 _enum2indices($_[0]->{parents}[$_[1]],
809 $_[0]->{vectors}[0])
810 0 ▶ if (defined($_[0]->{parents}[$_[1]]));
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[0]{"parents"}[$_[1]] 0 0 0
811 }
812  
813  
814  
815  
816 ###############################################################
817 # Type Operations
818 ###############################################################
819  
820 #--------------------------------------------------------------
821 # _get_bounds_log($i1,$i2,\@vectors,$want_indices,$min_or_max)
822 13 ▶sub _get_bounds_log ($$$$;$$) {
Subroutine _get_bounds_log: called CC=9 SCAR=24.4
823 13 my $self = shift;
824 13 my $i1 = shift;
825 13 my $i2 = shift;
826 13 my $vecary = shift;
827  
828 # sanity checks
829 return undef unless
830 13 ▶ (defined($i1) && defined($i2) && $self->compiled(1));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $i1 and defined $i2 and $self->compiled(1) 0 13 13
Condition33%2/6
defined $i1 and defined $i2 and $self->compiled(1)
!ll&&!rl&&r
0013
defined $i1 and defined $i2
!ll&&!rl&&r
0013
MC/DC0%0/3
defined $i1 and defined $i2 and $self->compiled(1)
defined $i1 defined $i2 $self->compiled(1)
Truth table25%1/4
A and B and C
A= defined $i1B= defined $i2C= $self->compiled(1)
ABCresult
0XX0
10X0
1100
1111
831  
832 # set up solutions-vector
833 13 my $solns = $self->{vectors}[0]->Shadow;
834  
835 13 ▶ if (shift) { # $want_indices
Branch: 1 branch
BranchTrueFalseTotal
if (shift()) 13 0 13
836 # get the easy answers
837 13 ▶ if ($vecary->[$i1]->bit_test($i2)) {
Branch: 2 branches
BranchTrueFalseTotal
if ($vecary->[$i1]->bit_test($i2)) { } 7 6 13
elsif ($vecary->[$i2]->bit_test($i1)) { } 0 6 6
838 7 $solns->Bit_On($i2);
839 7 return $solns;
840 }
841 elsif ($vecary->[$i2]->bit_test($i1)) {
842 0 $solns->Bit_On($i1);
843 0 return $solns;
844 }
845 }
846  
847 # the guts
848 6 $solns->Intersection($vecary->[$i1],$vecary->[$i2]);
849 6 ▶ if ($_[0] < 0) {
Branch: 2 branches
BranchTrueFalseTotal
if ($_[0] < 0) { } 5 1 6
elsif ($_[0] > 0) { } 1 0 1
850 5 return $self->_minimize($solns);
851 } elsif ($_[0] > 0) {
852 1 return $self->_maximize($solns);
853 }
854 # well that's odd -- let's just return the intersection
855 0 return $solns;
856 }
857  
858  
859 #--------------------------------------------------------------
860 # @lubs = $h->_lub($t1,$t2)
861 24 ▶sub _lub ($$$) {
Subroutine _lub: called CC=1 SCAR=0.0
862 return
863 24 @{$_[0]->{types}}[$_[0]->_get_bounds_log
864 ($_[0]->{indices}{$_[1]},
865 $_[0]->{indices}{$_[2]},
866 $_[0]->{descendants},
867 24 1, -1)->Index_List_Read];
868 }
869  
870 #--------------------------------------------------------------
871 # @mcds = $h->_mcd($i1,$i2)
872 0 ▶sub _mcd ($$$) {
Subroutine _mcd: not called CC=1 SCAR=6.9
873 return
874 0 @{$_[0]->{types}}[$_[0]->_get_bounds_log
875 ($_[0]->{indices}{$_[1]},
876 $_[0]->{indices}{$_[2]},
877 $_[0]->{descendants},
878 0 0, -1)->Index_List_Read];
879 }
880  
881 #--------------------------------------------------------------
882 # @glbs = $h->_glb($t1,$t2)
883 2 ▶sub _glb ($$$) {
Subroutine _glb: called CC=1 SCAR=0.0
884 return
885 2 @{$_[0]->{types}}[$_[0]->_get_bounds_log
886 ($_[0]->{indices}{$_[1]},
887 $_[0]->{indices}{$_[2]},
888 $_[0]->{ancestors},
889 2 1, 1)->Index_List_Read];
890 }
891  
892 #--------------------------------------------------------------
893 # @mcas = $h->_mca($i1,$i2)
894 0 ▶sub _mca ($$$) {
Subroutine _mca: not called CC=1 SCAR=6.9
895 return
896 0 @{$_[0]->{types}}[$_[0]->_get_bounds_log
897 ($_[0]->{indices}{$_[1]},
898 $_[0]->{indices}{$_[2]},
899 $_[0]->{ancestors},
900 0 0, 1)->Index_List_Read];
901 }
902  
903  
904  
905  
906 ###############################################################
907 # Low-level Accessors/manipulators
908 ###############################################################
909  
910 # $h->_ensure_vector_sizes(), $h->_ensure_vector_sizes($size)
911 172 ▶sub _ensure_vector_sizes ($;$) {
Subroutine _ensure_vector_sizes: called CC=4 SCAR=14.2
912 172 ▶ my $size = exists($_[1]) ? $_[1] : scalar(@{$_[0]->{types}});
Branch: 1 branch
BranchTrueFalseTotal
exists $_[1] ? : 0 172 172
913 172 $size = int(1 + ($size / $VECTOR_GROW_STEP)) * $VECTOR_GROW_STEP;
914 172 foreach (@{$_[0]->{vectors}}) {
915 344 ▶ $_->Resize($size) unless ($_->Size > $size);
Branch: 1 branch
BranchTrueFalseTotal
unless $_->Size > $size 344 0 344
916 }
917 }
918  
919 #--------------------------------------------------------------
920 10 ▶sub _indices ($) { return $_[0]->{indices}; }
Subroutine _indices: called CC=1 SCAR=0.0
921 0 ▶sub _types ($) { return $_[0]->{types}; }
Subroutine _types: not called CC=1 SCAR=6.9
922  
923 #--------------------------------------------------------------
924 104 ▶sub _root ($;$) {
Subroutine _root: called CC=9 SCAR=23.7
925 104 my $self = shift;
926 104 ▶ return $self->{root} unless (@_);
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 72 32 104
927 32 my $root = shift;
928  
929 32 ▶ unless ($self->has_type($root) && $self->{root} eq $root) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->has_type($root) and $self->{"root"} eq $root) 32 0 32
Condition33%1/3
$self->has_type($root) and $self->{"root"} eq $root
!ll&&!rl&&r
3200
MC/DC0%0/2
$self->has_type($root) and $self->{"root"} eq $root
$self->has_type($root) $self->{"root"} eq $root
Truth table33%1/3
A and B
A= $self->has_type($root)B= $self->{"root"} eq $root
ABresult
0X0
100
111
930 32 $self->compiled(0);
931  
932 32 my $i = $self->{indices}{$root};
933  
934 32 ▶ unless (defined($i)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $i) 32 0 32
935 32 $i = $self->_next_index();
936 32 $self->{indices}{$root} = $i; # ... add index
937 32 $self->{types}[$i] = $root; # ... add element
938 }
939  
940 # ... add parents
941 32 $self->{parents}[$i] = '';
942  
943 # adopt parentless types
944 32 my $c = '';
945 32 my $j;
946 32 ▶ for ($j = 0; $j <= $#{$self->{parents}}; ++$j) {
Branch: 1 branch
BranchTrueFalseTotal
if ($j <= $#{$$self{"parents"};}) 32 32 64
947 32 ▶ next if ($i == $j);
Branch: 1 branch
BranchTrueFalseTotal
if $i == $j 32 0 32
948 0 ▶ $c = $c ? ",$j" : $j unless ($self->{parents}[$j]);
Branch: 2 branches
BranchTrueFalseTotal
unless $self->{"parents"}[$j] 0 0 0
$c ? : 0 0 0
949 }
950 # ... add children
951 32 $self->{children}[$i] = $c;
952 }
953 32 return $self->{root} = $root;
954 }
955 7 *root = \&_root;
956  
957  
958 #--------------------------------------------------------------
959 0 ▶sub _set_root ($$) { return $_[0]->{root} = $_[1]; }
Subroutine _set_root: not called CC=1 SCAR=6.9
960  
961 #--------------------------------------------------------------
962 0 ▶sub _parents ($) { return $_[0]->{parents}; }
Subroutine _parents: not called CC=1 SCAR=6.9
963  
964 #--------------------------------------------------------------
965 0 ▶sub _children ($) { return $_[0]->{children}; }
Subroutine _children: not called CC=1 SCAR=6.9
966  
967  
968  
969 #--------------------------------------------------------------
970 0 ▶sub _ancestors ($) { return $_[0]->{ancestors}; }
Subroutine _ancestors: not called CC=1 SCAR=6.9
971  
972 #--------------------------------------------------------------
973 1 ▶sub _descendants ($) { return $_[0]->{descendants}; }
Subroutine _descendants: called CC=1 SCAR=0.0
974  
975 #--------------------------------------------------------------
976 # $bool = _compiled(), _compiled($bool)
977 10 ▶sub _compiled ($;$) {
Subroutine _compiled: called CC=2 SCAR=7.6
978 10 ▶ return exists($_[1]) ? $_[0]->{compiled} = $_[1] : $_[0]->{compiled};
Branch: 1 branch
BranchTrueFalseTotal
exists $_[1] ? : 10 0 10
979 }
980  
981 #--------------------------------------------------------------
982 # \@attrs = $h->_attributes
983 # \%type_attrs_or_undef = $h->_attributes($type)
984 # \%attrs = $h->_attributes($type,\%attrs)
985 178 ▶sub _attributes ($;$$) {
Subroutine _attributes: called CC=5 SCAR=19.4
986 178 ▶ return $_[0]->{attributes} if (scalar(@_) == 1);
Branch: 1 branch
BranchTrueFalseTotal
if scalar @_ == 1 0 178 178
987 178 my ($i);
988 178 ▶ return undef unless (defined($_[1]) && defined($i = $_[0]->{indices}{$_[1]}));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_[1] and defined($i = $_[0]{"indices"}{$_[1]}) 0 178 178
Condition33%1/3
defined $_[1] and defined($i = $_[0]{"indices"}{$_[1]})
!ll&&!rl&&r
00178
MC/DC0%0/2
defined $_[1] and defined($i = $_[0]{"indices"}{$_[1]})
defined $_[1] defined($i = $_[0]{"indices"}{$_[1]})
Truth table33%1/3
A and B
A= defined $_[1]B= defined($i = $_[0]{"indices"}{$_[1]})
ABresult
0X0
100
111
989 178 ▶ return $_[0]->{attributes}[$i] if (scalar(@_) == 2);
Branch: 1 branch
BranchTrueFalseTotal
if scalar @_ == 2 178 0 178
990 0 return $_[0]->{attributes}[$i] = $_[2];
991 }
992  
993  
994 #--------------------------------------------------------------
995 # $hashref = $h->_hattributes(), $h->_hattributes($hashref);
996 50 ▶sub _hattributes ($;$) {
Subroutine _hattributes: called CC=2 SCAR=6.9
997 50 ▶ return $_[0]->{hattributes} if (!exists($_[1]));
Branch: 1 branch
BranchTrueFalseTotal
unless exists $_[1] 48 2 50
998 2 return $_[0]->{hattributes} = $_[1];
999 }
1000  
1001 #--------------------------------------------------------------
1002 # $aryref = $h->_removed
1003 0 ▶sub _removed ($) { return $_[0]->{removed}; }
Subroutine _removed: not called CC=1 SCAR=6.9
1004  
1005 #--------------------------------------------------------------
1006 # $aryref = $h->_vectors()
1007 # @vecs = $h->_vectors(@indices)
1008 1 ▶sub _vectors($;@) {
Subroutine _vectors: called CC=2 SCAR=9.2
1009 return
1010 exists($_[1])
1011 0 ? @{$_[0]->{vectors}}[@_[1..$#_]]
1012 1 ▶ : $_[0]->{vectors};
Branch: 1 branch
BranchTrueFalseTotal
exists $_[1] ? : 0 1 1
1013 }
1014  
1015  
1016 #--------------------------------------------------------------
1017 # $free_idx = $h->_next_index
1018 184 ▶sub _next_index ($) {
Subroutine _next_index: called CC=2 SCAR=7.6
1019 return
1020 184 scalar(@{$_[0]->{removed}})
1021 0 ? shift(@{$_[0]->{removed}})
1022 184 ▶ : scalar(@{$_[0]->{types}});
Branch: 1 branch
BranchTrueFalseTotal
scalar @{$_[0]{'removed'};} ? : 0 184 184
1023 }
1024  
1025 #--------------------------------------------------------------
1026 # $size = $h->_size;
1027 18 ▶sub _size ($) { return scalar(@{$_[0]->{types}}); }
Subroutine _size: called CC=1 SCAR=0.0
1028  
1029 #--------------------------------------------------------------
1030 # $bv = $h->mask;
1031 0 ▶sub mask ($) {
Subroutine mask: not called CC=1 SCAR=6.9
Pod undocumented
1032 0 my $bv = Bit::Vector->new(scalar(@{$_[0]->{types}}));
1033 0 $bv->Fill;
1034 0 $bv->Index_List_Remove(@{$_[0]->{removed}});
1035 0 return $bv;
1036 }
1037  
1038  
1039  
1040 ###############################################################
1041 # Misc
1042 ###############################################################
1043  
1044 #--------------------------------------------------------------
1045 0 ▶sub dump ($;$$) {
Subroutine dump: not called CC=35 SCAR=71.4
Pod documented
1046 0 my $h = shift;
1047 0 ▶ my $name = shift || "$h";
Condition0%0/3
shift() || "$h"
l!l&&r!l&&!r
000
MC/DC0%0/2
shift() || "$h"
shift() "$h"
Truth table0%0/3
A || B
A= shift()B= "$h"
ABresult
1X1
011
000
1048 0 my $what = shift;
1049 0 my $dump = "\$$name = [\n";
1050 0 my ($i);
1051 0 ▶ if (!defined($what) || $what =~ /\btypes\b/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $what or $what =~ /\btypes\b/) 0 0 0
Condition0%0/3
not defined $what or $what =~ /\btypes\b/
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $what or $what =~ /\btypes\b/
not defined $what $what =~ /\btypes\b/
Truth table0%0/3
not(A) or B
A= not defined $whatB= $what =~ /\btypes\b/
ABresult
1X1
011
000
1052 0 $dump .= " TYPES: [";
1053 0 ▶ for ($i = 0; $i <= $#{$h->{types}}; ++$i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#{$$h{"types"};}) 0 0 0
1054 $dump .=
1055 "\n $i: " .
1056 0 ▶ (defined($h->{types}->[$i]) ? "'" . $h->{types}->[$i] . "'" : 'undef');
Branch: 1 branch
BranchTrueFalseTotal
defined $h->{'types'}[$i] ? : 0 0 0
1057 }
1058 0 $dump .= "\n ],\n";
1059 }
1060 0 ▶ if (!defined($what) || $what =~ /\bindices\b/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $what or $what =~ /\bindices\b/) 0 0 0
Condition0%0/3
not defined $what or $what =~ /\bindices\b/
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $what or $what =~ /\bindices\b/
not defined $what $what =~ /\bindices\b/
Truth table0%0/3
not(A) or B
A= not defined $whatB= $what =~ /\bindices\b/
ABresult
1X1
011
000
1061 0 $dump .= " INDICES: {";
1062 0 foreach $i (keys(%{$h->{indices}})) {
1063 0 $dump .= "\n '$i' => '" . $h->{indices}->{$i} . "'";
1064 }
1065 0 $dump .= "\n },\n";
1066 }
1067 0 ▶ if (!defined($what) || $what =~ /\broot\b/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $what or $what =~ /\broot\b/) 0 0 0
Condition0%0/3
not defined $what or $what =~ /\broot\b/
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $what or $what =~ /\broot\b/
not defined $what $what =~ /\broot\b/
Truth table0%0/3
not(A) or B
A= not defined $whatB= $what =~ /\broot\b/
ABresult
1X1
011
000
1068 0 $dump .= " ROOT: '" . $h->{root} . "',\n";
1069 }
1070 0 ▶ if (!defined($what) || $what =~ /\bparents\b/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $what or $what =~ /\bparents\b/) 0 0 0
Condition0%0/3
not defined $what or $what =~ /\bparents\b/
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $what or $what =~ /\bparents\b/
not defined $what $what =~ /\bparents\b/
Truth table0%0/3
not(A) or B
A= not defined $whatB= $what =~ /\bparents\b/
ABresult
1X1
011
000
1071 0 $dump .= " PARENTS: [";
1072 0 ▶ for ($i = 0; $i <= $#{$h->{parents}}; ++$i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#{$$h{"parents"};}) 0 0 0
1073 0 ▶ $dump .= "\n $i: (" . (defined($h->{parents}->[$i]) ? $h->{parents}->[$i] : 'undef') . ")";
Branch: 1 branch
BranchTrueFalseTotal
defined $h->{'parents'}[$i] ? : 0 0 0
1074 }
1075 0 $dump .= "\n ],\n";
1076 }
1077 0 ▶ if (!defined($what) || $what =~ /\bchildren\b/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $what or $what =~ /\bchildren\b/) 0 0 0
Condition0%0/3
not defined $what or $what =~ /\bchildren\b/
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $what or $what =~ /\bchildren\b/
not defined $what $what =~ /\bchildren\b/
Truth table0%0/3
not(A) or B
A= not defined $whatB= $what =~ /\bchildren\b/
ABresult
1X1
011
000
1078 0 $dump .= " CHILDREN: [";
1079 0 ▶ for ($i = 0; $i <= $#{$h->{children}}; ++$i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#{$$h{"children"};}) 0 0 0
1080 0 ▶ $dump .= "\n $i: (" . (defined($h->{children}->[$i]) ? $h->{children}->[$i] : 'undef') . ")";
Branch: 1 branch
BranchTrueFalseTotal
defined $h->{'children'}[$i] ? : 0 0 0
1081 }
1082 0 $dump .= "\n ],\n";
1083 }
1084 0 ▶ if (!defined($what) || $what =~ /\bremoved\b/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $what or $what =~ /\bremoved\b/) 0 0 0
Condition0%0/3
not defined $what or $what =~ /\bremoved\b/
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $what or $what =~ /\bremoved\b/
not defined $what $what =~ /\bremoved\b/
Truth table0%0/3
not(A) or B
A= not defined $whatB= $what =~ /\bremoved\b/
ABresult
1X1
011
000
1085 0 $dump .= " REMOVED: [" . join(',', @{$h->{removed}}) . "],\n";
1086 }
1087 0 ▶ if (!defined($what) || $what =~ /\bancestors\b/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $what or $what =~ /\bancestors\b/) 0 0 0
Condition0%0/3
not defined $what or $what =~ /\bancestors\b/
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $what or $what =~ /\bancestors\b/
not defined $what $what =~ /\bancestors\b/
Truth table0%0/3
not(A) or B
A= not defined $whatB= $what =~ /\bancestors\b/
ABresult
1X1
011
000
1088 0 $dump .= " ANCESTORS: [";
1089 0 ▶ for ($i = 0; $i <= $#{$h->{ancestors}}; ++$i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#{$$h{"ancestors"};}) 0 0 0
1090 $dump .= "\n $i: (" .
1091 (defined($h->{ancestors}->[$i])
1092 0 ▶ ? $h->{ancestors}->[$i]->to_Enum
Branch: 1 branch
BranchTrueFalseTotal
defined $h->{'ancestors'}[$i] ? : 0 0 0
1093 : 'undef') . ")";
1094 }
1095 0 $dump .= "\n ],\n";
1096 }
1097 0 ▶ if (!defined($what) || $what =~ /\bdescendants\b/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $what or $what =~ /\bdescendants\b/) 0 0 0
Condition0%0/3
not defined $what or $what =~ /\bdescendants\b/
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $what or $what =~ /\bdescendants\b/
not defined $what $what =~ /\bdescendants\b/
Truth table0%0/3
not(A) or B
A= not defined $whatB= $what =~ /\bdescendants\b/
ABresult
1X1
011
000
1098 0 $dump .= " DESCENDANTS: [";
1099 0 ▶ for ($i = 0; $i <= $#{$h->{descendants}}; ++$i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#{$$h{"descendants"};}) 0 0 0
1100 $dump .= "\n $i: (" .
1101 (defined($h->{descendants}->[$i])
1102 0 ▶ ? $h->{descendants}->[$i]->to_Enum
Branch: 1 branch
BranchTrueFalseTotal
defined $h->{'descendants'}[$i] ? : 0 0 0
1103 : 'undef') . ")";
1104  
1105 }
1106 0 $dump .= "\n ],\n";
1107 }
1108 0 ▶ if (!defined($what) || $what =~ /\bhattr/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $what or $what =~ /\bhattr/) 0 0 0
Condition0%0/3
not defined $what or $what =~ /\bhattr/
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $what or $what =~ /\bhattr/
not defined $what $what =~ /\bhattr/
Truth table0%0/3
not(A) or B
A= not defined $whatB= $what =~ /\bhattr/
ABresult
1X1
011
000
1109 0 $dump .= " HATTRS: {";
1110 0 foreach $i (keys(%{$h->{hattributes}})) {
1111 0 $dump .= "\n '$i' => '" . $h->{hattributes}->{$i} . "'";
1112 }
1113 0 $dump .= "\n },\n";
1114 }
1115 0 ▶ if (!defined($what) || $what =~ /\bcompiled\b/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $what or $what =~ /\bcompiled\b/) 0 0 0
Condition0%0/3
not defined $what or $what =~ /\bcompiled\b/
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $what or $what =~ /\bcompiled\b/
not defined $what $what =~ /\bcompiled\b/
Truth table0%0/3
not(A) or B
A= not defined $whatB= $what =~ /\bcompiled\b/
ABresult
1X1
011
000
1116 0 ▶ $dump .= " COMPILED: " . ($h->compiled ? '1' : '0') . "\n";
Branch: 1 branch
BranchTrueFalseTotal
$h->compiled ? : 0 0 0
1117 }
1118 0 return $dump . "];\n";
1119 }
1120  
1121  
1122  
1123 ###############################################################
1124 # Storage/retrieval
1125 ###############################################################
1126  
1127 #--------------------------------------------------------------
1128 # $hashref = $h->_get_bin_compat() : for binary compatibility
1129 2 ▶sub _get_bin_compat { return \%BIN_COMPAT; }
Subroutine _get_bin_compat: called CC=1 SCAR=0.0
1130  
1131  
1132 #--------------------------------------------------------------
1133 # $h->_store_before($retr)
1134 1 ▶sub _store_before {
Subroutine _store_before: called CC=4 SCAR=14.0
1135 1 my ($h,$retr) = @_;
1136 1 $retr->{RemovedIndices} = $h->{removed};
1137 1 $retr->{ParentsEnums} = $h->{parents};
1138 1 $retr->{ChildrenEnums} = $h->{children};
1139 1 $retr->{CompiledFlag} = $h->{compiled};
1140 1 ▶ if ($h->{compiled}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($h->{"compiled"}) 1 0 1
1141 $retr->{AncestorsEnums} =
1142 1 ▶ [ map { defined($_) ? $_->to_Enum : undef } @{$h->{ancestors}} ];
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 8 0 8
1143 $retr->{DescendantsEnums} =
1144 1 ▶ [ map { defined($_) ? $_->to_Enum : undef } @{$h->{descendants}} ];
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 8 0 8
1145 }
1146 1 return $retr;
1147 }
1148  
1149 #--------------------------------------------------------------
1150 # $h->_store_type($tr,$retr) : add index to type-record
1151 16 ▶sub _store_type {
Subroutine _store_type: called CC=1 SCAR=0.0
1152 16 $_[1]->[$_tr_index] = $_[0]->{indices}{$_[1]->[0]};
1153 }
1154  
1155  
1156 #--------------------------------------------------------------
1157 # $h->_retrieve_type($tr,$retr)
1158 16 ▶sub _retrieve_type {
Subroutine _retrieve_type: called CC=2 SCAR=7.0
1159 16 my ($h,$tr,$retr) = @_;
1160 16 my $type = $retr->{Refs}{$tr->[$_tr_name]};
1161 16 $h->{types}[$tr->[$_tr_index]] = $type;
1162 16 $h->{indices}{$type} = $tr->[$_tr_index];
1163 16 ▶ $h->_attributes($type, $retr->{Refs}{$tr->[$_tr_attrs]})
Branch: 1 branch
BranchTrueFalseTotal
if defined $tr->[$_tr_attrs] 0 16 16
1164 if (defined($tr->[$_tr_attrs]));
1165 }
1166  
1167 #--------------------------------------------------------------
1168 # $h->_retrieve_after($retr)
1169 1 ▶sub _retrieve_after {
Subroutine _retrieve_after: called CC=4 SCAR=13.9
1170 1 my ($h,$retr) = @_;
1171 1 @{$h->{removed}} = @{$retr->{RemovedIndices}};
1172 1 @{$h->{parents}} = @{$retr->{ParentsEnums}};
1173 1 @{$h->{children}} = @{$retr->{ChildrenEnums}};
1174 1 $h->{compiled} = $retr->{CompiledFlag};
1175  
1176 1 ▶ if ($h->{compiled}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($h->{"compiled"}) 1 0 1
1177 1 $h->_ensure_vector_sizes();
1178 1 my $size = $h->{vectors}[0]->Size;
1179  
1180 1 @{$h->{ancestors}} =
1181 map {
1182 8 ▶ defined($_) ? Bit::Vector->new_Enum($size,$_) : undef
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 8 0 8
1183 1 } @{$retr->{AncestorsEnums}};
1184  
1185 1 @{$h->{descendants}} =
1186 map {
1187 8 ▶ defined($_) ? Bit::Vector->new_Enum($size,$_) : undef
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 8 0 8
1188 1 } @{$retr->{DescendantsEnums}};
1189  
1190 }
1191 1 return $h;
1192 }
1193  
1194 ###############################################################
1195 # Mask Utility Methods
1196 ###############################################################
1197  
1198 # $bv = $h->_types2mask(@types)
1199 0 ▶sub _types2mask ($@) {
Subroutine _types2mask: not called CC=1 SCAR=6.9
1200 0 my $self = shift;
1201 0 my $bv = Bit::Vector->new($self->_size+1);
1202 0 $bv->Index_List_Store(@{$self->{indices}}{@_});
1203 0 return $bv;
1204 }
1205  
1206 0 ▶sub types2mask ($@) {
Subroutine types2mask: not called CC=1 SCAR=6.9
Pod documented
1207 0 my $self = shift;
1208 0 my $bv = Bit::Vector->new($self->_size+1);
1209 0 $bv->Index_List_Store(grep { defined($_) } @{$self->{indices}}{@_});
1210 0 return $bv;
1211 }
1212  
1213 #--------------------------------------------------------------
1214 # _mask2types($bv) -- @types list for bit-vector mask
1215 #--------------------------------------------------------------
1216 0 ▶sub _mask2types ($$) {
Subroutine _mask2types: not called CC=1 SCAR=6.9
1217 0 return @{$_[0]->{types}}[$_[1]->Index_List_Read];
1218 # $_[0]->types_at($_[1]->Index_List_Read);
1219 }
1220  
1221 2 ▶sub mask2types ($$) {
Subroutine mask2types: called CC=1 SCAR=0.0
Pod undocumented
1222 2 return grep { defined($_) } @{$_[0]->{types}}[$_[1]->Index_List_Read];
1223 #grep { defined($_) } $_[0]->_types_at($_[1]->Index_List_Read);
1224 }
1225  
1226  
1227 ###############################################################
1228 # Enum Utility Methods
1229 ###############################################################
1230  
1231 # $enum = $h->_types2enum(@types)
1232 152 ▶sub _types2enum ($@) {
Subroutine _types2enum: called CC=2 SCAR=7.2
1233 return
1234 scalar(@_) > 1
1235 152 ▶ ? join(',',@{$_[0]->{indices}}{@_[1..$#_]})
Branch: 1 branch
BranchTrueFalseTotal
scalar @_ > 1 ? : 152 0 152
1236 #join(',', $_[0]->_indices_of(@_[1..$#_]))
1237 : '';
1238 }
1239  
1240 # $enum = $h->types2enum(@types)
1241 0 ▶sub types2enum ($@) {
Subroutine types2enum: not called CC=2 SCAR=17.9
Pod documented
1242 return
1243 scalar(@_) > 1
1244 0 ▶ ? join(',', grep { defined($_) } @{$_[0]->{indices}}{@_[1..$#_]})
Branch: 1 branch
BranchTrueFalseTotal
scalar @_ > 1 ? : 0 0 0
1245 #join(',', grep { defined($_) } $_[0]->_indices_of(@_[1..$#_]))
1246 : '';
1247 }
1248  
1249 # @types = $h->_enum2types($enum,$bv)
1250 864 ▶sub _enum2types ($$$) {
Subroutine _enum2types: called CC=1 SCAR=0.0
1251 864 $_[2]->from_Enum($_[1]);
1252 864 return @{$_[0]->{types}}[$_[2]->Index_List_Read];
1253 #$_[0]->_mask2types($_[2]);
1254 }
1255  
1256 # @types = $h->enum2types($enum,$bv)
1257 0 ▶sub enum2types ($$$) {
Subroutine enum2types: not called CC=1 SCAR=6.9
Pod documented
1258 0 $_[2]->from_Enum($_[1]);
1259 0 return grep { defined($_) } @{$_[0]->{types}}[$_[2]->Index_List_Read];
1260 #$_[0]->mask2types($_[2]);
1261 }
1262  
1263  
1264  
1265 # $enum = $h->_parents_enum($type)
1266 0 ▶sub _parents_enum ($$) {
Subroutine _parents_enum: not called CC=1 SCAR=6.9
1267 0 return $_[0]->{parents}[$_[0]->{indices}{$_[1]}];
1268 }
1269 # $enum = $_[0]->_children_enum($type)
1270 0 ▶sub _children_enum ($$) {
Subroutine _children_enum: not called CC=1 SCAR=6.9
1271 0 return $_[0]->{children}[$_[0]->{indices}{$_[1]}];
1272 }
1273  
1274  
1275 # $bv = $h->_parents_mask($type)
1276 0 ▶sub _parents_mask ($$) {
Subroutine _parents_mask: not called CC=1 SCAR=6.9
1277 0 $_[0]->{vectors}[0]->from_Enum($_[0]->{parents}[$_[0]->{indices}{$_[1]}]);
1278 0 return $_[0]->{vectors}[0];
1279 }
1280 # $bv = $h->_children_mask($type)
1281 0 ▶sub _children_mask ($$) {
Subroutine _children_mask: not called CC=1 SCAR=6.9
1282 0 $_[0]->{vectors}[0]->from_Enum($_[0]->{children}[$_[0]->{indices}{$_[1]}]);
1283 0 return $_[0]->{vectors}[0];
1284 }
1285  
1286  
1287 # @indices = $h->_parents_indices($type);
1288 32 ▶sub _parents_indices ($$) {
Subroutine _parents_indices: called CC=1 SCAR=0.0
1289 32 $_[0]->{vectors}[0]->from_Enum($_[0]->{parents}[$_[0]->{indices}{$_[1]}]);
1290 32 return $_[0]->{vectors}[0]->Index_List_Read;
1291 #return $_[0]->_parents_mask($_[1])->Index_List_Read;
1292 }
1293 # @indices = $h->_children_indices($type);
1294 0 ▶sub _children_indices ($$) {
Subroutine _children_indices: not called CC=1 SCAR=6.9
1295 0 $_[0]->{vectors}[0]->from_Enum($_[0]->{children}[$_[0]->{indices}{$_[1]}]);
1296 0 return $_[0]->{vectors}[0]->Index_List_Read;
1297 }
1298  
1299  
1300  
1301 ###############################################################
1302 # Non-method Utilities: Bit-vectors
1303 ###############################################################
1304  
1305 # _bv_ensure_size($bv,$size)
1306 16 ▶sub _bv_ensure_size ($$) {
Subroutine _bv_ensure_size: called CC=2 SCAR=7.6
1307 16 ▶ return ($_[0]->Size < $_[1]) ? $_[0]->Resize($_[1]) : undef;
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->Size < $_[1] ? : 0 16 16
1308 }
1309  
1310 # $size = _bv_make_comparable($bv1,$bv2)
1311 8 ▶sub _bv_make_comparable ($$) {
Subroutine _bv_make_comparable: called CC=1 SCAR=0.0
1312 8 _bv_ensure_size($_[0],$_[1]->Size);
1313 8 _bv_ensure_size($_[1],$_[0]->Size);
1314 8 return $_[0]->Size;
1315 }
1316  
1317 # $bool = _bv_bit_test($bv,$idx)
1318 0 ▶sub _bv_bit_test ($$) { return $_[0]->Size > $_[1] && $_[0]->bit_test($_[1]); }
Subroutine _bv_bit_test: not called CC=2 SCAR=17.9
Condition0%0/3
$_[0]->Size > $_[1] && $_[0]->bit_test($_[1])
!ll&&!rl&&r
000
MC/DC0%0/2
$_[0]->Size > $_[1] && $_[0]->bit_test($_[1])
$_[0]->Size > $_[1] $_[0]->bit_test($_[1])
Truth table0%0/3
A && B
A= $_[0]->Size > $_[1]B= $_[0]->bit_test($_[1])
ABresult
0X0
100
111
1319  
1320 # _bv_bit_on($bv,$idx)
1321 38 ▶sub _bv_bit_on ($$) {
Subroutine _bv_bit_on: called CC=2 SCAR=7.2
1322 38 ▶ $_[0]->Resize($_[1]+1) if ($_[0]->Size <= $_[1]);
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]->Size <= $_[1] 0 38 38
1323 38 $_[0]->Bit_On($_[1]);
1324 }
1325  
1326 # _bv_bit_off($bv,$idx)
1327 38 ▶sub _bv_bit_off ($$) {
Subroutine _bv_bit_off: called CC=2 SCAR=7.6
1328 38 ▶ $_[0]->Bit_Off($_[1]) if ($_[0]->Size > $_[1]);
Branch: 1 branch
BranchTrueFalseTotal
if $_[0]->Size > $_[1] 38 0 38
1329 }
1330  
1331 # _bv_union_d($bv1,$bv2);
1332 8 ▶sub _bv_union_d ($$) {
Subroutine _bv_union_d: called CC=1 SCAR=0.0
1333 8 _bv_make_comparable($_[0],$_[1]);
1334 8 $_[0]->Union(@_[0,1]);
1335 }
1336  
1337 # _bv_intersection_d($bv1,$bv2)
1338 0 ▶sub _bv_intersection_d ($$) {
Subroutine _bv_intersection_d: not called CC=1 SCAR=6.9
1339 0 _bv_make_comparable($_[0],$_[1]);
1340 0 $_[0]->Intersection(@_[0,1]);
1341 }
1342  
1343 # _bv_difference_d($bv1,$bv2)
1344 0 ▶sub _bv_difference_d ($$) {
Subroutine _bv_difference_d: not called CC=1 SCAR=6.9
1345 0 _bv_make_comparable($_[0],$_[1]);
1346 0 $_[0]->Difference($_[0],$_[1]);
1347 }
1348  
1349  
1350 ###############################################################
1351 # Non-method Utilities: Enums
1352 ###############################################################
1353  
1354 # @indices = _enum2indices($enum,$bv)
1355 4 ▶sub _enum2indices ($$) {
Subroutine _enum2indices: called CC=2 SCAR=7.2
1356 4 ▶ $_[1]->from_Enum(defined($_[0]) ? $_[0] : '');
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0] ? : 4 0 4
1357 4 return $_[1]->Index_List_Read;
1358 }
1359  
1360 # $bool = _enum_bit_test($enum,$bit,$bv)
1361 408 ▶sub _enum_bit_test ($$$) {
Subroutine _enum_bit_test: called CC=2 SCAR=7.2
1362 408 ▶ $_[2]->from_Enum(defined($_[0]) ? $_[0] : '');
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0] ? : 408 0 408
1363 408 return $_[2]->bit_test($_[1]);
1364 }
1365  
1366 # $enum2 = _enum_bit_on($enum1,$bit,$bv)
1367 38 ▶sub _enum_bit_on ($$$) {
Subroutine _enum_bit_on: called CC=2 SCAR=7.1
1368 38 ▶ $_[2]->from_Enum(defined($_[0]) ? $_[0] : '');
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0] ? : 38 0 38
1369 38 _bv_bit_on($_[2],$_[1]);
1370 38 return $_[2]->to_Enum;
1371 }
1372  
1373 # $enum2 = _enum_bit_off($enum1,$bit,$bv)
1374 38 ▶sub _enum_bit_off ($$$) {
Subroutine _enum_bit_off: called CC=2 SCAR=7.1
1375 38 ▶ $_[2]->from_Enum(defined($_[0]) ? $_[0] : '');
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0] ? : 38 0 38
1376 38 _bv_bit_off($_[2],$_[1]);
1377 38 return $_[2]->to_Enum;
1378 }
1379  
1380 # $enum3 = _enum_union($enum1,$enum2,$bv1,$bv2);
1381 8 ▶sub _enum_union ($$$$) {
Subroutine _enum_union: called CC=3 SCAR=11.4
1382 8 ▶ $_[2]->from_Enum(defined($_[0]) ? $_[0] : '');
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0] ? : 8 0 8
1383 8 ▶ $_[3]->from_Enum(defined($_[1]) ? $_[1] : '');
Branch: 1 branch
BranchTrueFalseTotal
defined $_[1] ? : 8 0 8
1384 8 _bv_union_d($_[2],$_[3]);
1385 8 return $_[2]->to_Enum;
1386 }
1387  
1388 # $enum3 = _enum_intersection($enum1,$enum2,$bv1,$bv2);
1389 0 ▶sub _enum_intersection ($$$$) {
Subroutine _enum_intersection: not called CC=3 SCAR=24.8
1390 0 ▶ $_[2]->from_Enum(defined($_[0]) ? $_[0] : '');
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0] ? : 0 0 0
1391 0 ▶ $_[3]->from_Enum(defined($_[1]) ? $_[1] : '');
Branch: 1 branch
BranchTrueFalseTotal
defined $_[1] ? : 0 0 0
1392 0 _bv_intersection_d($_[2],$_[3]);
1393 0 return $_[2]->to_Enum;
1394 }
1395  
1396 # $enum3 =_enum_difference($enum1,$enum2,$bv1,$bv2);
1397 0 ▶sub _enum_difference ($$$$) {
Subroutine _enum_difference: not called CC=3 SCAR=24.8
1398 0 ▶ $_[2]->from_Enum(defined($_[0]) ? $_[0] : '');
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0] ? : 0 0 0
1399 0 ▶ $_[3]->from_Enum(defined($_[1]) ? $_[1] : '');
Branch: 1 branch
BranchTrueFalseTotal
defined $_[1] ? : 0 0 0
1400 0 _bv_difference_d($_[2],$_[3]);
1401 0 return $_[2]->to_Enum;
1402 }
1403  
1404  
1405  
1406  
1407 7 1;
1408 __END__
« PartialOrder/CEnum.pm ↑ Summary PartialOrder/Loader.pm »