| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package List::Compare::Base::_Engine; | 
| 2 |  |  |  |  |  |  | our $VERSION = 0.54; | 
| 3 |  |  |  |  |  |  | # Holds subroutines used within | 
| 4 |  |  |  |  |  |  | # List::Compare::Base::Accelerated and List::Compare::Functional | 
| 5 | 52 |  |  | 52 |  | 375 | use Carp; | 
|  | 52 |  |  |  |  | 116 |  | 
|  | 52 |  |  |  |  | 3252 |  | 
| 6 | 52 |  |  |  |  | 4809 | use List::Compare::Base::_Auxiliary qw( | 
| 7 |  |  |  |  |  |  | _equiv_engine | 
| 8 |  |  |  |  |  |  | _calculate_union_seen_only | 
| 9 |  |  |  |  |  |  | _calculate_seen_only | 
| 10 | 52 |  |  | 52 |  | 329 | ); | 
|  | 52 |  |  |  |  | 110 |  | 
| 11 |  |  |  |  |  |  | our @ISA = qw(Exporter); | 
| 12 |  |  |  |  |  |  | our @EXPORT_OK = qw| | 
| 13 |  |  |  |  |  |  | _unique_all_engine | 
| 14 |  |  |  |  |  |  | _complement_all_engine | 
| 15 |  |  |  |  |  |  | |; | 
| 16 | 52 |  |  | 52 |  | 392 | use strict; | 
|  | 52 |  |  |  |  | 124 |  | 
|  | 52 |  |  |  |  | 20233 |  | 
| 17 |  |  |  |  |  |  | local $^W = 1; | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | sub _unique_all_engine { | 
| 20 | 96 |  |  | 96 |  | 205 | my $aref = shift; | 
| 21 | 96 |  |  |  |  | 412 | my $seenref = _calculate_seen_only($aref); | 
| 22 |  |  |  |  |  |  |  | 
| 23 | 96 |  |  |  |  | 250 | my @all_uniques = (); | 
| 24 | 96 |  |  |  |  | 300 | for my $i (sort {$a <=> $b} keys %{$seenref}) { | 
|  | 650 |  |  |  |  | 1111 |  | 
|  | 96 |  |  |  |  | 461 |  | 
| 25 | 456 |  |  |  |  | 695 | my %seen_in_all_others = (); | 
| 26 | 456 |  |  |  |  | 613 | for my $j (keys %{$seenref}) { | 
|  | 456 |  |  |  |  | 1004 |  | 
| 27 | 2232 | 100 |  |  |  | 4243 | unless ($i == $j) { | 
| 28 | 1776 |  |  |  |  | 2345 | for my $k (keys %{$seenref->{$j}}) { | 
|  | 1776 |  |  |  |  | 3753 |  | 
| 29 | 9616 |  |  |  |  | 14451 | $seen_in_all_others{$k}++; | 
| 30 |  |  |  |  |  |  | } | 
| 31 |  |  |  |  |  |  | } | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | } | 
| 34 | 456 |  |  |  |  | 773 | my @these_uniques = (); | 
| 35 | 456 |  |  |  |  | 629 | for my $l (keys %{$seenref->{$i}}) { | 
|  | 456 |  |  |  |  | 1019 |  | 
| 36 |  |  |  |  |  |  | push @these_uniques, $l | 
| 37 | 2488 | 100 |  |  |  | 4523 | unless $seen_in_all_others{$l}; | 
| 38 |  |  |  |  |  |  | } | 
| 39 | 456 |  |  |  |  | 1304 | $all_uniques[$i]  = \@these_uniques; | 
| 40 |  |  |  |  |  |  | } | 
| 41 | 96 |  |  |  |  | 582 | return \@all_uniques; | 
| 42 |  |  |  |  |  |  | } | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | sub _complement_all_engine { | 
| 45 | 112 |  |  | 112 |  | 305 | my ($aref, $unsortflag) = @_; | 
| 46 | 112 |  |  |  |  | 330 | my ($unionref, $seenref) = _calculate_union_seen_only($aref); | 
| 47 | 112 | 100 |  |  |  | 340 | my @union = $unsortflag ? keys %{$unionref} : sort(keys %{$unionref}); | 
|  | 48 |  |  |  |  | 241 |  | 
|  | 64 |  |  |  |  | 572 |  | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | # Calculate @xcomplement | 
| 50 |  |  |  |  |  |  | # Inputs:  $aref @union %seen | 
| 51 | 112 |  |  |  |  | 256 | my (@xcomplement); | 
| 52 | 112 |  |  |  |  | 270 | for (my $i = 0; $i <= $#{$aref}; $i++) { | 
|  | 648 |  |  |  |  | 1392 |  | 
| 53 | 536 |  |  |  |  | 849 | my @complementthis = (); | 
| 54 | 536 |  |  |  |  | 829 | foreach my $el (@union) { | 
| 55 | 5328 | 100 |  |  |  | 10379 | push(@complementthis, $el) unless (exists $seenref->{$i}->{$el}); | 
| 56 |  |  |  |  |  |  | } | 
| 57 | 536 |  |  |  |  | 1161 | $xcomplement[$i] = \@complementthis; | 
| 58 |  |  |  |  |  |  | } | 
| 59 | 112 |  |  |  |  | 850 | return \@xcomplement; | 
| 60 |  |  |  |  |  |  | } | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  | 1; | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | __END__ |