line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DerivedUnit; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
412
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use unitConverter; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
17
|
|
7
|
1
|
|
|
1
|
|
4
|
use unit; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# heritage |
10
|
1
|
|
|
1
|
|
22
|
use base qw( Unit ); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
392
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
9
|
|
|
9
|
|
12
|
my $class = shift; |
14
|
9
|
|
|
|
|
28
|
my @definition = @_; |
15
|
9
|
|
33
|
|
|
23
|
$class = ref($class) || $class; |
16
|
9
|
|
|
|
|
20
|
my $this = $class->SUPER::new(); |
17
|
9
|
|
|
|
|
13
|
bless($this, $class); |
18
|
9
|
|
|
|
|
18
|
$this->{DEFINITION} = [@definition]; |
19
|
9
|
|
|
|
|
17
|
return $this; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub definition { |
23
|
10
|
|
|
10
|
|
14
|
my $this = shift; |
24
|
10
|
|
|
|
|
17
|
my @titi = $this->{DEFINITION}; |
25
|
10
|
|
|
|
|
12
|
return @{$this->{DEFINITION}}; |
|
10
|
|
|
|
|
20
|
|
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub toBase { |
29
|
10
|
|
|
10
|
|
16
|
my $this = shift; |
30
|
10
|
|
|
|
|
19
|
my $transform = UnitConverter->identity; |
31
|
10
|
|
|
|
|
16
|
my @def = $this->definition; |
32
|
10
|
|
|
|
|
17
|
for (@def) { |
33
|
18
|
|
|
|
|
50
|
$transform = $_->dim->toBase->linearPow($_->power)->concatenate($transform); |
34
|
|
|
|
|
|
|
} |
35
|
10
|
|
|
|
|
24
|
return $transform; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 NAME |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
DerivedUnit - representation of an unit defined as a factor of powers of units |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 DESCRIPTION |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
This module maps a conceptual class that represents an unit defined as a factor of powers of units. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 AUTHOR |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Samuel Andres |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 LICENSE |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
UnLicense |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
55
|
|
|
|
|
|
|
1; |