| 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # common code of Graphics::Toolkit::Color::Space::Instance::* packages | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | package Graphics::Toolkit::Color::Space; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 49 | ▶ | use v5.12; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 49 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 49 | ▶ | use Graphics::Toolkit::Color::Space::Basis; # 1 attr class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 49 | ▶ | use Graphics::Toolkit::Color::Space::Shape; # 2 .. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 49 | ▶ | use Graphics::Toolkit::Color::Space::Format; # 3 .. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 49 | ▶ | use Graphics::Toolkit::Color::Space::Util qw/:all/; # forward all its symbols | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 49 | ▶ | use Exporter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 49 | our @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 49 | our @EXPORT_OK = qw/min max uniq round_int round_decimals mod_real spow mult_matrix_vector_3 is_nr/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 49 | our %EXPORT_TAGS = (all => [@EXPORT_OK]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 536 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=22 SCAR=35.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 536 | my $pkg = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 536 | ▶ | return if @_ % 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 536 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | my $basis = Graphics::Toolkit::Color::Space::Basis->new( $args{'axis'}, $args{'short'}, $args{'name'}, $args{'alias_name'}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 536 | $args{'family'}, $args{'role'}, ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 536 | ▶ | return $basis unless ref $basis; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 535 | my $shape = Graphics::Toolkit::Color::Space::Shape->new( $basis, $args{'type'}, $args{'range'}, $args{'precision'}, $args{'constraint'} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 535 | ▶ | return $shape unless ref $shape; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 535 | my $format = Graphics::Toolkit::Color::Space::Format->new( $basis, $args{'value_form'}, $args{'prefix'}, $args{'suffix'} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 535 | ▶ | return $format unless ref $format; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 535 | my $self = bless { basis => $basis, shape => $shape, format => $format, convert => {} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 535 | ▶ | if (ref $args{'format'} eq 'HASH'){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 16 | for my $format_name (keys %{$args{'format'}}){ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 16 | my $formatter = $args{'format'}{$format_name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 16 | ▶ | next unless ref $formatter eq 'ARRAY' and @$formatter > 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $formatter eq "ARRAY" and @$formatter > 0
MC/DC0%0/2
ref $formatter eq "ARRAY" and @$formatter > 0
ref $formatter eq "ARRAY"
@$formatter > 0
Truth table33%1/3
A and B
A= ref $formatter eq "ARRAY"B= @$formatter > 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 16 | ▶ | $format->add_formatter($format_name, $formatter->[0]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $formatter->[0] and ref $formatter->[0] eq "CODE"
MC/DC0%0/2
exists $formatter->[0] and ref $formatter->[0] eq "CODE"
exists $formatter->[0]
ref $formatter->[0] eq "CODE"
Truth table33%1/3
A and B
A= exists $formatter->[0]B= ref $formatter->[0] eq "CODE"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | if exists $formatter->[0] and ref $formatter->[0] eq 'CODE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 16 | ▶ | $format->add_deformatter($format_name, $formatter->[1]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $formatter->[1] and ref $formatter->[1] eq "CODE"
MC/DC0%0/2
exists $formatter->[1] and ref $formatter->[1] eq "CODE"
exists $formatter->[1]
ref $formatter->[1] eq "CODE"
Truth table33%1/3
A and B
A= exists $formatter->[1]B= ref $formatter->[1] eq "CODE"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | if exists $formatter->[1] and ref $formatter->[1] eq 'CODE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 535 | ▶ | if (ref $args{'convert'} eq 'HASH'){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 512 | for my $converter_target_space_name (keys %{$args{'convert'}}){ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 512 | my $converter_data = $args{'convert'}{ $converter_target_space_name }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 512 | ▶ | next unless ref $converter_data eq 'ARRAY' and @$converter_data > 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
ref $converter_data eq "ARRAY" and @$converter_data > 1 and ref $converter_data->[0] eq "CODE" and ref $converter_data->[1] eq "CODE"
ref $converter_data eq "ARRAY" and @$converter_data > 1 and ref $converter_data->[0] eq "CODE"
ref $converter_data eq "ARRAY" and @$converter_data > 1
MC/DC0%0/4
ref $converter_data eq "ARRAY" and @$converter_data > 1 and ref $converter_data->[0] eq "CODE" and ref $converter_data->[1] eq "CODE"
ref $converter_data eq "ARRAY"
@$converter_data > 1
ref $converter_data->[0] eq "CODE"
ref $converter_data->[1] eq "CODE"
Truth table20%1/5
A and B and C and D
A= ref $converter_data eq "ARRAY"B= @$converter_data > 1C= ref $converter_data->[0] eq "CODE"D= ref $converter_data->[1] eq "CODE"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | and ref $converter_data->[0] eq 'CODE' and ref $converter_data->[1] eq 'CODE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 512 | $self->add_converter( $converter_target_space_name, @$converter_data ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 535 | ▶ | if (ref $args{'values'} eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 16 | my $numifier = $args{'values'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | $format->set_value_numifier( $numifier->{'read'}, $numifier->{'write'} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 16 | ▶ | if ref $numifier->{'read'} eq 'CODE' and ref $numifier->{'write'} eq 'CODE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $numifier->{"read"} eq "CODE" and ref $numifier->{"write"} eq "CODE"
MC/DC0%0/2
ref $numifier->{"read"} eq "CODE" and ref $numifier->{"write"} eq "CODE"
ref $numifier->{"read"} eq "CODE"
ref $numifier->{"write"} eq "CODE"
Truth table33%1/3
A and B
A= ref $numifier->{"read"} eq "CODE"B= ref $numifier->{"write"} eq "CODE"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 535 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 28687 | ▶ | sub basis { $_[0]{'basis'} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
basis: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 7819 | ▶ | sub name { shift->basis->space_name(@_) } # -- ?alias ?given --> ~ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 990 | ▶ | sub family { shift->basis->family(@_) } # --> ~ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
family: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 529 | ▶ | sub is_name { shift->basis->is_name(@_) } # ~name --> ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 16211 | ▶ | sub normalize_name { shift->basis->normalize_name(@_) } # ~name --> ~ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
normalize_name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 133 | ▶ | sub axis_count { shift->basis->axis_count } # --> + | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
axis_count: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 235 | ▶ | sub is_axis_name { shift->basis->is_axis_name(@_) } # ~axis_name --> ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_axis_name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 28 | ▶ | sub is_axis_role { shift->basis->is_axis_role(@_) } # ~role_name --> ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_axis_role: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 205 | ▶ | sub pos_from_axis_name { shift->basis->pos_from_axis_name(@_) }# ~axis_name --> +| | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pos_from_axis_name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 88 | ▶ | sub pos_from_axis_role { shift->basis->pos_from_axis_role(@_) }# ~axis_name --> +| | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pos_from_axis_role: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 1071 | ▶ | sub is_value_tuple { shift->basis->is_value_tuple(@_) } # @+tuple --> ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_value_tuple: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 828 | ▶ | sub is_number_tuple { shift->basis->is_number_tuple(@_) } # @+tuple --> ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_number_tuple: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 98 | ▶ | sub is_partial_hash { shift->basis->is_partial_hash(@_) } # %+partial_hash --> ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_partial_hash: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 379 | ▶ | sub tuple_from_partial_hash { shift->basis->tuple_from_partial_hash(@_) } # %+partial_hash --> @+tuple | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tuple_from_partial_hash: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 4947 | ▶ | sub shape { $_[0]{'shape'} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
shape: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 34 | ▶ | sub is_euclidean { shift->shape->is_euclidean() } # --> ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_euclidean: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 33 | ▶ | sub is_cylindrical { shift->shape->is_cylindrical } # --> ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_cylindrical: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | sub is_equal { shift->shape->is_equal( @_ ) } # @+tuple_a, @+tuple_b -- @+precision --> ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_equal: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 368 | ▶ | sub is_in_linear_bounds{ shift->shape->is_in_linear_bounds(@_)}#@+tuple -- @+range --> ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_in_linear_bounds: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | sub is_in_bounds { shift->shape->is_in_bounds(@_)} # @+tuple -- @+range --> ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_in_bounds: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 1224 | ▶ | sub round { shift->shape->round( @_ ) } # @+tuple -- @+precision --> @+tuple | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
round: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 989 | ▶ | sub clamp { shift->shape->clamp( @_ ) } # @+tuple -- @+range --> @+tuple | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clamp: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 14 | ▶ | sub rotate { shift->shape->rotate( @_ ) } # @+tuple -- @+range --> @+tuple | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rotate: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 365 | ▶ | sub check_value_shape { shift->shape->check_value_shape( @_)}# @+tuple -- @+range, @+precision --> @+tuple|!~ # errmsg | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check_value_shape: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 719 | ▶ | sub normalize { shift->shape->normalize(@_)} # @+tuple -- @+range --> @+tuple|!~ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
normalize: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 1021 | ▶ | sub denormalize { shift->shape->denormalize(@_)} # @+tuple -- @+range --> @+tuple|!~ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
denormalize: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 29 | ▶ | sub denormalize_delta { shift->shape->denormalize_delta(@_)} # @+tuple -- @+range --> @+tuple|!~ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
denormalize_delta: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 54 | ▶ | sub delta { shift->shape->delta( @_ ) } # @+tuple_a, @+tuple_b --> @+tuple| # on normalized values | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delta: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 2 | ▶ | sub has_constraints { shift->shape->has_constraints(@_)} # --> ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_constraints: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | sub add_constraint { shift->shape->add_constraint(@_)} # ~name, ~error, &checker, &remedy --> %constraint | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_constraint: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | ######################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 2470 | ▶ | sub form { $_[0]{'format'} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
form: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 135 | ▶ | sub format { shift->form->format(@_) } # @+values, ~format_name -- @~suffix --> $*color | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
format: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 2330 | ▶ | sub deformat { shift->form->deformat(@_) } # $*color -- @~suffix --> @+values, ~format_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
deformat: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | #### conversion ######################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 855 | ▶ | sub conversion_tree_parent { (keys %{ $_[0]{'convert'} })[0] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
conversion_tree_parent: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 2586 | ▶ | sub can_convert { (defined $_[1] and exists $_[0]{'convert'}{ $_[0]->normalize_name($_[1]) }) ? 1 : 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
can_convert: called CC=3 SCAR=11.1
Pod
undocumented
Branch: 1 branch
Condition66%2/3
defined $_[1] and exists $_[0]{"convert"}{$_[0]->normalize_name($_[1])}
MC/DC50%1/2
defined $_[1] and exists $_[0]{"convert"}{$_[0]->normalize_name($_[1])}
defined $_[1]
exists $_[0]{"convert"}{$_[0]->normalize_name($_[1])}
Truth table66%2/3
A and B
A= defined $_[1]B= exists $_[0]{"convert"}{$_[0]->normalize_name($_[1])}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 514 | ▶ | sub add_converter { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_converter: called CC=21 SCAR=37.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 514 | my ($self, $space_name, $to_code, $from_code, $normal) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 514 | ▶ | return 0 if not defined $space_name or ref $space_name or ref $from_code ne 'CODE' or ref $to_code ne 'CODE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
not defined $space_name or ref $space_name or ref $from_code ne "CODE" or ref $to_code ne "CODE"
not defined $space_name or ref $space_name or ref $from_code ne "CODE"
not defined $space_name or ref $space_name
MC/DC0%0/4
not defined $space_name or ref $space_name or ref $from_code ne "CODE" or ref $to_code ne "CODE"
not defined $space_name
ref $space_name
ref $from_code ne "CODE"
ref $to_code ne "CODE"
Truth table20%1/5
not(A) or B or C or D
A= not defined $space_nameB= ref $space_nameC= ref $from_code ne "CODE"D= ref $to_code ne "CODE"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 514 | ▶ | return 0 if $self->can_convert( $space_name ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 514 | ▶ | return 0 if defined $normal and ref $normal ne 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $normal and ref $normal ne "HASH"
MC/DC0%0/2
defined $normal and ref $normal ne "HASH"
defined $normal
ref $normal ne "HASH"
Truth table66%2/3
A and B
A= defined $normalB= ref $normal ne "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 514 | ▶ | $normal = { from => 1, to => 1, } unless ref $normal; # flags: default is full normalisation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 514 | ▶ | $normal->{'from'} = {} if not exists $normal->{'from'} or (exists $normal->{'from'} and not $normal->{'from'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not exists $normal->{"from"} or exists $normal->{"from"} and not $normal->{"from"}
exists $normal->{"from"} and not $normal->{"from"}
MC/DC0%0/3
not exists $normal->{"from"} or exists $normal->{"from"} and not $normal->{"from"}
not exists $normal->{"from"}
exists $normal->{"from"}
not $normal->{"from"}
Truth table25%1/4
not(A) or B and not(C)
A= not exists $normal->{"from"}B= exists $normal->{"from"}C= not $normal->{"from"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 514 | ▶ | $normal->{'from'} = {in => 1, out => 1} if not ref $normal->{'from'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 514 | ▶ | $normal->{'from'}{'in'} = 0 unless exists $normal->{'from'}{'in'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 514 | ▶ | $normal->{'from'}{'out'} = 0 unless exists $normal->{'from'}{'out'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 514 | ▶ | $normal->{'to'} = {} if not exists $normal->{'to'} or (exists $normal->{'to'} and not $normal->{'to'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
not exists $normal->{"to"} or exists $normal->{"to"} and not $normal->{"to"}
exists $normal->{"to"} and not $normal->{"to"}
MC/DC0%0/3
not exists $normal->{"to"} or exists $normal->{"to"} and not $normal->{"to"}
not exists $normal->{"to"}
exists $normal->{"to"}
not $normal->{"to"}
Truth table25%1/4
not(A) or B and not(C)
A= not exists $normal->{"to"}B= exists $normal->{"to"}C= not $normal->{"to"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 514 | ▶ | $normal->{'to'} = {in => 1, out => 1} if not ref $normal->{'to'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 514 | ▶ | $normal->{'to'}{'in'} = 0 unless exists $normal->{'to'}{'in'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 514 | ▶ | $normal->{'to'}{'out'} = 0 unless exists $normal->{'to'}{'out'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 514 | $self->{'convert'}{ $self->normalize_name( $space_name ) } = { from => $from_code, to => $to_code, normal => $normal }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 517 | ▶ | sub convert_to { # convert value tuple from this space into another | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
convert_to: called CC=4 SCAR=16.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 517 | my ($self, $space_name, $tuple) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 517 | $space_name = $self->normalize_name( $space_name ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 517 | ▶ | return unless $self->is_value_tuple( $tuple ) and defined $space_name and $self->can_convert( $space_name ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$self->is_value_tuple($tuple) and defined $space_name and $self->can_convert($space_name)
$self->is_value_tuple($tuple) and defined $space_name
MC/DC0%0/3
$self->is_value_tuple($tuple) and defined $space_name and $self->can_convert($space_name)
$self->is_value_tuple($tuple)
defined $space_name
$self->can_convert($space_name)
Truth table25%1/4
A and B and C
A= $self->is_value_tuple($tuple)B= defined $space_nameC= $self->can_convert($space_name)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 517 | return $self->{'convert'}{ $space_name }{'to'}->( $tuple ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 620 | ▶ | sub convert_from { # convert value tuple from another space into this | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
convert_from: called CC=4 SCAR=16.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 620 | my ($self, $space_name, $tuple) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 620 | $space_name = $self->normalize_name( $space_name ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 620 | ▶ | return unless ref $tuple eq 'ARRAY' and defined $space_name and $self->can_convert( $space_name ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
ref $tuple eq "ARRAY" and defined $space_name and $self->can_convert($space_name)
ref $tuple eq "ARRAY" and defined $space_name
MC/DC0%0/3
ref $tuple eq "ARRAY" and defined $space_name and $self->can_convert($space_name)
ref $tuple eq "ARRAY"
defined $space_name
$self->can_convert($space_name)
Truth table25%1/4
A and B and C
A= ref $tuple eq "ARRAY"B= defined $space_nameC= $self->can_convert($space_name)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 620 | return $self->{'convert'}{ $space_name }{'from'}->( $tuple ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 848 | ▶ | sub converter_normal_states { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
converter_normal_states: called CC=5 SCAR=18.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 848 | my ($self, $direction, $space_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 848 | $space_name = $self->normalize_name( $space_name ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 848 | ▶ | return unless $self->can_convert( $space_name ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition44%4/9
$self->can_convert($space_name) and defined $direction and $direction eq "from" || $direction eq "to"
$self->can_convert($space_name) and defined $direction
$direction eq "from" or $direction eq "to"
MC/DC0%0/4
$self->can_convert($space_name) and defined $direction and $direction eq "from" || $direction eq "to"
$self->can_convert($space_name)
defined $direction
$direction eq "from"
$direction eq "to"
Truth table40%2/5
A and B and C or D
A= $self->can_convert($space_name)B= defined $directionC= $direction eq "from"D= $direction eq "to"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | and defined $direction and ($direction eq 'from' or $direction eq 'to'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 848 | return @{$self->{'convert'}{ $space_name }{'normal'}{$direction}}{'in', 'out'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 49 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||