line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Math::Business::HMA; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
3237
|
use strict; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
18
|
|
4
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
15
|
|
5
|
1
|
|
|
1
|
|
2
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
31
|
|
6
|
1
|
|
|
1
|
|
308
|
use Math::Business::WMA; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
220
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
1; |
9
|
|
|
|
|
|
|
|
10
|
0
|
|
|
0
|
0
|
0
|
sub tag { (shift)->[-1] } |
11
|
|
|
|
|
|
|
|
12
|
0
|
|
|
0
|
0
|
0
|
sub recommended { croak "no recommendation" } |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
1
|
|
|
1
|
0
|
105
|
my $class = shift; |
16
|
1
|
|
|
|
|
2
|
my $this = bless [ |
17
|
|
|
|
|
|
|
undef, |
18
|
|
|
|
|
|
|
undef, |
19
|
|
|
|
|
|
|
undef, |
20
|
|
|
|
|
|
|
undef |
21
|
|
|
|
|
|
|
], $class; |
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
|
|
2
|
my $days = shift; |
24
|
1
|
50
|
|
|
|
2
|
if( defined $days ) { |
25
|
1
|
|
|
|
|
4
|
$this->set_days( $days ); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
2
|
return $this; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub set_days { |
32
|
1
|
|
|
1
|
0
|
2
|
my $this = shift; |
33
|
1
|
|
|
|
|
1
|
my $arg = int(shift); |
34
|
|
|
|
|
|
|
|
35
|
1
|
50
|
|
|
|
3
|
croak "days must be a positive number" if $arg <= 0; |
36
|
|
|
|
|
|
|
|
37
|
1
|
|
|
|
|
5
|
@$this = ( |
38
|
|
|
|
|
|
|
Math::Business::WMA->new(int($arg/2)), |
39
|
|
|
|
|
|
|
Math::Business::WMA->new($arg), |
40
|
|
|
|
|
|
|
Math::Business::WMA->new(int(sqrt($arg))), |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
"HMA($arg)", # tag must be last |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub insert { |
47
|
265
|
|
|
265
|
0
|
10917
|
my $this = shift; |
48
|
265
|
|
|
|
|
348
|
my ($po2, $p, $sqp) = @$this; |
49
|
|
|
|
|
|
|
|
50
|
265
|
50
|
|
|
|
343
|
croak "You must set the number of days before you try to insert" unless defined $sqp; |
51
|
265
|
|
|
|
|
367
|
while( defined(my $P = shift) ) { |
52
|
265
|
|
|
|
|
428
|
$po2->insert($P); |
53
|
265
|
|
|
|
|
426
|
$p->insert($P); |
54
|
|
|
|
|
|
|
|
55
|
265
|
100
|
66
|
|
|
347
|
if( defined( my $_p = $p->query ) and defined( my $_po2 = $po2->query ) ) { |
56
|
252
|
|
|
|
|
388
|
$sqp->insert( 2*$_po2 - $_p ); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub query { |
62
|
265
|
|
|
265
|
0
|
491
|
my $this = shift; |
63
|
|
|
|
|
|
|
|
64
|
265
|
|
|
|
|
320
|
return $this->[2]->query; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__END__ |