line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::ListScraper::Occurence; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
22
|
use warnings; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
118
|
|
4
|
4
|
|
|
4
|
|
21
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
1490
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub new { |
7
|
77194
|
|
|
77194
|
0
|
120421
|
my ($class, $length, $pos) = @_; |
8
|
77194
|
|
|
|
|
248250
|
my $self = { length => $length, spread => 1, |
9
|
|
|
|
|
|
|
edge => $pos, positions => [ $pos ] }; |
10
|
77194
|
|
|
|
|
134245
|
bless $self, $class; |
11
|
|
|
|
|
|
|
|
12
|
77194
|
|
|
|
|
405372
|
return $self; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub spread { |
16
|
93201
|
|
|
93201
|
0
|
126863
|
my $self = shift; |
17
|
|
|
|
|
|
|
|
18
|
93201
|
|
|
|
|
242577
|
return $self->{spread}; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub len { |
22
|
1981
|
|
|
1981
|
0
|
2691
|
my $self = shift; |
23
|
|
|
|
|
|
|
|
24
|
1981
|
|
|
|
|
7032
|
return $self->{length}; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub first_pos { |
28
|
1971
|
|
|
1971
|
0
|
2847
|
my $self = shift; |
29
|
|
|
|
|
|
|
|
30
|
1971
|
|
|
|
|
4953
|
return $self->{positions}->[0]; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub log_score { |
34
|
2681
|
|
|
2681
|
0
|
3901
|
my $self = shift; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# return log($self->{spread}) * $self->{length}; |
37
|
2681
|
|
|
|
|
10241
|
return log($self->{spread}) * log($self->{length}); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub positions { |
41
|
73826
|
|
|
73826
|
0
|
94488
|
my $self = shift; |
42
|
|
|
|
|
|
|
|
43
|
73826
|
|
|
|
|
90317
|
return @{$self->{positions}}; |
|
73826
|
|
|
|
|
233435
|
|
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub append_pos { |
47
|
232304
|
|
|
232304
|
0
|
339723
|
my ($self, $pos) = @_; |
48
|
|
|
|
|
|
|
|
49
|
232304
|
|
|
|
|
290449
|
my $count = scalar(@{$self->{positions}}); |
|
232304
|
|
|
|
|
405474
|
|
50
|
232304
|
50
|
|
|
|
598667
|
if ($pos <= $self->{positions}->[$count - 1]) { |
51
|
0
|
|
|
|
|
0
|
die "position $pos out of order"; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
232304
|
|
|
|
|
280479
|
push @{$self->{positions}}, $pos; |
|
232304
|
|
|
|
|
487383
|
|
55
|
|
|
|
|
|
|
|
56
|
232304
|
100
|
|
|
|
619239
|
if ($self->{edge} + $self->{length} <= $pos) { |
57
|
151317
|
|
|
|
|
224467
|
++($self->{spread}); |
58
|
151317
|
|
|
|
|
226411
|
$self->{edge} = $pos; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
232304
|
|
|
|
|
633746
|
return $self->{spread}; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |