line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Heap::Simple::Array; |
2
|
|
|
|
|
|
|
$VERSION = "0.03"; |
3
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
42
|
|
4
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
440
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub _elements { |
7
|
393
|
|
|
393
|
|
976
|
my ($class, $heap, $name, $elements) = @_; |
8
|
393
|
100
|
|
|
|
1105
|
if (defined($elements->[1])) { |
9
|
103
|
50
|
|
|
|
700
|
$elements->[1] =~ /^\s*(-?\d+)\s*$/ || Carp::croak "index '$elements->[1]' for $elements->[0] elements is not an integer"; |
10
|
103
|
|
|
|
|
574
|
$heap->[0]{index} = $1+0; |
11
|
|
|
|
|
|
|
} else { |
12
|
290
|
|
|
|
|
1045
|
$heap->[0]{index} = 0; |
13
|
|
|
|
|
|
|
} |
14
|
393
|
|
|
|
|
2230
|
return $name, $heap->[0]{index}; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub _KEY { |
18
|
698
|
|
|
698
|
|
19824
|
return $_[1] . "->[$_[0][0]{index}]" |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub _QUICK_KEY { |
22
|
122
|
|
|
122
|
|
6635
|
return $_[1] . "->[$_[0][0]{index}]" |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub key_index { |
26
|
5
|
|
|
5
|
0
|
3311
|
my $heap = shift; |
27
|
5
|
|
|
|
|
43
|
$heap->_make("sub key_index() { |
28
|
|
|
|
|
|
|
return $heap->[0]{index}; |
29
|
|
|
|
|
|
|
}"); |
30
|
5
|
|
|
|
|
157
|
return $heap->key_index(@_); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub elements { |
34
|
131
|
100
|
|
131
|
0
|
13607
|
return wantarray ? (Array => shift->[0]{index}) : "Array"; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |