App/Chart/Series/Derived/AdaptiveLaguerreAlpha.pm untested

filter: Statementstmt 0.0% 0 / 42 Branchbran n/a Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 14 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 69 CC 1 SCAR 6.9
CC
1
Cov
0%
longname
2.0
shortname
2.0
manual
2.0
CRAP 2.0
1 # Copyright 2007, 2009, 2010 Kevin Ryde
2  
3 # This file is part of Chart.
4 #
5 # Chart is free software; you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation; either version 3, or (at your option) any later version.
8 #
9 # Chart is distributed in the hope that it will be useful, but WITHOUT ANY
10 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12 # details.
13 #
14 # You should have received a copy of the GNU General Public License along
15 # with Chart. If not, see <http://www.gnu.org/licenses/>.
16  
17 package App::Chart::Series::Derived::AdaptiveLaguerreAlpha;
18 use 5.010;
19 use strict;
20 use warnings;
21 use Carp;
22 use List::Util qw(min max);
23 use Locale::TextDomain ('App-Chart');
24  
25 use base 'App::Chart::Series::Indicator';
26 use App::Chart::Series::Derived::AdaptiveLaguerre;
27  
28  
29 sub longname { __('Adaptive Laguerre - Alpha') }
30 sub shortname { __('Adaptive Laguerre Alpha') }
31 sub manual { __p('manual-node','Adaptive Laguerre Filter') }
32  
33 use constant
34 { type => 'indicator',
35 units => 'ema_alpha',
36 priority => -10,
37 minimum => 0,
38 maximum => 1,
39 parameter_info => [ { name => __('Days'),
40 # shared with main AdaptiveLaguerre
41 key => 'adaptive_laguerre_filter_days',
42 type => 'integer',
43 minimum => 1,
44 default => 20 } ],
45 };
46  
47 sub new {
48 my ($class, $parent, $N) = @_;
49  
50 $N //= parameter_info()->[0]->{'default'};
51 ($N >= 1) || croak "Adaptive Laguerre Filter bad N: $N";
52  
53 return $class->SUPER::new
54 (parent => $parent,
55 parameters => [ $N ],
56 arrays => { values => [] },
57 array_aliases => { });
58 }
59  
60 sub proc {
61 my ($class, $N) = @_;
62 my $proc_laguerre_and_alpha = App::Chart::Series::Derived::AdaptiveLaguerre
63 ->proc_laguerre_and_alpha($N);
64 return sub {
65 return ($proc_laguerre_and_alpha->(@_))[1];
66 };
67 }
68 *warmup_count = \&App::Chart::Series::Derived::AdaptiveLaguerre::warmup_count;
69  
70 1;
71 __END__