Compare/Base/_Engine.pm

filter: Statementstmt 100% 46 / 46 Branchbran 100% 10 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 100% 61 / 61 CC 11 SCAR 16.4
CC
11
Cov
100%
_unique_all_engine
7.0
_complement_all_engine
5.0
BEGIN
1.0
CRAP 5.1
« Compare/Base/_Auxiliary.pm ↑ Summary Compare/Functional.pm »
1 package List::Compare::Base::_Engine;
2 52 our $VERSION = 0.55;
3 # Holds subroutines used within
4 # List::Compare::Base::Accelerated and List::Compare::Functional
5 52 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 52 ▶use List::Compare::Base::_Auxiliary qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
7 _equiv_engine
8 _calculate_union_seen_only
9 _calculate_seen_only
10 52 );
11 52 our @ISA = qw(Exporter);
12 52 our @EXPORT_OK = qw|
13 _unique_all_engine
14 _complement_all_engine
15 |;
16 52 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 52 local $^W = 1;
18  
19 96 ▶sub _unique_all_engine {
Subroutine _unique_all_engine: called CC=7 SCAR=19.5
20 96 my $aref = shift;
21 96 my $seenref = _calculate_seen_only($aref);
22  
23 96 my @all_uniques = ();
24 96 for my $i (sort {$a <=> $b} keys %{$seenref}) {
25 456 my %seen_in_all_others = ();
26 456 for my $j (keys %{$seenref}) {
27 2232 ▶ unless ($i == $j) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($i == $j) 1776 456 2232
28 1776 for my $k (keys %{$seenref->{$j}}) {
29 9616 $seen_in_all_others{$k}++;
30 }
31 }
32  
33 }
34 456 my @these_uniques = ();
35 456 for my $l (keys %{$seenref->{$i}}) {
36 push @these_uniques, $l
37 2488 ▶ unless $seen_in_all_others{$l};
Branch: 1 branch
BranchTrueFalseTotal
unless $seen_in_all_others{$l} 192 2296 2488
38 }
39 456 $all_uniques[$i] = \@these_uniques;
40 }
41 96 return \@all_uniques;
42 }
43  
44 112 ▶sub _complement_all_engine {
Subroutine _complement_all_engine: called CC=5 SCAR=16.1
45 112 my ($aref, $unsortflag) = @_;
46 112 my ($unionref, $seenref) = _calculate_union_seen_only($aref);
47 112 ▶ my @union = $unsortflag ? keys %{$unionref} : sort(keys %{$unionref});
Branch: 1 branch
BranchTrueFalseTotal
$unsortflag ? : 48 64 112
48  
49 # Calculate @xcomplement
50 # Inputs: $aref @union %seen
51 112 my (@xcomplement);
52 112 ▶ for (my $i = 0; $i <= $#{$aref}; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#{$aref;}) 536 112 648
53 536 my @complementthis = ();
54 536 foreach my $el (@union) {
55 5328 ▶ push(@complementthis, $el) unless (exists $seenref->{$i}->{$el});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $seenref->{$i}{$el} 2408 2920 5328
56 }
57 536 $xcomplement[$i] = \@complementthis;
58 }
59 112 return \@xcomplement;
60 }
61  
62 52 1;
63  
64  
65 __END__
« Compare/Base/_Auxiliary.pm ↑ Summary Compare/Functional.pm »