| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Schedule::Easing::Ease; |
|
2
|
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
8233
|
use strict; |
|
|
5
|
|
|
|
|
14
|
|
|
|
5
|
|
|
|
|
190
|
|
|
4
|
5
|
|
|
5
|
|
23
|
use warnings; |
|
|
5
|
|
|
|
|
7
|
|
|
|
5
|
|
|
|
|
381
|
|
|
5
|
5
|
|
|
5
|
|
34
|
use Carp qw/carp confess/; |
|
|
5
|
|
|
|
|
30
|
|
|
|
5
|
|
|
|
|
462
|
|
|
6
|
5
|
|
|
5
|
|
31
|
use Scalar::Util qw/looks_like_number/; |
|
|
5
|
|
|
|
|
8
|
|
|
|
5
|
|
|
|
|
618
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
5
|
|
|
5
|
|
2648
|
use Schedule::Easing::Function; |
|
|
5
|
|
|
|
|
16
|
|
|
|
5
|
|
|
|
|
4512
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION='0.1.4'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
61
|
|
|
61
|
|
278
|
sub _default_keys { return qw/name match begin final tsA tsB shape shapeopt _warnExpired/ } |
|
13
|
|
|
|
|
|
|
sub _default { |
|
14
|
|
|
|
|
|
|
return ( |
|
15
|
61
|
|
|
61
|
|
651
|
name =>undef, |
|
16
|
|
|
|
|
|
|
match=>qr/./, |
|
17
|
|
|
|
|
|
|
begin=>0, |
|
18
|
|
|
|
|
|
|
final=>1, |
|
19
|
|
|
|
|
|
|
tsA =>0, |
|
20
|
|
|
|
|
|
|
tsB =>1, |
|
21
|
|
|
|
|
|
|
shape=>'linear', |
|
22
|
|
|
|
|
|
|
shapeopt=>[], |
|
23
|
|
|
|
|
|
|
_warnExpired=>0, |
|
24
|
|
|
|
|
|
|
); |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub new { |
|
28
|
19
|
|
|
19
|
0
|
413250
|
my ($ref,%opt)=@_; |
|
29
|
19
|
|
66
|
|
|
127
|
my $class=ref($ref)||$ref; |
|
30
|
|
|
|
|
|
|
my %self=( |
|
31
|
|
|
|
|
|
|
$class->_default(), |
|
32
|
|
|
|
|
|
|
(ref($ref)?%$ref:()), |
|
33
|
19
|
100
|
|
|
|
54
|
map {$_=>$opt{$_}} grep {defined($opt{$_})} $class->_default_keys() |
|
|
29
|
|
|
|
|
176
|
|
|
|
171
|
|
|
|
|
408
|
|
|
34
|
|
|
|
|
|
|
); |
|
35
|
19
|
|
|
|
|
97
|
return bless(\%self,$class)->validate()->init(); |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub validate { |
|
39
|
61
|
|
|
61
|
0
|
119
|
my ($self)=@_; |
|
40
|
61
|
|
|
|
|
183
|
foreach my $k (qw/tsA tsB begin final/) { |
|
41
|
232
|
50
|
|
|
|
534
|
if(!defined($$self{$k})) { confess("Must be defined: $k") } |
|
|
0
|
|
|
|
|
0
|
|
|
42
|
232
|
100
|
|
|
|
735
|
if(!looks_like_number($$self{$k})) { confess("Must be numeric: $k") } |
|
|
8
|
|
|
|
|
115
|
|
|
43
|
|
|
|
|
|
|
} |
|
44
|
53
|
100
|
|
|
|
188
|
if(ref($$self{match}) ne 'Regexp') { confess('Must be Regexp: match') } |
|
|
3
|
|
|
|
|
267
|
|
|
45
|
50
|
50
|
|
|
|
135
|
if(ref($$self{name})) { confess('Must be string: name') } |
|
|
0
|
|
|
|
|
0
|
|
|
46
|
50
|
|
|
|
|
99
|
foreach my $k (qw/begin final/) { |
|
47
|
100
|
100
|
|
|
|
263
|
if($$self{$k}<0) { $$self{$k}=0; carp("$k<0"); $$self{_err}=1 } |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
20
|
|
|
|
1
|
|
|
|
|
781
|
|
|
48
|
100
|
100
|
|
|
|
265
|
if($$self{$k}>1) { $$self{$k}=1; carp("$k>1"); $$self{_err}=1 } |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
18
|
|
|
|
1
|
|
|
|
|
690
|
|
|
49
|
|
|
|
|
|
|
} |
|
50
|
50
|
100
|
|
|
|
139
|
if($$self{tsA}>=$$self{tsB}) { $$self{tsB}=1+$$self{tsA}; carp('tsA>=tsB'); $$self{_err}=1 } |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
16
|
|
|
|
1
|
|
|
|
|
666
|
|
|
51
|
50
|
100
|
66
|
|
|
176
|
if($$self{_warnExpired}&&($$self{tsB} |
|
|
|
|
100
|
|
|
|
|
|
52
|
2
|
100
|
|
|
|
7
|
if($$self{name}) { carp("Event has expired: $$self{name}"); $$self{_err}=1 } |
|
|
1
|
|
|
|
|
14
|
|
|
|
1
|
|
|
|
|
733
|
|
|
53
|
1
|
|
|
|
|
41
|
else { carp("Event with tsB=$$self{tsB} has expired"); $$self{_err}=1 } |
|
|
1
|
|
|
|
|
662
|
|
|
54
|
|
|
|
|
|
|
} |
|
55
|
50
|
|
|
|
|
167
|
$$self{_shaper} =Schedule::Easing::Function::shape($$self{shape}); |
|
56
|
50
|
|
|
|
|
143
|
$$self{_unshaper}=Schedule::Easing::Function::inverse($$self{shape}); |
|
57
|
50
|
|
|
|
|
140
|
return $self; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub init { |
|
61
|
46
|
|
|
46
|
0
|
93
|
my ($self)=@_; |
|
62
|
46
|
|
|
|
|
136
|
$$self{tsrange}=int($$self{tsB}-$$self{tsA}); |
|
63
|
46
|
|
|
|
|
201
|
return $self; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
0
|
|
|
0
|
0
|
0
|
sub includes { die 'Abstract' } |
|
67
|
0
|
|
|
0
|
0
|
0
|
sub schedule { die 'Abstract' } |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub matches { |
|
70
|
200078
|
|
|
200078
|
0
|
372020
|
my ($self,$message)=@_; |
|
71
|
200078
|
100
|
|
|
|
1494296
|
if($message=~$$self{match}) { return (matched=>1,%+) } |
|
|
200018
|
|
|
|
|
1998956
|
|
|
72
|
60
|
|
|
|
|
181
|
return; |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |