| 1 | # -*- mode: perl; coding: utf-8 -*- | ||||||||||||||||||||||||||||||||||||||||||
| 2 | package YATT::LRXML::NodeCursor; # Location, Zipper? | ||||||||||||||||||||||||||||||||||||||||||
| 3 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 6 | ▶ | use warnings qw(FATAL all NONFATAL misc); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 6 | ▶ | use base qw(YATT::Class::Configurable); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 6 | ▶ | use YATT::Fields qw(^tree ^cf_metainfo cf_path); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | sub Path () {'YATT::LRXML::NodeCursor::Path'} | ||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 6 | ▶ | use YATT::Util::Symbol; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 6 | ▶ | use YATT::LRXML::Node qw(stringify_node | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | stringify_attlist | ||||||||||||||||||||||||||||||||||||||||||
| 13 | create_node | ||||||||||||||||||||||||||||||||||||||||||
| 14 | create_node_from | ||||||||||||||||||||||||||||||||||||||||||
| 15 | 6 | copy_array); | |||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | 6 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | # XXX: Configurable に init と clone のプロトコルを…って、 | ||||||||||||||||||||||||||||||||||||||||||
| 20 | # fields の中身に依存するから、やばいか。 | ||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||
| 23 | package YATT::LRXML::NodeCursor::Path; | ||||||||||||||||||||||||||||||||||||||||||
| 24 | 6 | ▶ | use base qw(YATT::Class::ArrayScanner); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | 6 | ▶ | use YATT::Fields qw(cf_path cur_postype prev_postype); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | 6 | ▶ | use YATT::LRXML::Node qw(node_type ATTRIBUTE_TYPE); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | 6 | ▶ | use YATT::Util::Enum -prefix => 'POSTYPE_', qw(UNKNOWN ATTLIST BODY); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 1519 | ▶ | sub init { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 1519 | my ($self, $array, $path, $index0) = splice @_, 0, 4; | |||||||||||||||||||||||||||||||||||||||||
| 33 | 1519 | ▶ | $self->SUPER::init(array => $array | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$index0 || 0
MC/DC0%0/1
$index0 || 0
$index0
Truth table50%1/2
A
A= $index0
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | , index => ($index0 || 0) | ||||||||||||||||||||||||||||||||||||||||||
| 35 | + YATT::LRXML::Node::_BODY | ||||||||||||||||||||||||||||||||||||||||||
| 36 | , path => $path, @_) | ||||||||||||||||||||||||||||||||||||||||||
| 37 | ->after_next; | ||||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | 11 | ▶ | sub clone { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clone: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | 11 | my MY $orig = shift; | |||||||||||||||||||||||||||||||||||||||||
| 42 | ref($orig)->new($orig->{cf_array}, $orig->{cf_path} | ||||||||||||||||||||||||||||||||||||||||||
| 43 | # XXX: To compensate init() | ||||||||||||||||||||||||||||||||||||||||||
| 44 | 11 | , $orig->{cf_index} - YATT::LRXML::Node::_BODY); | |||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | 204 | ▶ | sub parent { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parent: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | 204 | my MY $path = shift; $path->{cf_path} | |||||||||||||||||||||||||||||||||||||||||
| 49 | 204 | } | |||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | 3307 | ▶ | sub after_next { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
after_next: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | 3307 | (my MY $path) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 53 | return $path unless defined $path->{cf_index} | ||||||||||||||||||||||||||||||||||||||||||
| 54 | 3307 | ▶ | and $path->{cf_index} <= $#{$path->{cf_array}}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $path->{"cf_index"} and $path->{"cf_index"} <= $#{$$path{"cf_array"};}
MC/DC50%1/2
defined $path->{"cf_index"} and $path->{"cf_index"} <= $#{$$path{"cf_array"};}
defined $path->{"cf_index"}
$path->{"cf_index"} <= $#{$$path{"cf_array"};}
Truth table66%2/3
A and B
A= defined $path->{"cf_index"}B= $path->{"cf_index"} <= $#{$$path{"cf_array"};}
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | 2130 | my $val = $path->{cf_array}->[$path->{cf_index}]; | |||||||||||||||||||||||||||||||||||||||||
| 56 | 2130 | $path->{prev_postype} = $path->{cur_postype}; | |||||||||||||||||||||||||||||||||||||||||
| 57 | 2130 | ▶ | if (not defined $path->{cur_postype} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not defined $path->{"cur_postype"} or $path->{"cur_postype"} == 1
MC/DC100%2/2
not defined $path->{"cur_postype"} or $path->{"cur_postype"} == 1
not defined $path->{"cur_postype"}
$path->{"cur_postype"} == 1
Truth table100%3/3
not(A) or B
A= not defined $path->{"cur_postype"}B= $path->{"cur_postype"} == 1
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | or $path->{cur_postype} == POSTYPE_ATTLIST) { | ||||||||||||||||||||||||||||||||||||||||||
| 59 | 1439 | ▶ | $path->{cur_postype} = ref $val && node_type($val) == ATTRIBUTE_TYPE | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
ref $val and node_type($val) == 7
MC/DC100%2/2
ref $val and node_type($val) == 7
ref $val
node_type($val) == 7
Truth table100%3/3
A and B
A= ref $valB= node_type($val) == 7
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | ? POSTYPE_ATTLIST : POSTYPE_BODY; | ||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||
| 62 | $path | ||||||||||||||||||||||||||||||||||||||||||
| 63 | 2130 | } | |||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | 527 | ▶ | sub is_beginning { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_beginning: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 66 | 527 | (my MY $path) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 67 | 527 | ▶ | return 1 unless defined $path->{prev_postype}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | 301 | ▶ | return unless $path->{cur_postype} == POSTYPE_BODY; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | 301 | $path->{prev_postype} == POSTYPE_ATTLIST; | |||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | 1877 | ▶ | sub initargs {qw(tree)} | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
initargs: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | 414 | ▶ | sub new_opened { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new_opened: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | 414 | my ($class, $tree) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||
| 77 | 414 | $class->new($tree, path => $class->Path->new($tree), @_); | |||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | 6 | ▶ | sub new_path { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new_path: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | 6 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 82 | 6 | $self->Path->new($self->{tree}, shift); # XXX: tree でいいの? | |||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | 6 | ▶ | sub clone_path { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clone_path: called CC=3 SCAR=12.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | 6 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 87 | 6 | ▶ | my Path $path = shift || $self->{cf_path}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
shift() || $self->{'cf_path'}
MC/DC0%0/2
shift() || $self->{'cf_path'}
shift()
$self->{'cf_path'}
Truth table33%1/3
A || B
A= shift()B= $self->{'cf_path'}
| |||||||||||||||||||||||||||||||||||||||||||
| 88 | 6 | ▶ | $self->Path->new($path->{cf_array}, $path ? $path->{cf_path} : undef); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | 1286 | ▶ | sub clone { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clone: called CC=3 SCAR=11.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 92 | 1286 | (my MY $self, my ($path)) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 93 | # XXX: 他のパラメータは? 特に、継承先で足したパラメータ。 | ||||||||||||||||||||||||||||||||||||||||||
| 94 | ref($self)->new($self->{tree} | ||||||||||||||||||||||||||||||||||||||||||
| 95 | , metainfo => $self->{cf_metainfo} | ||||||||||||||||||||||||||||||||||||||||||
| 96 | , path => ($path || ($self->{cf_path} ? $self->{cf_path}->clone | ||||||||||||||||||||||||||||||||||||||||||
| 97 | 1286 | ▶ | : undef))); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$path || ($self->{'cf_path'} ? $self->{'cf_path'}->clone : undef)
MC/DC0%0/2
$path || ($self->{'cf_path'} ? $self->{'cf_path'}->clone : undef)
$path
($self->{'cf_path'} ? $self->{'cf_path'}->clone : undef)
Truth table66%2/3
A || B
A= $pathB= ($self->{'cf_path'} ? $self->{'cf_path'}->clone : undef)
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | 252 | ▶ | sub variant_builder { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
variant_builder: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | 252 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 102 | 252 | my Path $orig = $self->{cf_path}; | |||||||||||||||||||||||||||||||||||||||||
| 103 | 252 | my $variant = do { | |||||||||||||||||||||||||||||||||||||||||
| 104 | 252 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | 119 | $self->create_node(@_); | |||||||||||||||||||||||||||||||||||||||||
| 106 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 107 | 133 | $self->create_node_from($orig->{cf_array}); | |||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||
| 109 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 110 | 252 | $self->adopter_for($variant, $orig->{cf_path}); | |||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | 255 | ▶ | sub adopter_for { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
adopter_for: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 114 | 255 | (my MY $self, my ($array, $path)) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 115 | 255 | ▶ | $self->clone($self->Path->new($array, $path || $self->{cf_path})) | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$path || $self->{'cf_path'}
MC/DC0%0/2
$path || $self->{'cf_path'}
$path
$self->{'cf_path'}
Truth table66%2/3
A || B
A= $pathB= $self->{'cf_path'}
| |||||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | 208 | ▶ | sub add_node { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_node: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | 208 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 120 | 208 | my Path $path = $self->{cf_path}; | |||||||||||||||||||||||||||||||||||||||||
| 121 | 208 | push @{$path->{cf_array}}, @_; | |||||||||||||||||||||||||||||||||||||||||
| 122 | 208 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | 4 | ▶ | sub create_attribute { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_attribute: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 126 | 4 | (my MY $self, my ($name)) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||
| 127 | 4 | $self->create_node([attribute => 0], $name, @_); | |||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | 6 | ▶ | sub add_attribute { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_attribute: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | 6 | (my MY $self, my ($name)) = splice @_, 0, 2; | |||||||||||||||||||||||||||||||||||||||||
| 132 | 6 | $self->add_node(my $attr = $self->create_node([attribute => 0], $name, @_)); | |||||||||||||||||||||||||||||||||||||||||
| 133 | 6 | $attr; | |||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | 11 | ▶ | sub add_filtered_copy { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_filtered_copy: called CC=6 SCAR=18.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 137 | 11 | (my MY $self, my ($node, $filter, $primary_only)) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 138 | 11 | ▶ | my $boundary = $primary_only ? 'is_primary_attribute' : 'readable'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | 11 | ▶ | for (; $node->$boundary(); $node->next) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 140 | 19 | my @node = do { | |||||||||||||||||||||||||||||||||||||||||
| 141 | 19 | ▶ | if ($node->is_attribute) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | 18 | ▶ | my ($sub, @rest) = ref $filter eq 'ARRAY' ? @$filter : $filter; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 143 | 18 | $sub->(@rest, $node->node_name, $node->current); | |||||||||||||||||||||||||||||||||||||||||
| 144 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 145 | 1 | copy_array($node->current); | |||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||
| 147 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 148 | 19 | ▶ | $self->add_node(@node) if @node; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||
| 150 | 11 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | sub copy_from { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
copy_from: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | (my MY $clone, my MY $orig) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | for (my $n = $orig->clone; $n->readable; $n->next) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | $clone->add_node(copy_array($n->current)); | |||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | $clone; | |||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | sub clone_filtered_by { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clone_filtered_by: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | my MY $orig = shift; | |||||||||||||||||||||||||||||||||||||||||
| 163 | # XXX: $orig を next してしまって、良いのか? clone した方が良いかも? | ||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | my MY $clone = $orig->variant_builder; | |||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | my ($hash, $all) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | my $boundary = $all ? 'readable' : 'is_primary_attribute'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | for (; $orig->$boundary(); $orig->next) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | my @name; | |||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | ▶ | if ($orig->is_attribute and @name = $orig->node_path | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$orig->is_attribute and @name = $orig->node_path and $$hash{$name[0]}
$orig->is_attribute and @name = $orig->node_path
MC/DC0%0/3
$orig->is_attribute and @name = $orig->node_path and $$hash{$name[0]}
$orig->is_attribute
@name = $orig->node_path
$$hash{$name[0]}
Truth table0%0/4
A and B and C
A= $orig->is_attributeB= @name = $orig->node_pathC= $$hash{$name[0]}
| |||||||||||||||||||||||||||||||||||||||||||
| 170 | and $hash->{$name[0]}) { | ||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | ${$hash->{$name[0]}} = $orig->current; | |||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | $clone->add_node(copy_array($orig->current)); | |||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | $clone; | |||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | ▶ | sub copy { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
copy: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | (my MY $self, my ($node)) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | copy_array($node); | |||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | ▶ | sub copy_renamed { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
copy_renamed: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | (my MY $self, my ($name, $node)) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | if (defined $name) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | $self->create_node_from | |||||||||||||||||||||||||||||||||||||||||
| 188 | ($node, $name, copy_array(YATT::LRXML::Node::node_children($node))); | ||||||||||||||||||||||||||||||||||||||||||
| 189 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | copy_array($node); | |||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||
| 194 | 10 | ▶ | sub make_wrapped { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_wrapped: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 195 | 10 | (my MY $self, my ($type, $name)) = splice @_, 0, 3; | |||||||||||||||||||||||||||||||||||||||||
| 196 | 10 | my Path $orig = $self->{cf_path}; | |||||||||||||||||||||||||||||||||||||||||
| 197 | 10 | ▶ | my $wrap = $self->create_node($type || 'unknown', $name, $orig->{cf_array}); | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$type || 'unknown'
MC/DC0%0/1
$type || 'unknown'
$type
Truth table50%1/2
A
A= $type
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | 10 | my $path = $self->Path->new($wrap, $orig); | |||||||||||||||||||||||||||||||||||||||||
| 199 | ref($self)->new($self->{tree} | ||||||||||||||||||||||||||||||||||||||||||
| 200 | , metainfo => $self->{cf_metainfo} | ||||||||||||||||||||||||||||||||||||||||||
| 201 | 10 | , path => $path); | |||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | 119 | ▶ | sub filter_or_add_from { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
filter_or_add_from: called CC=8 SCAR=20.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 205 | 119 | (my MY $self, my ($node, $except, %opts)) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 206 | my $boundary = delete $opts{primary_only} | ||||||||||||||||||||||||||||||||||||||||||
| 207 | 119 | ▶ | ? 'is_primary_attribute' : 'readable'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | 119 | ▶ | croak "Invalid option: " . join(",", keys %opts) if %opts; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | 119 | my ($name, @filtered); | |||||||||||||||||||||||||||||||||||||||||
| 211 | 119 | ▶ | for (; $node->$boundary(); $node->next) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 212 | 109 | ▶ | if ($node->is_attribute | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$node->is_attribute and defined($name = $node->node_name) and exists $except->{$name}
$node->is_attribute and defined($name = $node->node_name)
MC/DC100%3/3
$node->is_attribute and defined($name = $node->node_name) and exists $except->{$name}
$node->is_attribute
defined($name = $node->node_name)
exists $except->{$name}
Truth table100%4/4
A and B and C
A= $node->is_attributeB= defined($name = $node->node_name)C= exists $except->{$name}
| |||||||||||||||||||||||||||||||||||||||||||
| 213 | and defined ($name = $node->node_name) | ||||||||||||||||||||||||||||||||||||||||||
| 214 | and exists $except->{$name}) { | ||||||||||||||||||||||||||||||||||||||||||
| 215 | # clone は? | ||||||||||||||||||||||||||||||||||||||||||
| 216 | # name を書き換えても良いのでは? | ||||||||||||||||||||||||||||||||||||||||||
| 217 | 7 | my $cur = $node->current; | |||||||||||||||||||||||||||||||||||||||||
| 218 | 7 | push @filtered, do { | |||||||||||||||||||||||||||||||||||||||||
| 219 | 7 | ▶ | if (defined $except->{$name}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | $self->copy_renamed($cur, $except->{$name}); | |||||||||||||||||||||||||||||||||||||||||
| 221 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 222 | 7 | $cur | |||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||
| 224 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 225 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 226 | 102 | $self->add_node($node->current); | |||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||
| 230 | 119 | @filtered; | |||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | 597 | ▶ | sub open { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
open: called CC=4 SCAR=15.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 234 | 597 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 235 | 597 | my $obj; | |||||||||||||||||||||||||||||||||||||||||
| 236 | 597 | ▶ | unless (defined (my Path $path = $self->{cf_path})) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 237 | 6 | $self->clone($self->new_path); | |||||||||||||||||||||||||||||||||||||||||
| 238 | ▶ | } elsif (not defined ($obj = $path->{cf_array}->[$path->{cf_index}]) | |||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
not defined($obj = $path->{"cf_array"}[$path->{"cf_index"}]) or ref $obj ne "ARRAY"
MC/DC0%0/2
not defined($obj = $path->{"cf_array"}[$path->{"cf_index"}]) or ref $obj ne "ARRAY"
not defined($obj = $path->{"cf_array"}[$path->{"cf_index"}])
ref $obj ne "ARRAY"
Truth table33%1/3
not(A) or B
A= not defined($obj = $path->{"cf_array"}[$path->{"cf_index"}])B= ref $obj ne "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||
| 239 | or ref $obj ne 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | $obj; | |||||||||||||||||||||||||||||||||||||||||
| 241 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 242 | # 本当に clone が良いのだろうか? | ||||||||||||||||||||||||||||||||||||||||||
| 243 | 591 | $self->clone($self->Path->new($obj, $path)); | |||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||
| 247 | # cursor 本体ではなく、path だけが欲しいときのために。 | ||||||||||||||||||||||||||||||||||||||||||
| 248 | # ← open をカスタマイズしたい時に用いる。 | ||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | ▶ | sub open_path { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
open_path: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | ▶ | unless (defined (my Path $path = $self->{cf_path})) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | $self->new_path; | |||||||||||||||||||||||||||||||||||||||||
| 253 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | my $obj = $path->{cf_array}->[$path->{cf_index}]; | |||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | ▶ | die "Not an object!" unless defined $obj && ref $obj eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $obj and ref $obj eq "ARRAY"
MC/DC0%0/2
defined $obj and ref $obj eq "ARRAY"
defined $obj
ref $obj eq "ARRAY"
Truth table0%0/3
A and B
A= defined $objB= ref $obj eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | $self->Path->new($obj, $path); | |||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||
| 260 | 6 | ▶ | sub can_open { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
can_open: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 261 | 6 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 262 | 6 | my Path $path = $self->{cf_path}; | |||||||||||||||||||||||||||||||||||||||||
| 263 | 6 | my $obj = $path->{cf_array}->[$path->{cf_index}]; | |||||||||||||||||||||||||||||||||||||||||
| 264 | 6 | ▶ | defined $obj && ref $obj eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||
| 267 | 3 | ▶ | sub close { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
close: called CC=2 SCAR=7.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 268 | 3 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 269 | 3 | ▶ | if (my Path $parent = $self->{cf_path}->parent) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 270 | 3 | $parent->{cf_index}++; | |||||||||||||||||||||||||||||||||||||||||
| 271 | 3 | $self->clone($parent); | |||||||||||||||||||||||||||||||||||||||||
| 272 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 273 | return | ||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | } | |||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||
| 277 | 201 | ▶ | sub parent { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parent: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 278 | 201 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 279 | 201 | $self->clone($self->{cf_path}->parent); | |||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||
| 282 | 3 | ▶ | sub can_close { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
can_close: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 283 | 3 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 284 | 3 | defined $self->{cf_path}; | |||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | 6 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||
| 288 | 6 | my @delegate_to_path = | |||||||||||||||||||||||||||||||||||||||||
| 289 | qw(read | ||||||||||||||||||||||||||||||||||||||||||
| 290 | current | ||||||||||||||||||||||||||||||||||||||||||
| 291 | next | ||||||||||||||||||||||||||||||||||||||||||
| 292 | prev | ||||||||||||||||||||||||||||||||||||||||||
| 293 | array | ||||||||||||||||||||||||||||||||||||||||||
| 294 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 295 | 6 | foreach my $meth (@delegate_to_path) { | |||||||||||||||||||||||||||||||||||||||||
| 296 | 30 | ▶ | *{globref(__PACKAGE__, $meth)} = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||
| 297 | 7394 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 298 | 7394 | ▶ | return unless defined $self->{cf_path}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 299 | 7394 | $self->{cf_path}->$meth(@_); | |||||||||||||||||||||||||||||||||||||||||
| 300 | 30 | }; | |||||||||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||
| 303 | 6 | my @delegate_and_self = qw(go_next); | |||||||||||||||||||||||||||||||||||||||||
| 304 | 6 | foreach my $meth (@delegate_and_self) { | |||||||||||||||||||||||||||||||||||||||||
| 305 | 6 | ▶ | *{globref(__PACKAGE__, $meth)} = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||
| 306 | 89 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 307 | 89 | ▶ | return unless defined $self->{cf_path}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 308 | 89 | $self->{cf_path}->$meth(@_); | |||||||||||||||||||||||||||||||||||||||||
| 309 | 89 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 310 | 6 | }; | |||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||
| 313 | 6 | foreach my $meth (grep {/^(node|is)_/} YATT::LRXML::Node->exports) { | |||||||||||||||||||||||||||||||||||||||||
| 314 | 6 | ▶ | my $for_text = do {no strict 'refs'; \&{"text_$meth"}}; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 315 | 132 | my $sub = YATT::LRXML::Node->can($meth); | |||||||||||||||||||||||||||||||||||||||||
| 316 | 132 | ▶ | *{globref(__PACKAGE__, $meth)} = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 317 | 4893 | my MY $cursor = shift; | |||||||||||||||||||||||||||||||||||||||||
| 318 | 4893 | ▶ | return unless $cursor->readable; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 319 | 4809 | ▶ | if (ref(my $value = $cursor->current)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 320 | 4015 | $sub->($value, @_); | |||||||||||||||||||||||||||||||||||||||||
| 321 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 322 | 794 | $for_text->($value, @_); | |||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||
| 324 | 132 | }; | |||||||||||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||
| 327 | 6 | foreach my $meth (my @delegate_to_meta = qw(filename)) { | |||||||||||||||||||||||||||||||||||||||||
| 328 | 6 | ▶ | *{globref(__PACKAGE__, $meth)} = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||
| 329 | 18 | my MY $cursor = shift; | |||||||||||||||||||||||||||||||||||||||||
| 330 | defined (my $meta = $cursor->{cf_metainfo}) | ||||||||||||||||||||||||||||||||||||||||||
| 331 | 18 | ▶ | or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 332 | 18 | $meta->$meth(@_); | |||||||||||||||||||||||||||||||||||||||||
| 333 | 6 | }; | |||||||||||||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | sub rewind { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rewind: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | ▶ | if (my Path $path = $self->{cf_path}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | $path->{cf_index} = YATT::LRXML::Node::_BODY; | |||||||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||||||||
| 342 | $self | ||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | } | |||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||
| 345 | 7296 | ▶ | sub readable { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
readable: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 346 | 7296 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 347 | 7296 | ▶ | defined $self->{cf_path} && $self->{cf_path}->readable; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||
| 350 | # value, size は全体。 | ||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | ▶ | sub value { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
value: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | ▶ | unless (defined $self->{cf_path}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 354 | $self->{tree} | ||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | } else { | |||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | $self->{cf_path}->value; | |||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||
| 360 | 156 | ▶ | sub array_size { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
array_size: called CC=2 SCAR=7.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 361 | 156 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 362 | 156 | YATT::LRXML::Node::node_size(do { | |||||||||||||||||||||||||||||||||||||||||
| 363 | 156 | ▶ | unless (defined (my Path $path = $self->{cf_path})) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | $self->{tree}; | |||||||||||||||||||||||||||||||||||||||||
| 365 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 366 | 156 | $path->{cf_array}; | |||||||||||||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||||||||||||
| 368 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 369 | } | ||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||
| 371 | 8 | ▶ | sub size { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
size: called CC=4 SCAR=15.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 372 | 8 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 373 | 8 | ▶ | unless (defined (my Path $path = $self->{cf_path})) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 374 | 6 | YATT::LRXML::Node::node_size($self->{tree}); | |||||||||||||||||||||||||||||||||||||||||
| 375 | } elsif (not defined (my $obj = $path->{cf_array}->[$path->{cf_index}])) { | ||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | 0 | |||||||||||||||||||||||||||||||||||||||||
| 377 | } elsif (ref $obj) { | ||||||||||||||||||||||||||||||||||||||||||
| 378 | 2 | YATT::LRXML::Node::node_size($obj); | |||||||||||||||||||||||||||||||||||||||||
| 379 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||
| 384 | 211 | ▶ | sub has_parent { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_parent: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 385 | 211 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 386 | 211 | ▶ | defined (my Path $path = $self->{cf_path}) or return 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 387 | $path->{cf_path} | ||||||||||||||||||||||||||||||||||||||||||
| 388 | 211 | } | |||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | ▶ | sub depth { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
depth: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | my $depth = 0; | |||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | ▶ | while (defined (my Path $path = $self->{cf_path})) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | $depth++; | |||||||||||||||||||||||||||||||||||||||||
| 395 | } | ||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | $depth; | |||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||
| 399 | 222 | ▶ | sub startline { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
startline: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 400 | 222 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 401 | 222 | $self->metainfo->cget('startline'); | |||||||||||||||||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||
| 404 | 222 | ▶ | sub linenum { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
linenum: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 405 | 222 | (my MY $self, my ($offset_atstart)) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 406 | 222 | my $linenum = $self->startline; | |||||||||||||||||||||||||||||||||||||||||
| 407 | 222 | my Path $path = $self->{cf_path}; | |||||||||||||||||||||||||||||||||||||||||
| 408 | 222 | my $offset = $offset_atstart; | |||||||||||||||||||||||||||||||||||||||||
| 409 | 222 | ▶ | while ($path) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 410 | $linenum += $self->count_lines_of(map { | ||||||||||||||||||||||||||||||||||||||||||
| 411 | 374 | ▶ | $path->{cf_array}[$_] | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$offset || 0
MC/DC100%1/1
$offset || 0
$offset
Truth table100%2/2
A
A= $offset
| |||||||||||||||||||||||||||||||||||||||||||
| 412 | 404 | } YATT::LRXML::Node::_BODY .. $path->{cf_index} - 1 + ($offset || 0)); | |||||||||||||||||||||||||||||||||||||||||
| 413 | 404 | $path = $path->{cf_path}; | |||||||||||||||||||||||||||||||||||||||||
| 414 | 404 | undef $offset; | |||||||||||||||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||||||||||||||||
| 416 | 222 | $linenum; | |||||||||||||||||||||||||||||||||||||||||
| 417 | } | ||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||
| 419 | 484 | ▶ | sub count_lines_of { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
count_lines_of: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 420 | # XXX: 他でも使うように。 | ||||||||||||||||||||||||||||||||||||||||||
| 421 | 484 | my ($pack) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 422 | 484 | my $sum = 0; | |||||||||||||||||||||||||||||||||||||||||
| 423 | 484 | foreach my $item (@_) { | |||||||||||||||||||||||||||||||||||||||||
| 424 | 466 | ▶ | next unless defined $item; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 425 | 463 | $sum += do { | |||||||||||||||||||||||||||||||||||||||||
| 426 | 463 | ▶ | if (ref $item) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 427 | 152 | YATT::LRXML::Node::node_nlines($item); | |||||||||||||||||||||||||||||||||||||||||
| 428 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 429 | 311 | $item =~ tr:\n::; | |||||||||||||||||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||||||||||||||||
| 431 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||||||||||||||||
| 433 | 484 | $sum; | |||||||||||||||||||||||||||||||||||||||||
| 434 | } | ||||||||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||||||
| 436 | 527 | ▶ | sub node_is_beginning { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
node_is_beginning: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 437 | 527 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 438 | 527 | ▶ | my Path $path = $self->{cf_path} or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 439 | 527 | $path->is_beginning; | |||||||||||||||||||||||||||||||||||||||||
| 440 | } | ||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||
| 442 | 294 | ▶ | sub node_is_end { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
node_is_end: called CC=3 SCAR=11.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 443 | 294 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 444 | 294 | ▶ | my Path $path = $self->{cf_path} or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 445 | 294 | ▶ | defined $path->{cf_index} or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 446 | 294 | $path->{cf_index} >= $#{$path->{cf_array}}; | |||||||||||||||||||||||||||||||||||||||||
| 447 | } | ||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||
| 449 | 6 | *stringify = *stringify_current; *stringify = *stringify_current; | |||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||
| 451 | 28 | ▶ | sub stringify_current { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stringify_current: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 452 | 28 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 453 | 28 | my Path $path = $self->{cf_path}; | |||||||||||||||||||||||||||||||||||||||||
| 454 | 28 | ▶ | unless (defined $path) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 455 | 9 | stringify_node($self->{tree}); | |||||||||||||||||||||||||||||||||||||||||
| 456 | } elsif (ref (my $value = $path->current)) { | ||||||||||||||||||||||||||||||||||||||||||
| 457 | 19 | stringify_node($value); | |||||||||||||||||||||||||||||||||||||||||
| 458 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | $value; | |||||||||||||||||||||||||||||||||||||||||
| 460 | } | ||||||||||||||||||||||||||||||||||||||||||
| 461 | } | ||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | ▶ | sub stringify_all { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stringify_all: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | my Path $path = $self->{cf_path}; | |||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | ▶ | unless (defined $path) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | stringify_node($self->{tree}); | |||||||||||||||||||||||||||||||||||||||||
| 468 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | stringify_node($path->{cf_array}); | |||||||||||||||||||||||||||||||||||||||||
| 470 | } | ||||||||||||||||||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||
| 473 | 6 | ▶ | sub path_list { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
path_list: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 474 | 6 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 475 | 6 | my @path; | |||||||||||||||||||||||||||||||||||||||||
| 476 | 6 | ▶ | if (my Path $path = $self->{cf_path}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 477 | # XXX: 一、ずれてるじゃん、と。引くの? | ||||||||||||||||||||||||||||||||||||||||||
| 478 | 6 | ▶ | do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 479 | 8 | unshift @path, $path->{cf_index} - YATT::LRXML::Node::_BODY; | |||||||||||||||||||||||||||||||||||||||||
| 480 | 8 | $path = $path->{cf_path}; | |||||||||||||||||||||||||||||||||||||||||
| 481 | } while $path; | ||||||||||||||||||||||||||||||||||||||||||
| 482 | } | ||||||||||||||||||||||||||||||||||||||||||
| 483 | 6 | ▶ | wantarray ? @path : join ", ", @path; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 484 | } | ||||||||||||||||||||||||||||||||||||||||||
| 485 | |||||||||||||||||||||||||||||||||||||||||||
| 486 | 239 | ▶ | sub parse_typespec { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_typespec: called CC=7 SCAR=19.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 487 | 239 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 488 | 239 | my ($head, @rest) = $self->node_children; | |||||||||||||||||||||||||||||||||||||||||
| 489 | 239 | ▶ | unless (defined $head) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 490 | () | ||||||||||||||||||||||||||||||||||||||||||
| 491 | 130 | } elsif ($head =~ s{^(\w+((?:\:\w+)*))?(?:([|/?!])(.*))?}{}s) { | |||||||||||||||||||||||||||||||||||||||||
| 492 | # $1 can undef. | ||||||||||||||||||||||||||||||||||||||||||
| 493 | 109 | ▶ | ($1 && $2 ? [split /:/, $1] : $1 | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition100%3/3
$1 and $2
MC/DC100%2/2
$1 and $2
$1
$2
Truth table100%3/3
A and B
A= $1B= $2
| |||||||||||||||||||||||||||||||||||||||||||
| 494 | , default => @rest ? [defined $4 ? ($4) : (), @rest] : $4 | ||||||||||||||||||||||||||||||||||||||||||
| 495 | , default_mode => $3) | ||||||||||||||||||||||||||||||||||||||||||
| 496 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | (undef); | |||||||||||||||||||||||||||||||||||||||||
| 498 | } | ||||||||||||||||||||||||||||||||||||||||||
| 499 | } | ||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||
| 501 | 6 | ▶ | sub next_is_body { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next_is_body: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 502 | 6 | my MY $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 503 | 6 | ▶ | my Path $path = $self->{cf_path} or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 504 | 6 | my $next = $path->{cf_index} + 1; | |||||||||||||||||||||||||||||||||||||||||
| 505 | 6 | ▶ | return if $next >= @{$path->{cf_array}}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 506 | 2 | my $item = $path->{cf_array}[$next]; | |||||||||||||||||||||||||||||||||||||||||
| 507 | 2 | ▶ | return unless defined $item; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 508 | 2 | ▶ | return 1 unless ref $item; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 509 | 1 | not YATT::LRXML::Node::is_primary_attribute($item); | |||||||||||||||||||||||||||||||||||||||||
| 510 | } | ||||||||||||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||||||||||||
| 512 | 74 | ▶ | sub text_is_attribute { 0 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
text_is_attribute: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 513 | 0 | ▶ | sub text_is_bare_attribute { 0 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
text_is_bare_attribute: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 514 | 46 | ▶ | sub text_is_primary_attribute { 0 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
text_is_primary_attribute: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | ▶ | sub text_is_quoted_by_element { 0 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
text_is_quoted_by_element: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 516 | 0 | ▶ | sub text_node_size { 1 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
text_node_size: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 517 | 123 | ▶ | sub text_node_type { YATT::LRXML::Node::TEXT_TYPE } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
text_node_type: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 518 | 3 | ▶ | sub text_node_body { shift } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
text_node_body: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 519 | 548 | ▶ | sub text_node_type_name { 'text' } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
text_node_type_name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | ▶ | sub text_node_flag { 0 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
text_node_flag: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 521 | 0 | ▶ | sub text_node_name { undef } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
text_node_name: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | ▶ | sub text_node_children { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
text_node_children: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 523 | 0 | ▶ | if (ref $_[0]) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | YATT::LRXML::Node::node_children($_[0]) | |||||||||||||||||||||||||||||||||||||||||
| 525 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 526 | 0 | $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 527 | } | ||||||||||||||||||||||||||||||||||||||||||
| 528 | } | ||||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||
| 530 | 6 | 1; | |||||||||||||||||||||||||||||||||||||||||