| 1 | package Term::Fabulous::Chart::Scale; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use v5.32; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use feature 'signatures'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | no warnings 'experimental::signatures'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | our $VERSION = '0.05'; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Object::Pad 0.825; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | class Term::Fabulous::Chart::Scale :abstract { | ||||||||||||||||||||||||||||
| 13 | 174 | ▶ | field $min :param :reader; | ||||||||||||||||||||||||||
|
Subroutine
min: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 14 | 171 | ▶ | field $max :param :reader; | ||||||||||||||||||||||||||
|
Subroutine
max: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 15 | 47 | ▶ | field $cells :param :reader; # the cells the axis was fitted to | ||||||||||||||||||||||||||
|
Subroutine
cells: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 16 | 16 | ▶ | field $used :param :reader; # the cells its ticks span (at most cells) | ||||||||||||||||||||||||||
|
Subroutine
used: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 17 | field $ticks :param = []; # [ { value, label } ], in order | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | # Where a value lies on the axis: 0 at min, 1 at max (outside for | ||||||||||||||||||||||||||||
| 20 | # values outside), undef for values the scale cannot show. | ||||||||||||||||||||||||||||
| 21 | 1 | method position; | |||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 1 | method kind; | |||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 1 | method value_at; | |||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 36 | ▶ | method ticks () { | ||||||||||||||||||||||||||
|
Subroutine
ticks: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 28 | return map { | ||||||||||||||||||||||||||||
| 29 | 36 | { %$_, position => $self->position( $_->{value} ) } | |||||||||||||||||||||||||||
| 30 | } @$ticks; | ||||||||||||||||||||||||||||
| 31 | 1 | } | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 1 | ▶ | method tick_count () { | ||||||||||||||||||||||||||
|
Subroutine
tick_count: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 34 | 1 | return scalar @$ticks; | |||||||||||||||||||||||||||
| 35 | 1 | } | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | # A band scale gives each value a slot; the others place values on | ||||||||||||||||||||||||||||
| 38 | # points. | ||||||||||||||||||||||||||||
| 39 | 1 | ▶ | method is_band () { | ||||||||||||||||||||||||||
|
Subroutine
is_band: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 40 | 1 | return 0; | |||||||||||||||||||||||||||
| 41 | 1 | } | |||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 6 | ▶ | method contains ($value) { | ||||||||||||||||||||||||||
|
Subroutine
contains: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||
| 44 | 6 | ▶ | my $position = $self->position($value) // return 0; | ||||||||||||||||||||||||||
|
Condition100%2/2
$self->position($value) // (return 0)
MC/DC100%1/1
$self->position($value) // (return 0)
$self->position($value)
Truth table100%2/2
A
A= $self->position($value)
| |||||||||||||||||||||||||||||
| 45 | 5 | ▶ | return $position >= -1e-9 && $position <= 1 + 1e-9 ? 1 : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$position >= "-1e-09" and $position <= "1.000000001"
MC/DC100%2/2
$position >= "-1e-09" and $position <= "1.000000001"
$position >= "-1e-09"
$position <= "1.000000001"
Truth table100%3/3
A and B
A= $position >= "-1e-09"B= $position <= "1.000000001"
| |||||||||||||||||||||||||||||
| 46 | 1 | } | |||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 1 | 1; | |||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | __END__ | ||||||||||||||||||||||||||||