line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Range::Compare::Stream::Iterator::Array; |
2
|
|
|
|
|
|
|
|
3
|
12
|
|
|
12
|
|
29341
|
use strict; |
|
12
|
|
|
|
|
22
|
|
|
12
|
|
|
|
|
310
|
|
4
|
12
|
|
|
12
|
|
60
|
use warnings; |
|
12
|
|
|
|
|
59
|
|
|
12
|
|
|
|
|
336
|
|
5
|
12
|
|
|
12
|
|
56
|
use Carp qw(croak); |
|
12
|
|
|
|
|
20
|
|
|
12
|
|
|
|
|
687
|
|
6
|
12
|
|
|
12
|
|
60
|
use base qw(Data::Range::Compare::Stream::Iterator::Base); |
|
12
|
|
|
|
|
26
|
|
|
12
|
|
|
|
|
5449
|
|
7
|
12
|
|
|
12
|
|
5223
|
use Data::Range::Compare::Stream::Sort; |
|
12
|
|
|
|
|
26
|
|
|
12
|
|
|
|
|
9727
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
246
|
|
|
246
|
0
|
30717
|
my ($class,%args)=@_; |
11
|
|
|
|
|
|
|
|
12
|
246
|
|
|
|
|
1329
|
my $self=$class->SUPER::new(qw( |
13
|
|
|
|
|
|
|
sorted 0 |
14
|
|
|
|
|
|
|
new_from Data::Range::Compare::Stream |
15
|
|
|
|
|
|
|
), |
16
|
|
|
|
|
|
|
range_list=>[],%args |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
246
|
|
|
|
|
958
|
return $self; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
113
|
|
|
113
|
1
|
256
|
sub set_sorted { $_[0]->{sorted}=$_[1] } |
23
|
|
|
|
|
|
|
|
24
|
20472
|
|
|
20472
|
0
|
46562
|
sub sorted { $_[0]->{sorted} } |
25
|
|
|
|
|
|
|
|
26
|
10814
|
|
|
10814
|
0
|
26703
|
sub prepared { $_[0]->{prepared} } |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub prepare { |
29
|
241
|
|
|
241
|
1
|
358
|
my ($self)=@_; |
30
|
241
|
50
|
|
|
|
516
|
return 1 if $self->prepared; |
31
|
|
|
|
|
|
|
|
32
|
241
|
|
|
|
|
466
|
$self->{prepared}=1; |
33
|
241
|
100
|
|
|
|
563
|
return 1 if $self->sorted; |
34
|
3
|
100
|
|
|
|
11
|
return 1 unless $self->{autosort}; |
35
|
2
|
50
|
|
|
|
15
|
return unless $self->can($self->{autosort}); |
36
|
2
|
|
|
|
|
5
|
my $func=$self->{autosort}; |
37
|
2
|
|
|
|
|
5
|
$self->$func(); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub has_next { |
41
|
10573
|
|
|
10573
|
0
|
16017
|
my ($self)=@_; |
42
|
10573
|
100
|
|
|
|
19876
|
$self->prepare unless $self->prepared; |
43
|
10573
|
100
|
|
|
|
21222
|
return undef unless $self->sorted; |
44
|
10572
|
|
|
|
|
12376
|
return $#{$self->{range_list}}!=-1 |
|
10572
|
|
|
|
|
46382
|
|
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub add_range { |
48
|
407
|
|
|
407
|
1
|
655
|
my ($self,$range)=@_; |
49
|
407
|
50
|
|
|
|
785
|
croak "Object: [$self] has all ready been sorted" if $self->sorted; |
50
|
407
|
|
|
|
|
585
|
push @{$self->{range_list}},$range; |
|
407
|
|
|
|
|
1848
|
|
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub insert_range { |
54
|
101
|
|
|
101
|
1
|
160
|
my ($self,$range)=@_; |
55
|
101
|
|
|
|
|
133
|
push @{$self->{range_list}},$range; |
|
101
|
|
|
|
|
395
|
|
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub create_range { |
59
|
393
|
|
|
393
|
1
|
2371
|
my ($self,@args)=@_; |
60
|
393
|
50
|
|
|
|
842
|
croak "Object: [$self] has all ready been sorted" if $self->sorted; |
61
|
393
|
|
|
|
|
1322
|
$self->add_range($self->create_from_factory(@args)); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub get_next { |
65
|
8747
|
|
|
8747
|
1
|
13362
|
my ($self)=@_; |
66
|
8747
|
50
|
|
|
|
15962
|
croak "Object: [$self] has not been sorted" unless $self->sorted; |
67
|
8747
|
|
|
|
|
9934
|
shift @{$self->{range_list}} |
|
8747
|
|
|
|
|
39556
|
|
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub prepare_for_consolidate_asc { |
71
|
107
|
|
|
107
|
1
|
490
|
my ($self)=@_; |
72
|
107
|
50
|
|
|
|
241
|
return 0 if $self->sorted; |
73
|
107
|
|
|
|
|
262
|
$self->set_sorted(1); |
74
|
107
|
|
|
|
|
148
|
@{$self->{range_list}}=sort sort_in_consolidate_order_asc @{$self->{range_list}}; |
|
107
|
|
|
|
|
340
|
|
|
107
|
|
|
|
|
556
|
|
75
|
107
|
|
|
|
|
265
|
1; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub prepare_for_consolidate_desc { |
79
|
2
|
|
|
2
|
1
|
3
|
my ($self)=@_; |
80
|
2
|
50
|
|
|
|
5
|
return 0 if $self->sorted; |
81
|
2
|
|
|
|
|
5
|
$self->set_sorted(1); |
82
|
2
|
|
|
|
|
3
|
@{$self->{range_list}}=sort sort_in_consolidate_order_desc @{$self->{range_list}}; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
11
|
|
83
|
2
|
|
|
|
|
5
|
1; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
1; |