line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Range::Compare::Stream::Iterator::File::MergeSortAsc::Stack; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
1602
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
73
|
|
4
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
76
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
770
|
use IO::File; |
|
3
|
|
|
|
|
1055
|
|
|
3
|
|
|
|
|
577
|
|
7
|
3
|
|
|
3
|
|
15
|
use base qw(Data::Range::Compare::Stream::Iterator::File::Temp); |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
1937
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
14
|
|
|
14
|
0
|
451
|
my ($class,%args)=@_; |
11
|
14
|
|
|
|
|
64
|
my $self=bless {next_stack_count=>0,stack_count=>0,%args},$class; |
12
|
|
|
|
|
|
|
|
13
|
14
|
|
|
|
|
71
|
$self->{next_stack}=$self->get_temp; |
14
|
|
|
|
|
|
|
|
15
|
14
|
|
|
|
|
6008
|
return $self; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub push { |
19
|
103
|
|
|
103
|
1
|
4159
|
my ($self,$todo)=@_; |
20
|
103
|
|
|
|
|
407
|
$self->{next_stack}->print($todo,"\n"); |
21
|
103
|
|
|
|
|
946
|
$self->{next_stack_count}++; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub has_next { |
26
|
64
|
|
|
64
|
0
|
557
|
my ($self)=@_; |
27
|
64
|
100
|
|
|
|
316
|
if($self->{stack_count}>1) { |
28
|
35
|
|
|
|
|
175
|
return 2; |
29
|
|
|
|
|
|
|
} else { |
30
|
29
|
|
|
|
|
60
|
my $total=$self->{stack_count} + $self->{next_stack_count}; |
31
|
29
|
100
|
|
|
|
125
|
return 2 if $total>1; |
32
|
19
|
100
|
|
|
|
104
|
return 1 if $total==1; |
33
|
|
|
|
|
|
|
} |
34
|
2
|
|
|
|
|
7
|
return 0; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub roll_stack { |
38
|
24
|
|
|
24
|
0
|
33
|
my ($self)=@_; |
39
|
24
|
100
|
|
|
|
73
|
if(defined($self->{stack})) { |
40
|
10
|
|
|
|
|
47
|
$self->{stack}->close ; |
41
|
10
|
|
|
|
|
167
|
unlink $self->{stack}->filename; |
42
|
|
|
|
|
|
|
} |
43
|
24
|
|
|
|
|
897
|
$self->{stack_count}=$self->{next_stack_count}; |
44
|
24
|
|
|
|
|
41
|
$self->{next_stack_count}=0; |
45
|
24
|
|
|
|
|
45
|
$self->{stack}=$self->{next_stack}; |
46
|
24
|
|
|
|
|
603
|
$self->{stack}->flush; |
47
|
24
|
|
|
|
|
764
|
seek($self->{stack},0,0); |
48
|
24
|
|
|
|
|
99
|
$self->{next_stack}=$self->get_temp; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub get_next { |
52
|
103
|
|
|
103
|
1
|
189
|
my ($self)=@_; |
53
|
103
|
100
|
|
|
|
319
|
$self->roll_stack unless defined($self->{stack}); |
54
|
103
|
100
|
|
|
|
4974
|
$self->roll_stack if $self->{stack_count}==0; |
55
|
|
|
|
|
|
|
|
56
|
103
|
|
|
|
|
7111
|
my $next=$self->{stack}->getline; |
57
|
103
|
|
|
|
|
3211
|
--$self->{stack_count}; |
58
|
103
|
|
|
|
|
189
|
chomp($next); |
59
|
|
|
|
|
|
|
|
60
|
103
|
|
|
|
|
378
|
return $next; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub DESTROY { |
64
|
14
|
|
|
14
|
|
389
|
my ($self)=@_; |
65
|
14
|
50
|
|
|
|
40
|
return unless defined($self); |
66
|
14
|
50
|
|
|
|
50
|
if(defined($self->{stack})) { |
67
|
14
|
|
|
|
|
48
|
my $name=$self->{stack}->filename; |
68
|
14
|
|
|
|
|
116
|
$self->{stack}->close; |
69
|
14
|
|
|
|
|
1393
|
unlink $name; |
70
|
|
|
|
|
|
|
} |
71
|
14
|
50
|
|
|
|
67
|
if(defined($self->{next_stack})) { |
72
|
14
|
|
|
|
|
54
|
my $name=$self->{next_stack}->filename; |
73
|
14
|
|
|
|
|
121
|
$self->{next_stack}->close; |
74
|
14
|
|
|
|
|
944
|
unlink $name; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |