| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package AI::Pathfinding::OptimizeMultiple::PostProcessor; |
|
2
|
|
|
|
|
|
|
$AI::Pathfinding::OptimizeMultiple::PostProcessor::VERSION = '0.0.15'; |
|
3
|
1
|
|
|
1
|
|
7
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
28
|
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
23
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
22
|
use 5.012; |
|
|
1
|
|
|
|
|
4
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5
|
use MooX qw/late/; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
7
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has _should_do_rle => (isa => 'Bool', is => 'ro', init_arg => 'do_rle', required => 1); |
|
11
|
|
|
|
|
|
|
has _offset_quotas => (isa => 'Bool', is => 'ro', init_arg => 'offset_quotas', required => 1); |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub scans_rle |
|
14
|
|
|
|
|
|
|
{ |
|
15
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
16
|
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
my @scans_list = @{shift()}; |
|
|
0
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
my $scan = shift(@scans_list); |
|
20
|
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
my (@a); |
|
22
|
0
|
|
|
|
|
|
while (my $next_scan = shift(@scans_list)) |
|
23
|
|
|
|
|
|
|
{ |
|
24
|
0
|
0
|
|
|
|
|
if ($next_scan->scan_idx() == $scan->scan_idx()) |
|
25
|
|
|
|
|
|
|
{ |
|
26
|
0
|
|
|
|
|
|
$scan->iters( $scan->iters() + $next_scan->iters() ); |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
else |
|
29
|
|
|
|
|
|
|
{ |
|
30
|
0
|
|
|
|
|
|
push @a, $scan; |
|
31
|
0
|
|
|
|
|
|
$scan = $next_scan; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
} |
|
34
|
0
|
|
|
|
|
|
push @a, $scan; |
|
35
|
0
|
|
|
|
|
|
return \@a; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub process |
|
40
|
|
|
|
|
|
|
{ |
|
41
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
42
|
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
my $scans_orig = shift; |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# clone the scans. |
|
46
|
0
|
|
|
|
|
|
my $scans = [ map { $_->clone(); } @{$scans_orig}]; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
|
48
|
0
|
0
|
|
|
|
|
if ($self->_offset_quotas) |
|
49
|
|
|
|
|
|
|
{ |
|
50
|
|
|
|
|
|
|
$scans = |
|
51
|
|
|
|
|
|
|
[ |
|
52
|
0
|
|
|
|
|
|
map { my $ret = $_->clone(); $ret->iters($ret->iters()+1); $ret; } |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
@$scans |
|
54
|
|
|
|
|
|
|
]; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
0
|
0
|
|
|
|
|
if ($self->_should_do_rle) |
|
58
|
|
|
|
|
|
|
{ |
|
59
|
0
|
|
|
|
|
|
$scans = $self->scans_rle($scans); |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
return $scans; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
__END__ |