File Coverage

blib/lib/AI/Pathfinding/OptimizeMultiple/PostProcessor.pm
Criterion Covered Total %
statement 11 36 30.5
branch 0 6 0.0
condition n/a
subroutine 4 6 66.6
pod 2 2 100.0
total 17 50 34.0


line stmt bran cond sub pod time code
1             $AI::Pathfinding::OptimizeMultiple::PostProcessor::VERSION = '0.0.17';
2             use strict;
3 1     1   7 use warnings;
  1         3  
  1         33  
4 1     1   5  
  1         2  
  1         28  
5             use 5.012;
6 1     1   24  
  1         4  
7             use MooX qw/late/;
8 1     1   5  
  1         3  
  1         9  
9             has _should_do_rle =>
10             ( isa => 'Bool', is => 'ro', init_arg => 'do_rle', required => 1 );
11             has _offset_quotas => (
12             isa => 'Bool',
13             is => 'ro',
14             init_arg => 'offset_quotas',
15             required => 1
16             );
17              
18             {
19             my $self = shift;
20              
21 0     0 1   my @scans_list = @{ shift() };
22              
23 0           my $scan = shift(@scans_list);
  0            
24              
25 0           my (@a);
26             while ( my $next_scan = shift(@scans_list) )
27 0           {
28 0           if ( $next_scan->scan_idx() == $scan->scan_idx() )
29             {
30 0 0         $scan->iters( $scan->iters() + $next_scan->iters() );
31             }
32 0           else
33             {
34             push @a, $scan;
35             $scan = $next_scan;
36 0           }
37 0           }
38             push @a, $scan;
39             return \@a;
40 0           }
41 0            
42             {
43             my $self = shift;
44              
45             my $scans_orig = shift;
46 0     0 1    
47             # clone the scans.
48 0           my $scans = [ map { $_->clone(); } @{$scans_orig} ];
49              
50             if ( $self->_offset_quotas )
51 0           {
  0            
  0            
52             $scans = [
53 0 0         map {
54             my $ret = $_->clone();
55             $ret->iters( $ret->iters() + 1 );
56             $ret;
57 0           } @$scans
  0            
58 0           ];
59 0           }
60              
61             if ( $self->_should_do_rle )
62             {
63             $scans = $self->scans_rle($scans);
64 0 0         }
65              
66 0           return $scans;
67             }
68              
69 0           1;
70              
71              
72             =pod
73              
74             =encoding UTF-8
75              
76             =head1 NAME
77              
78             AI::Pathfinding::OptimizeMultiple::PostProcessor - post-processor.
79              
80             =head1 VERSION
81              
82             version 0.0.17
83              
84             =head1 SUBROUTINES/METHODS
85              
86             =head2 $self->scans_rle()
87              
88             For internal use.
89              
90             =head2 $self->process($scans_orig)
91              
92             For internal use.
93              
94             =for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
95              
96             =head1 SUPPORT
97              
98             =head2 Websites
99              
100             The following websites have more information about this module, and may be of help to you. As always,
101             in addition to those websites please use your favorite search engine to discover more resources.
102              
103             =over 4
104              
105             =item *
106              
107             MetaCPAN
108              
109             A modern, open-source CPAN search engine, useful to view POD in HTML format.
110              
111             L<https://metacpan.org/release/AI-Pathfinding-OptimizeMultiple>
112              
113             =item *
114              
115             RT: CPAN's Bug Tracker
116              
117             The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN.
118              
119             L<https://rt.cpan.org/Public/Dist/Display.html?Name=AI-Pathfinding-OptimizeMultiple>
120              
121             =item *
122              
123             CPANTS
124              
125             The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
126              
127             L<http://cpants.cpanauthors.org/dist/AI-Pathfinding-OptimizeMultiple>
128              
129             =item *
130              
131             CPAN Testers
132              
133             The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
134              
135             L<http://www.cpantesters.org/distro/A/AI-Pathfinding-OptimizeMultiple>
136              
137             =item *
138              
139             CPAN Testers Matrix
140              
141             The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
142              
143             L<http://matrix.cpantesters.org/?dist=AI-Pathfinding-OptimizeMultiple>
144              
145             =item *
146              
147             CPAN Testers Dependencies
148              
149             The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution.
150              
151             L<http://deps.cpantesters.org/?module=AI::Pathfinding::OptimizeMultiple>
152              
153             =back
154              
155             =head2 Bugs / Feature Requests
156              
157             Please report any bugs or feature requests by email to C<bug-ai-pathfinding-optimizemultiple at rt.cpan.org>, or through
158             the web interface at L<https://rt.cpan.org/Public/Bug/Report.html?Queue=AI-Pathfinding-OptimizeMultiple>. You will be automatically notified of any
159             progress on the request by the system.
160              
161             =head2 Source Code
162              
163             The code is open to the world, and available for you to hack on. Please feel free to browse it and play
164             with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
165             from your repository :)
166              
167             L<http://github.com/shlomif/fc-solve>
168              
169             git clone ssh://git@github.com/shlomif/fc-solve.git
170              
171             =head1 AUTHOR
172              
173             Shlomi Fish <shlomif@cpan.org>
174              
175             =head1 BUGS
176              
177             Please report any bugs or feature requests on the bugtracker website
178             L<https://github.com/shlomif/fc-solve/issues>
179              
180             When submitting a bug or request, please include a test-file or a
181             patch to an existing test-file that illustrates the bug or desired
182             feature.
183              
184             =head1 COPYRIGHT AND LICENSE
185              
186             This software is Copyright (c) 2012 by Shlomi Fish.
187              
188             This is free software, licensed under:
189              
190             The MIT (X11) License
191              
192             =cut