line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Range::Compare::Stream::Iterator::Consolidate::AdjacentAsc; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
3185
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
84
|
|
4
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
80
|
|
5
|
3
|
|
|
3
|
|
14
|
use base qw(Data::Range::Compare::Stream::Iterator::Consolidate); |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
1877
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub has_next { |
9
|
28
|
|
|
28
|
0
|
1093
|
my ($self)=@_; |
10
|
28
|
100
|
|
|
|
99
|
return 1 if $self->SUPER::has_next; |
11
|
9
|
100
|
|
|
|
29
|
return 1 if defined($self->{last_result}); |
12
|
7
|
|
|
|
|
26
|
return 0; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub get_next { |
16
|
8
|
|
|
8
|
1
|
1018
|
my ($self)=@_; |
17
|
8
|
100
|
|
|
|
23
|
return undef unless $self->has_next; |
18
|
|
|
|
|
|
|
|
19
|
7
|
|
|
|
|
12
|
my $result; |
20
|
7
|
100
|
|
|
|
39
|
if(defined($self->{last_result})) { |
|
|
50
|
|
|
|
|
|
21
|
3
|
|
|
|
|
7
|
$result=$self->{last_result}; |
22
|
|
|
|
|
|
|
} elsif($self->SUPER::has_next) { |
23
|
4
|
|
|
|
|
31
|
$result=$self->SUPER::get_next; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
7
|
|
|
|
|
23
|
while($self->has_next) { |
27
|
12
|
|
|
|
|
17
|
my $last_result; |
28
|
12
|
100
|
|
|
|
37
|
if($self->SUPER::has_next) { |
29
|
11
|
|
|
|
|
81
|
$last_result=$self->SUPER::get_next; |
30
|
|
|
|
|
|
|
} else { |
31
|
1
|
|
|
|
|
2
|
$self->{last_result}=undef; |
32
|
1
|
|
|
|
|
4
|
return $result; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# get our common result range |
37
|
11
|
|
|
|
|
45
|
my $common=$result->get_common; |
38
|
11
|
|
|
|
|
40
|
my $next=$last_result->get_common; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# stop here if the contiguous check turns up nothing |
41
|
|
|
|
|
|
|
|
42
|
11
|
100
|
|
|
|
39
|
unless($common->contiguous_check($next)) { |
43
|
3
|
|
|
|
|
6
|
$self->{last_result}=$last_result; |
44
|
3
|
|
|
|
|
10
|
return $result |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# if we got here then we need to get the starting range |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# compute the overlap |
50
|
8
|
|
|
|
|
35
|
my $overlap=$common->get_overlapping_range([$common,$next]); |
51
|
8
|
|
|
|
|
43
|
$self->on_consolidate($overlap,$common,$next); |
52
|
|
|
|
|
|
|
|
53
|
8
|
|
|
|
|
29
|
my ($start,$end)=$common->find_smallest_outer_ranges([$result->get_start->get_common,$result->get_end->get_common,$last_result->get_start->get_common,$last_result->get_end->get_common]); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# get our new result |
56
|
8
|
|
|
|
|
54
|
$result=$self->RESULT_CLASS->new($overlap,$start->get_common,$end->get_common,0,1); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# update the internals |
59
|
8
|
|
|
|
|
46
|
$self->{last_result}=undef; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
3
|
|
|
|
|
8
|
$self->{last_result}=undef; |
65
|
3
|
|
|
|
|
11
|
return $result; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |