line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Math::SymbolicX::Calculator::Command::Transformation; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
12
|
use 5.006; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
19
|
|
6
|
1
|
|
|
1
|
|
4
|
use base 'Math::SymbolicX::Calculator::Command'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
68
|
|
7
|
1
|
|
|
1
|
|
5
|
use Params::Util qw/_INSTANCE/; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
213
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
0
|
|
|
0
|
1
|
|
my $proto = shift; |
13
|
0
|
|
0
|
|
|
|
my $class = ref($proto)||$proto; |
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
my %args = @_; |
16
|
0
|
|
|
|
|
|
my $self = bless { |
17
|
|
|
|
|
|
|
symbol => $args{symbol}, |
18
|
|
|
|
|
|
|
trafo => $args{object}, |
19
|
|
|
|
|
|
|
shallow => $args{shallow}, |
20
|
|
|
|
|
|
|
} => $class; |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
return $self; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _execute { |
26
|
0
|
|
|
0
|
|
|
my $self = shift; |
27
|
0
|
|
|
|
|
|
my $c = shift; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
my $sym = $self->{symbol}; |
30
|
0
|
|
|
|
|
|
my $trafo = $self->{trafo}; |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
my $func = $c->{stash}{$sym}; |
33
|
0
|
0
|
|
|
|
|
if (_INSTANCE($func, 'Math::Symbolic::Custom::Transformation')) { |
34
|
0
|
|
|
|
|
|
return "Cannot apply transformation to another transformation '$sym'"; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
0
|
0
|
|
|
|
|
if ($self->{shallow}) { |
38
|
0
|
|
|
|
|
|
$trafo->apply($func); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
else { |
41
|
0
|
|
|
|
|
|
$trafo->apply_recursive($func, $trafo); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
return($sym, '==', $func); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |