| 1 | package Data::Range::Compare::Stream::Iterator::Compare::LayerCake; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use base qw(Data::Range::Compare::Stream::Iterator::Compare::Asc); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 18 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 10 | 18 | my ($class,%args)=@_; | |||||||||||||||||||||||||||
| 11 | 18 | %args=(ignore_empty=>0,,%args); | |||||||||||||||||||||||||||
| 12 | 18 | my $self=$class->SUPER::new(%args); | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 18 | return $self; | |||||||||||||||||||||||||||
| 15 | } | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 94 | ▶ | sub get_next { | ||||||||||||||||||||||||||
|
Subroutine
get_next: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||
| 18 | 94 | my ($self)=@_; | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 94 | ▶ | if(defined($self->{filter})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 21 | 2 | my $result=$self->{next_result}; | |||||||||||||||||||||||||||
| 22 | 2 | delete $self->{next_result}; | |||||||||||||||||||||||||||
| 23 | 2 | return $result; | |||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 92 | ▶ | if($self->{ignore_full}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 27 | 4 | my $result=$self->{next_result}; | |||||||||||||||||||||||||||
| 28 | 4 | delete $self->{next_result}; | |||||||||||||||||||||||||||
| 29 | 4 | return $result; | |||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 88 | ▶ | return $self->SUPER::get_next unless $self->{ignore_empty} or $self->{empty_only}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"ignore_empty"} or $self->{"empty_only"}
MC/DC50%1/2
$self->{"ignore_empty"} or $self->{"empty_only"}
$self->{"ignore_empty"}
$self->{"empty_only"}
Truth table66%2/3
A or B
A= $self->{"ignore_empty"}B= $self->{"empty_only"}
| |||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 12 | my $result=$self->SUPER::get_next; | |||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 12 | ▶ | while($result->is_empty and $self->has_next) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$result->is_empty and $self->has_next
MC/DC50%1/2
$result->is_empty and $self->has_next
$result->is_empty
$self->has_next
Truth table66%2/3
A and B
A= $result->is_emptyB= $self->has_next
| |||||||||||||||||||||||||||||
| 39 | 2 | $result=$self->SUPER::get_next; | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 12 | return $result; | |||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 44 | ▶ | sub prepare { | ||||||||||||||||||||||||||
|
Subroutine
prepare: called CC=5 SCAR=16.5
Pod
undocumented
| |||||||||||||||||||||||||||||
| 47 | 44 | my ($self)=@_; | |||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 44 | ▶ | return if $self->prepared; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 17 | $self->SUPER::prepare; | |||||||||||||||||||||||||||
| 52 | 17 | ▶ | if(defined($self->{filter})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 53 | 1 | my $filter=$self->{filter}; | |||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 1 | ▶ | while($self->SUPER::has_next) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 57 | 1 | my $result=$self->SUPER::get_next; | |||||||||||||||||||||||||||
| 58 | 1 | ▶ | if($filter->($result)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 59 | 1 | $self->{next_result}=$result; | |||||||||||||||||||||||||||
| 60 | 1 | return 1; | |||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | 0 | delete $self->{next_result}; | |||||||||||||||||||||||||||
| 64 | 0 | return 0; | |||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | 43 | ▶ | sub has_next { | ||||||||||||||||||||||||||
|
Subroutine
has_next: called CC=11 SCAR=24.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 71 | 43 | my ($self)=@_; | |||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | 43 | $self->prepare; | |||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | 43 | ▶ | if(defined($self->{filter})) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 76 | 3 | my $filter=$self->{filter}; | |||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | 3 | ▶ | return 1 if defined($self->{next_result}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 2 | ▶ | while($self->SUPER::has_next) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 82 | 4 | my $result=$self->SUPER::get_next; | |||||||||||||||||||||||||||
| 83 | 4 | ▶ | if($filter->($result)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 84 | 1 | $self->{next_result}=$result; | |||||||||||||||||||||||||||
| 85 | 1 | return 1; | |||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||
| 88 | 1 | delete $self->{next_result}; | |||||||||||||||||||||||||||
| 89 | 1 | return 0; | |||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | } elsif($self->{ignore_full}) { | ||||||||||||||||||||||||||||
| 92 | 6 | ▶ | return 1 if defined($self->{next_result}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | 6 | ▶ | return 0 unless $self->SUPER::has_next; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | 5 | my $result=$self->SUPER::get_next; | |||||||||||||||||||||||||||
| 97 | 5 | ▶ | while($result->is_full) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | 4 | ▶ | return 0 unless $self->SUPER::has_next; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 100 | 3 | $result=$self->SUPER::get_next; | |||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | 4 | $self->{next_result}=$result; | |||||||||||||||||||||||||||
| 105 | 4 | ▶ | return defined($result) ? 1 : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | } else { | ||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | # back off and use the parrent class internals | ||||||||||||||||||||||||||||
| 110 | 34 | return $self->SUPER::has_next; | |||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | 1 | 1; | |||||||||||||||||||||||||||