line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Range::Compare::Stream::Iterator::Validate; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
1636
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
90
|
|
4
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
64
|
|
5
|
2
|
|
|
2
|
|
10
|
use Carp qw(croak); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
115
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
9
|
use base qw(Data::Range::Compare::Stream::Iterator::Base); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
879
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
3
|
|
|
3
|
0
|
1448
|
my ($class,$it,%args)=@_; |
11
|
|
|
|
|
|
|
|
12
|
3
|
100
|
|
|
|
179
|
croak 'Iterator is a required argument' unless defined($it); |
13
|
2
|
|
|
|
|
20
|
my $self=$class->SUPER::new(iterator=>$it,%args); |
14
|
|
|
|
|
|
|
|
15
|
2
|
|
|
|
|
7
|
$self; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub prepare { |
19
|
8
|
|
|
8
|
0
|
10
|
my ($self)=@_; |
20
|
8
|
50
|
|
|
|
24
|
return 1 if defined($self->{next_valid_range}); |
21
|
|
|
|
|
|
|
|
22
|
8
|
|
|
|
|
12
|
my $it=$self->{iterator}; |
23
|
8
|
|
|
|
|
34
|
while($it->has_next) { |
24
|
10
|
|
|
|
|
51
|
my $next=$it->get_next; |
25
|
10
|
100
|
|
|
|
43
|
if($next->get_common->boolean) { |
26
|
6
|
|
|
|
|
11
|
$self->{next_valid_range}=$next; |
27
|
6
|
|
|
|
|
19
|
return 1; |
28
|
|
|
|
|
|
|
} |
29
|
4
|
|
|
|
|
10
|
$self->on_bad_range($next) |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
2
|
|
|
|
|
8
|
0; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub on_bad_range { |
36
|
4
|
|
|
4
|
1
|
6
|
my ($self,$range)=@_; |
37
|
4
|
50
|
|
|
|
17
|
$self->{on_bad_range}->($range) if defined($self->{on_bad_range}); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub has_next { |
41
|
8
|
|
|
8
|
0
|
2693
|
my ($self)=@_; |
42
|
8
|
|
|
|
|
27
|
$self->prepare; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub get_next { |
46
|
6
|
|
|
6
|
1
|
44
|
my ($self)=@_; |
47
|
6
|
|
|
|
|
14
|
my $range=$self->{next_valid_range}; |
48
|
6
|
|
|
|
|
9
|
$self->{next_valid_range}=undef; |
49
|
6
|
|
|
|
|
14
|
return $range; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |