Stream/Iterator/Compare/Result.pm

filter: Statementstmt 90.9% 90 / 99 Branchbran 100% 12 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 89.6% 26 / 29 Podpod 100% 17 / 17 totaltotal 92.3% 145 / 157 CC 7 SCAR 5.7
CC
7
Cov
92%
get_root_result_ids
4.0
get_root_results
4.0
get_column_map
2.0
CRAP 1.8
« Stream/Iterator/Compare/Base.pm ↑ Summary Stream/Iterator/Stack.pm »
1 package Data::Range::Compare::Stream::Iterator::Compare::Result;
2  
3 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 use overload
6 6 ▶ '""'=>\&to_string,
Subroutine BEGIN: called CC=1 SCAR=0.0
7 6 fallback=>1;
8  
9  
10 6 ▶use constant COMMON_RANGE=>0;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 6 ▶use constant OVERLAP_RESULTS=>1;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 6 ▶use constant OVERLAP_COUNT=>2;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 6 ▶use constant OVERLAP_IDS=>3;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 6 ▶use constant NON_OVERLAP_IDS=>4;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 6 ▶use constant COLUMN_MAP=>5;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 6 ▶use constant ROOT_IDS=>6;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 6 ▶use constant PRINT_FORMAT=>'Common Range: [%s] Column id(s) that Overlap: [%s]';
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 6 ▶use base qw(Data::Range::Compare::Stream::Result::Base);
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 285 ▶sub get_common_range {
Subroutine get_common_range: called CC=1 SCAR=0.0
Pod documented
23 285 my ($self)=@_;
24 285 $self->[$self->COMMON_RANGE]
25 }
26  
27 6 *get_common=\&get_common_range;
28  
29 34 ▶sub get_root_ids { [@{$_[0]->[$_[0]->ROOT_IDS]}] }
Subroutine get_root_ids: called CC=1 SCAR=0.0
Pod documented
30  
31 0 ▶sub get_column_map { [@{$_[0]->[$_[0]->COLUMN_MAP]}] }
Subroutine get_column_map: not called CC=1 SCAR=6.9
Pod documented
32  
33 88 ▶sub get_overlap_count {
Subroutine get_overlap_count: called CC=1 SCAR=0.0
Pod documented
34 88 my ($self)=@_;
35 88 $self->[$self->OVERLAP_COUNT]
36 }
37  
38 108 ▶sub get_column_count {
Subroutine get_column_count: called CC=1 SCAR=0.0
Pod documented
39 108 my ($self)=@_;
40 108 $#{$self->[$self->OVERLAP_RESULTS]} + 1;
41 }
42  
43 30 ▶sub get_overlap_ids {
Subroutine get_overlap_ids: called CC=1 SCAR=0.0
Pod documented
44 30 my ($self)=@_;
45 30 [@{$self->[$self->OVERLAP_IDS]}]
46 }
47  
48 3 ▶sub get_non_overlap_ids {
Subroutine get_non_overlap_ids: called CC=1 SCAR=0.0
Pod documented
49 3 my ($self)=@_;
50 3 [@{$self->[$self->NON_OVERLAP_IDS]}]
51 }
52 3 ▶sub get_non_overlap_count {
Subroutine get_non_overlap_count: called CC=1 SCAR=0.0
Pod documented
53 3 $_[0]->get_column_count - $_[0]->get_overlap_count
54 }
55  
56 75 ▶sub get_consolidator_result_by_id {
Subroutine get_consolidator_result_by_id: called CC=1 SCAR=0.0
Pod documented
57 75 my ($self,$id)=@_;
58 75 $self->[$self->OVERLAP_RESULTS]->[$id]
59 }
60  
61 6 *get_result_by_id=\&get_consolidator_result_by_id;
62 6 *get_column_by_id=\&get_consolidator_result_by_id;
63  
64  
65 45 ▶sub is_empty { $_[0]->get_overlap_count==0 }
Subroutine is_empty: called CC=1 SCAR=0.0
Pod documented
66 6 *none_overlap=\&is_empty;
67  
68 22 ▶sub is_full { $_[0]->get_overlap_count==$_[0]->get_column_count }
Subroutine is_full: called CC=1 SCAR=0.0
Pod documented
69 6 *all_overlap=\&is_full;
70  
71  
72 2 ▶sub get_overlapping_containers {
Subroutine get_overlapping_containers: called CC=1 SCAR=0.0
Pod documented
73 2 my ($self)=@_;
74 2 [@{$self->[$self->OVERLAP_RESULTS]}[@{$self->get_overlap_ids}]]
75 }
76  
77  
78 4 ▶sub get_all_containers {
Subroutine get_all_containers: called CC=1 SCAR=0.0
Pod documented
79 4 my ($self)=@_;
80 4 [@{$self->[$self->OVERLAP_RESULTS]}]
81 }
82  
83 0 ▶sub get_non_overlapping_containers {
Subroutine get_non_overlapping_containers: not called CC=1 SCAR=6.9
Pod documented
84 0 my ($self)=@_;
85 0 [@{$self->[$self->OVERLAP_RESULTS]}[@{$self->get_non_overlap_ids}]]
86 }
87  
88 0 ▶sub to_string {
Subroutine to_string: not called CC=1 SCAR=6.9
Pod documented
89 0 my ($self)=@_;
90 0 return sprintf $self->PRINT_FORMAT,$self->get_common,join(',',@{$self->get_overlap_ids});
91 }
92  
93 10 ▶sub get_root_result_ids {
Subroutine get_root_result_ids: called CC=4 SCAR=13.9
Pod documented
94 10 my ($self)=@_;
95  
96 10 my $result=[];
97  
98 10 my $map=$self->[$self->COLUMN_MAP];
99  
100 10 ▶ for(my $id=0;$id<$self->get_column_count;++$id ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($id < $self->get_column_count) 28 10 38
101 28 my $target=$map->[$id];
102 28 ▶ $result->[$target]=[] unless defined($result->[$target]);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $result->[$target] 10 18 28
103  
104 28 my $ref=$result->[$target];
105 28 my $obj=$self->get_result_by_id($id);
106  
107 28 ▶ push @$ref,$id if defined($obj);
Branch: 1 branch
BranchTrueFalseTotal
if defined $obj 17 11 28
108 }
109  
110 10 return $result;
111 }
112  
113 10 ▶sub get_root_results {
Subroutine get_root_results: called CC=4 SCAR=13.9
Pod documented
114 10 my ($self)=@_;
115  
116 10 my $result=[];
117  
118 10 my $map=$self->[$self->COLUMN_MAP];
119  
120 10 ▶ for(my $id=0;$id<$self->get_column_count;++$id ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($id < $self->get_column_count) 28 10 38
121 28 my $target=$map->[$id];
122 28 ▶ $result->[$target]=[] unless defined($result->[$target]);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $result->[$target] 10 18 28
123  
124 28 my $ref=$result->[$target];
125 28 my $obj=$self->get_result_by_id($id);
126 28 ▶ next unless defined($obj);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $obj 11 17 28
127  
128 17 push @$ref,$obj;
129 }
130  
131 10 return $result;
132 }
133  
134  
135  
136 6 1;
« Stream/Iterator/Compare/Base.pm ↑ Summary Stream/Iterator/Stack.pm »