blib/lib/PMLTQ/Relation/PMLREFIterator.pm

filter: Statementstmt 42.8% 21 / 49 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 24 MC/DCmcdc 0.0% 0 / 15 Subroutinesub 66.6% 6 / 9 Podpod 0.0% 0 / 3 totaltotal 24.1% 27 / 112 CC 15 SCAR 46.5
CC
15
Cov
25%
get_node_list
182.0
new
12.0
clone
2.0
CRAP 104.8
« blib/lib/PMLTQ/Relation/TreexFilelistIterator.pm ↑ Summary blib/lib/PMLTQ/Relation/CurrentFilelistTreesIterator.pm »
1 package PMLTQ::Relation::PMLREFIterator;
2 12 our $AUTHORITY = 'cpan:MATY';
3 12 $PMLTQ::Relation::PMLREFIterator::VERSION = '1.2.2';
4 # ABSTRACT: Iterates over PML reference
5  
6 12 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 12 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 12 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 12 ▶use base qw(PMLTQ::Relation::SimpleListIterator);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 12 ▶use constant ATTR => PMLTQ::Relation::SimpleListIterator::FIRST_FREE;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 12 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 12 my $can_open_secondary = exists(&TredMacro::OpenSecondaryFiles);
15  
16 sub new {
17 0 ▶ my ($class,$conditions,$attr)=@_;
Subroutine new: not called CC=3 SCAR=24.8
Pod undocumented
18 0 ▶ croak "usage: $class->new(sub{...},\$attr)" unless (ref($conditions) eq 'CODE' and defined $attr);
Branch: 1 branch
BranchTrueFalseTotal
unless ref $conditions eq "CODE" and defined $attr 0 0 0
Condition0%0/3
ref $conditions eq "CODE" and defined $attr
!ll&&!rl&&r
000
MC/DC0%0/2
ref $conditions eq "CODE" and defined $attr
ref $conditions eq "CODE" defined $attr
Truth table0%0/3
A and B
A= ref $conditions eq "CODE"B= defined $attr
ABresult
0X0
100
111
19 0 my $self = PMLTQ::Relation::SimpleListIterator->new($conditions);
20 0 $self->[ATTR]=$attr;
21 0 bless $self, $class; # reblessing
22 0 return $self;
23 }
24 sub clone {
25 0 ▶ my ($self)=@_;
Subroutine clone: not called CC=1 SCAR=6.9
Pod undocumented
26 0 my $clone = $self->PMLTQ::Relation::SimpleListIterator::clone();
27 0 $clone->[ATTR]=$self->[ATTR];
28 0 return $clone;
29 }
30 sub get_node_list {
31 0 ▶ my ($self,$node)=@_;
Subroutine get_node_list: not called CC=13 SCAR=52.0
Pod undocumented
32 0 my $fsfile = $self->[PMLTQ::Relation::SimpleListIterator::FILE];
33 return [map {
34 0 my $id = $_;
35 0 ▶ if ($id=~s{^(.*)?#}{} and defined($1) and length($1)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($id =~ s/^(.*)?#// and defined $1 and length $1) { } 0 0 0
Condition0%0/6
$id =~ s/^(.*)?#// and defined $1 and length $1
!ll&&!rl&&r
000
$id =~ s/^(.*)?#// and defined $1
!ll&&!rl&&r
000
MC/DC0%0/3
$id =~ s/^(.*)?#// and defined $1 and length $1
$id =~ s/^(.*)?#// defined $1 length $1
Truth table0%0/4
A and B and C
A= $id =~ s/^(.*)?#//B= defined $1C= length $1
ABCresult
0XX0
10X0
1100
1111
36 0 ▶ unless (ref $fsfile) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $fsfile) 0 0 0
37 0 Carp::confess("No fsfile!");
38 }
39 0 my $refs = $fsfile->appData('ref');
40 0 ▶ my $ref_fs = $refs && $refs->{$1};
Condition0%0/3
$refs && $refs->{$1}
!ll&&!rl&&r
000
MC/DC0%0/2
$refs && $refs->{$1}
$refs $refs->{$1}
Truth table0%0/3
A && B
A= $refsB= $refs->{$1}
ABresult
0X0
100
111
41 0 ▶ if (!$ref_fs and $can_open_secondary) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $ref_fs and $can_open_secondary) 0 0 0
Condition0%0/3
not $ref_fs and $can_open_secondary
!ll&&!rl&&r
000
MC/DC0%0/2
not $ref_fs and $can_open_secondary
not $ref_fs $can_open_secondary
Truth table0%0/3
not(A) and B
A= not $ref_fsB= $can_open_secondary
ABresult
0X0
100
111
42 0 TredMacro::OpenSecondaryFiles($fsfile);
43 0 $refs = $fsfile->appData('ref');
44 0 ▶ $ref_fs = $refs && $refs->{$1};
Condition0%0/3
$refs && $refs->{$1}
!ll&&!rl&&r
000
MC/DC0%0/2
$refs && $refs->{$1}
$refs $refs->{$1}
Truth table0%0/3
A && B
A= $refsB= $refs->{$1}
ABresult
0X0
100
111
45 }
46 0 ▶ my $n = $ref_fs && PML::GetNodeByID($id,$ref_fs);
Condition0%0/3
$ref_fs && PML::GetNodeByID($id, $ref_fs)
!ll&&!rl&&r
000
MC/DC0%0/2
$ref_fs && PML::GetNodeByID($id, $ref_fs)
$ref_fs PML::GetNodeByID($id, $ref_fs)
Truth table0%0/3
A && B
A= $ref_fsB= PML::GetNodeByID($id, $ref_fs)
ABresult
0X0
100
111
47 0 ▶ $ref_fs && $n ? [$n, $ref_fs] : ();
Branch: 1 branch
BranchTrueFalseTotal
$ref_fs && $n ? : 0 0 0
Condition0%0/3
$ref_fs and $n
!ll&&!rl&&r
000
MC/DC0%0/2
$ref_fs and $n
$ref_fs $n
Truth table0%0/3
A and B
A= $ref_fsB= $n
ABresult
0X0
100
111
48 } else {
49 0 my $n = PML::GetNodeByID($id,$fsfile);
50 0 ▶ $n ? [$n, $fsfile] : ()
Branch: 1 branch
BranchTrueFalseTotal
$n ? : 0 0 0
51 }
52 0 } grep { defined } Treex::PML::Instance::get_all($node,$self->[ATTR])];
53 }
54  
55 12 1; # End of PMLTQ::Relation::PMLREFIterator
56  
57 __END__
« blib/lib/PMLTQ/Relation/TreexFilelistIterator.pm ↑ Summary blib/lib/PMLTQ/Relation/CurrentFilelistTreesIterator.pm »