line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Heap::Elem; |
2
|
|
|
|
|
|
|
|
3
|
10
|
|
|
10
|
|
37126
|
use strict; |
|
10
|
|
|
|
|
17
|
|
|
10
|
|
|
|
|
367
|
|
4
|
10
|
|
|
10
|
|
50
|
use vars qw($VERSION); |
|
10
|
|
|
|
|
61
|
|
|
10
|
|
|
|
|
2775
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
$VERSION = '0.80'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
108257
|
|
|
108257
|
1
|
201801
|
my $class = shift; |
10
|
108257
|
|
33
|
|
|
367010
|
$class = ref($class) || $class; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# value is undef, single scalar, or hash depending upon args |
13
|
108257
|
100
|
|
|
|
268126
|
my $val = (@_ > 1) ? { @_ } |
|
|
50
|
|
|
|
|
|
14
|
|
|
|
|
|
|
: @_ ? $_[0] |
15
|
|
|
|
|
|
|
: undef; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# two slot array, 0 for the element's own value, 1 for use by Heap |
18
|
108257
|
|
|
|
|
233266
|
my $self = [ $val, undef ]; |
19
|
|
|
|
|
|
|
|
20
|
108257
|
|
|
|
|
336128
|
return bless $self, $class; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# get or set value slot |
25
|
|
|
|
|
|
|
sub val { |
26
|
11400
|
50
|
|
11400
|
1
|
70039
|
@_ > 1 ? ($_[0][0] = $_[1]) : $_[0][0]; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# get or set heap slot |
30
|
|
|
|
|
|
|
sub heap { |
31
|
219187
|
100
|
|
219187
|
1
|
650051
|
@_ > 1 ? ($_[0][1] = $_[1]) : $_[0][1]; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub cmp { |
35
|
0
|
|
|
0
|
1
|
|
die "This cmp method must be superceded by one that knows how to compare elements." |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
__END__ |