line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Range::Compare::Stream::Iterator::Consolidate::FillMissing; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
3482
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
64
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
63
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
10
|
use base qw(Data::Range::Compare::Stream::Iterator::Base); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
175
|
|
7
|
2
|
|
|
2
|
|
11
|
use Data::Range::Compare::Stream::Iterator::Consolidate::Result; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
65
|
|
8
|
2
|
|
|
2
|
|
17
|
use Carp qw(croak); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
176
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
11
|
use constant NEW_RESULT_FROM=>'Data::Range::Compare::Stream::Iterator::Consolidate::Result'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
847
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
5
|
|
|
5
|
0
|
44
|
my ($class,$con,%args)=@_; |
14
|
5
|
50
|
|
|
|
35
|
croak 'Consolidator object must be defined' unless defined($con); |
15
|
|
|
|
|
|
|
|
16
|
5
|
|
|
|
|
33
|
$class->SUPER::new(con=>$con,%args); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub has_next { |
20
|
51
|
|
|
51
|
0
|
11495
|
my ($self)=@_; |
21
|
51
|
100
|
|
|
|
287
|
return 1 if $self->{con}->has_next; |
22
|
25
|
100
|
|
|
|
100
|
return 1 if defined($self->{missing_result}); |
23
|
18
|
100
|
|
|
|
77
|
return 1 if defined($self->{last_result_obj}); |
24
|
11
|
|
|
|
|
48
|
return 0; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub get_next { |
28
|
24
|
|
|
24
|
1
|
45
|
my ($self)=@_; |
29
|
24
|
|
|
|
|
42
|
my $it=$self->{con}; |
30
|
|
|
|
|
|
|
|
31
|
24
|
|
|
|
|
32
|
my $last_result; |
32
|
24
|
100
|
|
|
|
91
|
if(defined($self->{missing_result})) { |
|
|
100
|
|
|
|
|
|
33
|
8
|
|
|
|
|
18
|
my $result=$self->{missing_result}; |
34
|
8
|
|
|
|
|
19
|
$self->{missing_result}=undef; |
35
|
8
|
|
|
|
|
34
|
return $result; |
36
|
|
|
|
|
|
|
} elsif(defined($self->{last_result_obj})) { |
37
|
11
|
|
|
|
|
22
|
$last_result=$self->{last_result_obj}; |
38
|
11
|
|
|
|
|
20
|
$self->{last_result_obj}=undef; |
39
|
|
|
|
|
|
|
} else { |
40
|
5
|
50
|
|
|
|
19
|
if($it->has_next) { |
41
|
5
|
|
|
|
|
22
|
$last_result=$it->get_next; |
42
|
|
|
|
|
|
|
} else { |
43
|
0
|
|
|
|
|
0
|
croak 'iterator called when has_next is false!'; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
16
|
100
|
|
|
|
59
|
if($it->has_next) { |
48
|
11
|
|
|
|
|
41
|
my $result=$it->get_next; |
49
|
11
|
100
|
|
|
|
48
|
if($last_result->get_common->contiguous_check($result->get_common)) { |
50
|
3
|
|
|
|
|
8
|
$self->{last_result_obj}=$result; |
51
|
3
|
|
|
|
|
13
|
return $last_result; |
52
|
|
|
|
|
|
|
} else { |
53
|
8
|
|
|
|
|
19
|
$self->{last_result_obj}=$result; |
54
|
8
|
|
|
|
|
29
|
my $new_result=$self->create_from_factory($last_result->get_common->next_range_start,$result->get_common->previous_range_end); |
55
|
8
|
|
|
|
|
28
|
$new_result->get_common->on_create_range($last_result->get_common); |
56
|
8
|
|
|
|
|
48
|
$self->{missing_result}=$self->NEW_RESULT_FROM->new($new_result,$new_result,$new_result,1,1); |
57
|
|
|
|
|
|
|
|
58
|
8
|
|
|
|
|
35
|
return $last_result; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
} else { |
61
|
5
|
|
|
|
|
20
|
return $last_result; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |