line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package AI::Pathfinding::AStar::AStarNode; |
2
|
1
|
|
|
1
|
|
8
|
use base 'Heap::Elem'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1561
|
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
583
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
218
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub new { |
7
|
47
|
|
|
47
|
1
|
64
|
my $proto = shift; |
8
|
47
|
|
33
|
|
|
187
|
my $class = ref($proto) || $proto; |
9
|
|
|
|
|
|
|
|
10
|
47
|
|
|
|
|
79
|
my ($id,$g,$h) = @_; |
11
|
|
|
|
|
|
|
|
12
|
47
|
|
|
|
|
76
|
my $self = {}; |
13
|
47
|
|
|
|
|
110
|
$self->{id} = $id; |
14
|
47
|
|
|
|
|
81
|
$self->{g} = $g; |
15
|
47
|
|
|
|
|
138
|
$self->{h} = $h; |
16
|
47
|
|
|
|
|
91
|
$self->{f} = $g+$h; |
17
|
47
|
|
|
|
|
68
|
$self->{parent} = undef; |
18
|
47
|
|
|
|
|
68
|
$self->{cost} = 0; |
19
|
47
|
|
|
|
|
66
|
$self->{inopen} = 0; |
20
|
47
|
|
|
|
|
99
|
$self->{heap} = undef; |
21
|
|
|
|
|
|
|
|
22
|
47
|
|
|
|
|
125
|
bless ($self, $class); |
23
|
47
|
|
|
|
|
157
|
return $self; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub heap { |
27
|
146
|
|
|
146
|
1
|
2023
|
my ($self, $val) = @_; |
28
|
146
|
100
|
|
|
|
351
|
$self->{heap} = $val if (defined $val); |
29
|
146
|
|
|
|
|
341
|
return $self->{heap}; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub cmp { |
33
|
181
|
|
|
181
|
1
|
2938
|
my $self = shift; |
34
|
181
|
|
|
|
|
212
|
my $other = shift; |
35
|
181
|
|
|
|
|
490
|
return ($self->{f} <=> $other->{f}); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|