| 1 | package Data::Range::Compare::Stream::Iterator::Compare::Asc; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 5 | ▶ | use base qw(Data::Range::Compare::Stream::Iterator::Compare::Base); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 5 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 187 | ▶ | sub has_next { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_next: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 187 | my ($self)=@_; | |||||||||||||||||||||||||||||||||||||||||
| 10 | 187 | ▶ | $self->prepare unless $self->prepared; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 187 | $self->{has_next}; | |||||||||||||||||||||||||||||||||||||||||
| 12 | } | ||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 40 | ▶ | sub prepare { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepare: called CC=11 SCAR=24.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 40 | my ($self,%args)=@_; | |||||||||||||||||||||||||||||||||||||||||
| 16 | 40 | ▶ | return undef if $self->prepared; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 40 | my $min_range_start; | |||||||||||||||||||||||||||||||||||||||||
| 19 | my $min_range_end; | ||||||||||||||||||||||||||||||||||||||||||
| 20 | 40 | my $iterators_has_next_count; | |||||||||||||||||||||||||||||||||||||||||
| 21 | 40 | my $min_range_start_column_id=0; | |||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | 40 | ▶ | for(my $id=0;$id<$self->get_column_count_human_readable;++$id) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | 97 | my $iterator=$self->{consolidateors}->[$id]; | |||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | 97 | ▶ | unless($iterator->has_next) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | $self->{has_next}=0; | |||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||
| 31 | 97 | my $raw_range=$iterator->get_next; | |||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | 97 | push @{$self->{raw_row}},$raw_range; | |||||||||||||||||||||||||||||||||||||||||
| 34 | 97 | push @{$self->{last_column_value}},$raw_range->get_common; | |||||||||||||||||||||||||||||||||||||||||
| 35 | 97 | ▶ | if(defined($min_range_start)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 57 | my $common_raw=$raw_range->get_common; | |||||||||||||||||||||||||||||||||||||||||
| 37 | 57 | my $common_start=$min_range_start->get_common; | |||||||||||||||||||||||||||||||||||||||||
| 38 | 57 | my $common_end=$min_range_end->get_common; | |||||||||||||||||||||||||||||||||||||||||
| 39 | 57 | ▶ | if($common_raw->cmp_range_start($common_start)==-1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | 10 | $min_range_start=$raw_range; | |||||||||||||||||||||||||||||||||||||||||
| 41 | 10 | $min_range_start_column_id=$id; | |||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||
| 43 | 57 | ▶ | if($common_raw->cmp_range_end($common_end)==-1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | 14 | $min_range_end=$raw_range; | |||||||||||||||||||||||||||||||||||||||||
| 45 | 14 | $min_range_start_column_id=$id; | |||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||
| 47 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 48 | 40 | $min_range_start=$raw_range; | |||||||||||||||||||||||||||||||||||||||||
| 49 | 40 | $min_range_end=$raw_range; | |||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||
| 51 | 97 | ▶ | ++$iterators_has_next_count if $iterator->has_next; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | 40 | $self->{iterators_empty}=!$iterators_has_next_count; | |||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | 40 | my $next_range=$self->create_from_factory($min_range_start->get_common->range_start,$min_range_end->get_common->range_end); | |||||||||||||||||||||||||||||||||||||||||
| 57 | 40 | $next_range->on_create_range($min_range_start->get_common->range_start); | |||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | 40 | ▶ | for(my $id=0;$id<$self->get_column_count_human_readable;++$id) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | # stop here if this is the column started on | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | 97 | my $cmp=$self->{raw_row}->[$id]->get_common; | |||||||||||||||||||||||||||||||||||||||||
| 63 | 97 | my $cmp_end=$cmp->previous_range_end; | |||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | 97 | ▶ | if($next_range->contains_value($cmp_end)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 66 | 7 | ▶ | if($next_range->cmp_values($next_range->range_end,$cmp_end)==1){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | 2 | my $old_next_range=$next_range; | |||||||||||||||||||||||||||||||||||||||||
| 68 | 2 | $next_range=$self->create_from_factory($next_range->range_start,$cmp_end); | |||||||||||||||||||||||||||||||||||||||||
| 69 | 2 | $next_range->on_create_range($old_next_range); | |||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | 40 | $self->{has_next}=1; | |||||||||||||||||||||||||||||||||||||||||
| 76 | 40 | $self->{current_row}=$next_range; | |||||||||||||||||||||||||||||||||||||||||
| 77 | 40 | $self->{processed_ranges}=1; | |||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | 40 | $self->{prepared}=1; | |||||||||||||||||||||||||||||||||||||||||
| 80 | 40 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | 12 | ▶ | sub iterator_in_use { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
iterator_in_use: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 84 | 12 | my ($self,$id)=@_; | |||||||||||||||||||||||||||||||||||||||||
| 85 | 12 | ▶ | croak "id lt 0" if $id<0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | 12 | ▶ | croak "id gt max" if $id>$self->get_column_count; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | 12 | my $raw=$self->{raw_row}->[$id]->get_common; | |||||||||||||||||||||||||||||||||||||||||
| 88 | 12 | my $current=$self->get_current_row; | |||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | 12 | ▶ | return 1 if $raw->overlap($current); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 91 | 9 | return $raw->cmp_range_end($current)!=-1; | |||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | sub iterator_is_dead { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
iterator_is_dead: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | my ($self,$id)=@_; | |||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | croak 'column id out of bounds' if !defined($id) or $id < 0 or $id > $#{$self->{raw_row}}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
not defined $id or $id < 0 or $id > $#{$$self{"raw_row"};}
not defined $id or $id < 0
MC/DC0%0/3
not defined $id or $id < 0 or $id > $#{$$self{"raw_row"};}
not defined $id
$id < 0
$id > $#{$$self{"raw_row"};}
Truth table0%0/4
not(A) or B or C
A= not defined $idB= $id < 0C= $id > $#{$$self{"raw_row"};}
| |||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | $self->{dead_columns}->[$id] | |||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | 12 | ▶ | sub delete_iterator { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete_iterator: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | 12 | my ($self,$id)=@_; | |||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | 12 | ▶ | croak 'cannot delete an iterator while its results are in use' if $self->iterator_in_use($id); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | # odds are these objects are in use, so we need to create new ones | ||||||||||||||||||||||||||||||||||||||||||
| 106 | 4 | $self->{column_map}=[]; | |||||||||||||||||||||||||||||||||||||||||
| 107 | 4 | $self->{root_ids}=[]; | |||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | 4 | my $con=$self->get_iterator_by_id($id); | |||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | 4 | splice(@{$self->{dead_columns}},$id,1); | |||||||||||||||||||||||||||||||||||||||||
| 112 | 4 | splice(@{$self->{raw_row}},$id,1); | |||||||||||||||||||||||||||||||||||||||||
| 113 | 4 | splice(@{$self->{consolidateors}},$id,1); | |||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | 4 | $con->delete_from_root; | |||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | sub get_raw_result { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_raw_result: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | my ($self,$id)=@_; | |||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | ▶ | croak 'column id out of bounds' if !defined($id) or $id < 0 or $id > $#{$self->{raw_row}}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
not defined $id or $id < 0 or $id > $#{$$self{"raw_row"};}
not defined $id or $id < 0
MC/DC0%0/3
not defined $id or $id < 0 or $id > $#{$$self{"raw_row"};}
not defined $id
$id < 0
$id > $#{$$self{"raw_row"};}
Truth table0%0/4
not(A) or B or C
A= not defined $idB= $id < 0C= $id > $#{$$self{"raw_row"};}
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | $self->{raw_row}->[$id] | |||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | ▶ | sub set_raw_result { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_raw_result: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | my ($self,$id,$raw_result)=@_; | |||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | croak 'column id out of bounds' if !defined($id) or $id < 0 or $id > $#{$self->{raw_row}}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
not defined $id or $id < 0 or $id > $#{$$self{"raw_row"};}
not defined $id or $id < 0
MC/DC0%0/3
not defined $id or $id < 0 or $id > $#{$$self{"raw_row"};}
not defined $id
$id < 0
$id > $#{$$self{"raw_row"};}
Truth table0%0/4
not(A) or B or C
A= not defined $idB= $id < 0C= $id > $#{$$self{"raw_row"};}
| |||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | ▶ | croak 'raw_result not defined' unless defined($raw_result); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | $self->{raw_row}->[$id]=$raw_result; | |||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | 296 | ▶ | sub get_next { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_next: called CC=28 SCAR=33.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | 296 | my ($self)=@_; | |||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | 296 | ▶ | $self->prepare unless $self->prepared; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 136 | # get the current row | ||||||||||||||||||||||||||||||||||||||||||
| 137 | 296 | my $current_row=$self->get_current_row; | |||||||||||||||||||||||||||||||||||||||||
| 138 | 296 | ▶ | croak "Fatal: get_next called befor has_next or after the iterator set is empty" unless defined($current_row); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||
| 140 | 296 | my $result=[]; | |||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||
| 142 | 296 | my $next_range_start=$current_row->next_range_start; | |||||||||||||||||||||||||||||||||||||||||
| 143 | 296 | my $iterators_has_next_count; | |||||||||||||||||||||||||||||||||||||||||
| 144 | my $max_range_end; | ||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | 296 | my $overlap_count=0; | |||||||||||||||||||||||||||||||||||||||||
| 147 | 296 | my $overlap_ids=[]; | |||||||||||||||||||||||||||||||||||||||||
| 148 | 296 | my $non_overlap_ids=[]; | |||||||||||||||||||||||||||||||||||||||||
| 149 | 296 | my $created_range=0; | |||||||||||||||||||||||||||||||||||||||||
| 150 | 296 | my $next_range; | |||||||||||||||||||||||||||||||||||||||||
| 151 | 296 | my $dead_columns=$self->{dead_columns}; | |||||||||||||||||||||||||||||||||||||||||
| 152 | 296 | my $column_map=$self->{column_map}; | |||||||||||||||||||||||||||||||||||||||||
| 153 | 296 | my $root_ids=$self->{root_ids}; | |||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | 296 | ▶ | GET_ROW_LOOP: for(my $id=0;$id<$self->get_column_count_human_readable;++$id) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | 879 | my $iterator=$self->{consolidateors}->[$id]; | |||||||||||||||||||||||||||||||||||||||||
| 158 | 879 | ▶ | if($#$column_map<$id) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 159 | 111 | $iterator->set_column_id($id); | |||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | 111 | ▶ | if($iterator->is_child) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 162 | 16 | my $walk=$iterator; | |||||||||||||||||||||||||||||||||||||||||
| 163 | 16 | ▶ | while($walk->is_child) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | 30 | $walk=$self->get_iterator_by_id($walk->get_root_column_id); | |||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||
| 166 | 16 | $column_map->[$id]=$walk->get_column_id; | |||||||||||||||||||||||||||||||||||||||||
| 167 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 168 | 95 | $column_map->[$id]=$id; | |||||||||||||||||||||||||||||||||||||||||
| 169 | 95 | push @$root_ids,$id; | |||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | 879 | ▶ | if($dead_columns->[$id] and !$iterator->has_next) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$dead_columns->[$id] and not $iterator->has_next
MC/DC50%1/2
$dead_columns->[$id] and not $iterator->has_next
$dead_columns->[$id]
not $iterator->has_next
Truth table66%2/3
A and not(B)
A= $dead_columns->[$id]B= not $iterator->has_next
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | 78 | push @$non_overlap_ids,$id; | |||||||||||||||||||||||||||||||||||||||||
| 175 | 78 | push @$result,undef; | |||||||||||||||||||||||||||||||||||||||||
| 176 | 78 | next GET_ROW_LOOP; | |||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | # Objects we will use throught the loop | ||||||||||||||||||||||||||||||||||||||||||
| 180 | 801 | my $raw_range=$self->{raw_row}->[$id]; | |||||||||||||||||||||||||||||||||||||||||
| 181 | 801 | my $cmp=$raw_range->get_common; | |||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | 801 | my $is_dead=0; | |||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | # current row computations | ||||||||||||||||||||||||||||||||||||||||||
| 187 | 801 | ▶ | if($current_row->overlap($cmp)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 188 | 402 | push @$result,$raw_range; | |||||||||||||||||||||||||||||||||||||||||
| 189 | 402 | ++$overlap_count; | |||||||||||||||||||||||||||||||||||||||||
| 190 | 402 | push @$overlap_ids,$id; | |||||||||||||||||||||||||||||||||||||||||
| 191 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 192 | 399 | push @$result,undef; | |||||||||||||||||||||||||||||||||||||||||
| 193 | 399 | ▶ | if($current_row->cmp_range_end($cmp)==1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | 46 | ++$is_dead | |||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||
| 196 | 399 | push @$non_overlap_ids,$id; | |||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | 801 | ▶ | if($cmp->cmp_ranges($current_row)==0 or $cmp->cmp_range_end($current_row)==0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$cmp->cmp_ranges($current_row) == 0 or $cmp->cmp_range_end($current_row) == 0
MC/DC100%2/2
$cmp->cmp_ranges($current_row) == 0 or $cmp->cmp_range_end($current_row) == 0
$cmp->cmp_ranges($current_row) == 0
$cmp->cmp_range_end($current_row) == 0
Truth table100%3/3
A or B
A= $cmp->cmp_ranges($current_row) == 0B= $cmp->cmp_range_end($current_row) == 0
| |||||||||||||||||||||||||||||||||||||||||||
| 200 | 251 | ▶ | if($iterator->has_next) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 201 | 146 | my $next_range=$iterator->get_next; | |||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | 146 | $raw_range=$next_range; | |||||||||||||||||||||||||||||||||||||||||
| 204 | 146 | $cmp=$raw_range->get_common; | |||||||||||||||||||||||||||||||||||||||||
| 205 | 146 | $self->{raw_row}->[$id]=$next_range; | |||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||
| 209 | 801 | ▶ | if($iterator->has_next) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 210 | 299 | ++$iterators_has_next_count; | |||||||||||||||||||||||||||||||||||||||||
| 211 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 212 | 502 | ++$is_dead; | |||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | 801 | ▶ | if(defined($next_range)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 216 | 451 | my $cmp_end=$cmp->previous_range_end; | |||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||
| 218 | 451 | ▶ | if($next_range->contains_value($cmp_end)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | 87 | ▶ | if($next_range->cmp_values($next_range->range_end,$cmp_end)!=-1){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | 87 | my $old_next_range=$next_range; | |||||||||||||||||||||||||||||||||||||||||
| 223 | 87 | $next_range=$self->create_from_factory($next_range->range_start,$cmp_end); | |||||||||||||||||||||||||||||||||||||||||
| 224 | 87 | $next_range->on_create_range($old_next_range); | |||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||
| 228 | ▶ | } elsif($next_range->cmp_range_end($cmp)==1 and $cmp->cmp_values($next_range_start,$cmp->range_end)!=1) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$next_range->cmp_range_end($cmp) == 1 and $cmp->cmp_values($next_range_start, $cmp->range_end) != 1
MC/DC100%2/2
$next_range->cmp_range_end($cmp) == 1 and $cmp->cmp_values($next_range_start, $cmp->range_end) != 1
$next_range->cmp_range_end($cmp) == 1
$cmp->cmp_values($next_range_start, $cmp->range_end) != 1
Truth table100%3/3
A and B
A= $next_range->cmp_range_end($cmp) == 1B= $cmp->cmp_values($next_range_start, $cmp->range_end) != 1
| |||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||
| 230 | 80 | my $old_next_range=$next_range; | |||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||
| 232 | 80 | $next_range=$self->create_from_factory($next_range->range_start,$cmp->range_end); | |||||||||||||||||||||||||||||||||||||||||
| 233 | 80 | $next_range->on_create_range($old_next_range); | |||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||
| 236 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||
| 238 | 350 | my $cmp_end=$cmp->previous_range_end; | |||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||
| 240 | 350 | ▶ | if($cmp->cmp_values($next_range_start,$cmp_end)!=1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | 101 | my $old_next_range=$next_range; | |||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | 101 | $next_range=$self->create_from_factory($next_range_start,$cmp_end); | |||||||||||||||||||||||||||||||||||||||||
| 245 | 101 | $next_range->on_create_range($old_next_range); | |||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||
| 247 | } elsif($cmp->cmp_values($next_range_start,$cmp->range_end)!=1) { | ||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | 155 | my $old_next_range=$next_range; | |||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||
| 251 | 155 | $next_range=$self->create_from_factory($next_range_start,$cmp->range_end); | |||||||||||||||||||||||||||||||||||||||||
| 252 | 155 | $next_range->on_create_range($old_next_range); | |||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||
| 258 | 801 | ▶ | if(defined($max_range_end)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 259 | 505 | ▶ | $max_range_end=$cmp if $max_range_end->cmp_range_end($cmp)==-1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 260 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 261 | 296 | $max_range_end=$cmp; | |||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||
| 263 | 801 | ▶ | if($is_dead==2) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 264 | 46 | $dead_columns->[$id]=$self->on_dead_iterator($id); | |||||||||||||||||||||||||||||||||||||||||
| 265 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 266 | 755 | $dead_columns->[$id]=0; | |||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||
| 270 | 296 | $self->{iterators_empty}=!$iterators_has_next_count; | |||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||
| 272 | 296 | ▶ | if($self->{last_row}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 273 | 40 | $self->{has_next}=0; | |||||||||||||||||||||||||||||||||||||||||
| 274 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||
| 276 | 256 | ▶ | unless(defined($next_range)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | $next_range=$self->create_from_factory($next_range_start,$next_range_start); | |||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | $next_range->on_create_range($current_row); | |||||||||||||||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||
| 281 | 256 | $self->{current_row}=$next_range; | |||||||||||||||||||||||||||||||||||||||||
| 282 | 256 | ▶ | $self->{last_row}=($self->{iterators_empty} and $next_range->cmp_range_end($max_range_end)!=-1); | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$self->{'iterators_empty'} && $next_range->cmp_range_end($max_range_end) != -1
MC/DC100%2/2
$self->{'iterators_empty'} && $next_range->cmp_range_end($max_range_end) != -1
$self->{'iterators_empty'}
$next_range->cmp_range_end($max_range_end) != -1
Truth table100%3/3
A && B
A= $self->{'iterators_empty'}B= $next_range->cmp_range_end($max_range_end) != -1
| |||||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||
| 285 | 296 | my $obj=$self->RESULT_CLASS->new( | |||||||||||||||||||||||||||||||||||||||||
| 286 | $current_row, | ||||||||||||||||||||||||||||||||||||||||||
| 287 | $result, | ||||||||||||||||||||||||||||||||||||||||||
| 288 | $overlap_count, | ||||||||||||||||||||||||||||||||||||||||||
| 289 | $overlap_ids, | ||||||||||||||||||||||||||||||||||||||||||
| 290 | $non_overlap_ids, | ||||||||||||||||||||||||||||||||||||||||||
| 291 | $column_map, | ||||||||||||||||||||||||||||||||||||||||||
| 292 | $root_ids, | ||||||||||||||||||||||||||||||||||||||||||
| 293 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 294 | 296 | return $obj; | |||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||
| 297 | 5 | 1; | |||||||||||||||||||||||||||||||||||||||||