line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Factor; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
4
|
1
|
|
|
1
|
|
9
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
236
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub new { |
7
|
38
|
|
|
38
|
|
60
|
my ( $class, $unit, $numerator, $denominator ) = @_; |
8
|
38
|
|
33
|
|
|
83
|
$class = ref($class) || $class; |
9
|
38
|
|
|
|
|
56
|
my $this = {}; |
10
|
38
|
|
|
|
|
67
|
bless($this, $class); |
11
|
38
|
|
66
|
|
|
105
|
$this->{DIM} = $unit ||= $this; |
12
|
38
|
|
100
|
|
|
88
|
$this->{NUMERATOR} = $numerator ||= 1.; |
13
|
38
|
|
50
|
|
|
92
|
$this->{DENOMINATOR} = $denominator ||= 1; |
14
|
38
|
|
|
|
|
99
|
return $this; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub dim { |
18
|
18
|
|
|
18
|
|
23
|
my $this = shift; |
19
|
18
|
|
|
|
|
38
|
return $this->{DIM}; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub numerator { |
23
|
0
|
|
|
0
|
|
0
|
my $this = shift; |
24
|
0
|
|
|
|
|
0
|
return $this->{NUMERATOR}; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub denominator { |
28
|
0
|
|
|
0
|
|
0
|
my $this = shift; |
29
|
0
|
|
|
|
|
0
|
return $this->{DENOMINATOR}; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub power { |
33
|
18
|
|
|
18
|
|
29
|
my $this = shift; |
34
|
18
|
|
|
|
|
51
|
return $this->{NUMERATOR} / $this->{DENOMINATOR}; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 NAME |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Factor - representation of a power of units |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 DESCRIPTION |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
This module maps a conceptual class that represents a power of unit of measurement. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 AUTHOR |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Samuel Andres |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 LICENSE |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
UnLicense |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |