| 1 | package Factor; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | 38 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=5 SCAR=16.6
| |||||||||||||||||||||
| 7 | 38 | my ( $class, $unit, $numerator, $denominator ) = @_; | |||||||||||||||||||
| 8 | 38 | ▶ | $class = ref($class) || $class; | ||||||||||||||||||
|
Condition33%1/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table33%1/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||
| 9 | 38 | my $this = {}; | |||||||||||||||||||
| 10 | 38 | bless($this, $class); | |||||||||||||||||||
| 11 | 38 | ▶ | $this->{DIM} = $unit ||= $this; | ||||||||||||||||||
|
Condition66%2/3
$unit ||= $this
MC/DC0%0/2
$unit ||= $this
$unit
$this
Truth table66%2/3
A ||= B
A= $unitB= $this
| |||||||||||||||||||||
| 12 | 38 | ▶ | $this->{NUMERATOR} = $numerator ||= 1.; | ||||||||||||||||||
|
Condition100%2/2
$numerator ||= 1
MC/DC100%1/1
$numerator ||= 1
$numerator
Truth table100%2/2
A
A= $numerator
| |||||||||||||||||||||
| 13 | 38 | ▶ | $this->{DENOMINATOR} = $denominator ||= 1; | ||||||||||||||||||
|
Condition50%1/2
$denominator ||= 1
MC/DC0%0/1
$denominator ||= 1
$denominator
Truth table50%1/2
A
A= $denominator
| |||||||||||||||||||||
| 14 | 38 | return $this; | |||||||||||||||||||
| 15 | } | ||||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | 18 | ▶ | sub dim { | ||||||||||||||||||
|
Subroutine
dim: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 18 | 18 | my $this = shift; | |||||||||||||||||||
| 19 | 18 | return $this->{DIM}; | |||||||||||||||||||
| 20 | } | ||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | 0 | ▶ | sub numerator { | ||||||||||||||||||
|
Subroutine
numerator: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 23 | 0 | my $this = shift; | |||||||||||||||||||
| 24 | 0 | return $this->{NUMERATOR}; | |||||||||||||||||||
| 25 | } | ||||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | 0 | ▶ | sub denominator { | ||||||||||||||||||
|
Subroutine
denominator: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 28 | 0 | my $this = shift; | |||||||||||||||||||
| 29 | 0 | return $this->{DENOMINATOR}; | |||||||||||||||||||
| 30 | } | ||||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | 18 | ▶ | sub power { | ||||||||||||||||||
|
Subroutine
power: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 33 | 18 | my $this = shift; | |||||||||||||||||||
| 34 | 18 | 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 | 1; | |||||||||||||||||||