blib/lib/PMLTQ/Relation/SimpleListIterator.pm

filter: Statementstmt 49.0% 26 / 53 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 15 MC/DCmcdc 0.0% 0 / 10 Subroutinesub 53.3% 8 / 15 Podpod 0.0% 0 / 7 totaltotal 32.6% 34 / 104 CC 8 SCAR 19.5
CC
8
Cov
36%
start
20.0
next
12.0
node
6.0
CRAP 7.0
« blib/lib/PMLTQ/Relation/AncestorIterator.pm ↑ Summary blib/lib/PMLTQ/Relation/TreeIterator.pm »
1 package PMLTQ::Relation::SimpleListIterator;
2 22 our $AUTHORITY = 'cpan:MATY';
3 22 $PMLTQ::Relation::SimpleListIterator::VERSION = '1.2.2';
4 # ABSTRACT: Base class for all iterators that iterates on a list of nodes
5  
6 22 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 22 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 22 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 22 ▶use base qw(PMLTQ::Relation::Iterator);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 22 ▶use constant CONDITIONS=>0;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 22 ▶use constant NODES=>1;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 22 ▶use constant FILE=>2;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 22 ▶use constant FIRST_FREE=>3; # number of the first constant free for user
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 sub start {
17 0 ▶ my ($self,$node,$fsfile)=@_;
Subroutine start: not called CC=4 SCAR=30.0
Pod undocumented
18 0 $self->[FILE]=$fsfile;
19 0 my $nodes = $self->[NODES] = $self->get_node_list($node);
20 0 my $n = $nodes->[0];
21 0 ▶ return ($n && $self->[CONDITIONS]->(@$n)) ? $n->[0] : ($n->[0] && $self->next);
Branch: 1 branch
BranchTrueFalseTotal
$n && $self->[0]->(@$n) ? : 0 0 0
Condition0%0/6
$n and $self->[0]->(@$n)
!ll&&!rl&&r
000
$n->[0] and $self->next
!ll&&!rl&&r
000
MC/DC0%0/2
$n and $self->[0]->(@$n)
$n $self->[0]->(@$n)
MC/DC0%0/2
$n->[0] and $self->next
$n->[0] $self->next
Truth table0%0/3
A and B
A= $nB= $self->[0]->(@$n)
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= $n->[0]B= $self->next
ABresult
0X0
100
111
22 }
23 sub next {
24 0 ▶ my ($self)=@_;
Subroutine next: not called CC=3 SCAR=24.8
Pod undocumented
25 0 my $nodes = $self->[NODES];
26 0 my $conditions=$self->[CONDITIONS];
27 0 shift @{$nodes};
28 0 my $n;
29 0 ▶ while (($n = $nodes->[0]) and !$conditions->(@$n)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($n = $nodes->[0] and not &$conditions(@$n)) 0 0 0
Condition0%0/3
$n = $nodes->[0] and not &$conditions(@$n)
!ll&&!rl&&r
000
MC/DC0%0/2
$n = $nodes->[0] and not &$conditions(@$n)
$n = $nodes->[0] not &$conditions(@$n)
Truth table0%0/3
A and not(B)
A= $n = $nodes->[0]B= not &$conditions(@$n)
ABresult
0X0
100
111
30 0 shift @{$nodes};
31 }
32 0 return $nodes->[0][0];
33 }
34 sub node {
35 0 ▶ my ($self)=@_;
Subroutine node: not called CC=2 SCAR=17.9
Pod undocumented
36 0 my $n = $self->[NODES][0];
37 0 ▶ return $n && $n->[0];
Condition0%0/3
$n && $n->[0]
!ll&&!rl&&r
000
MC/DC0%0/2
$n && $n->[0]
$n $n->[0]
Truth table0%0/3
A && B
A= $nB= $n->[0]
ABresult
0X0
100
111
38 }
39 sub file {
40 0 ▶ my ($self)=@_;
Subroutine file: not called CC=2 SCAR=17.9
Pod undocumented
41 0 my $n = $self->[NODES][0];
42 0 ▶ return $n && $n->[1];
Condition0%0/3
$n && $n->[1]
!ll&&!rl&&r
000
MC/DC0%0/2
$n && $n->[1]
$n $n->[1]
Truth table0%0/3
A && B
A= $nB= $n->[1]
ABresult
0X0
100
111
43 }
44 sub reset {
45 0 ▶ my ($self)=@_;
Subroutine reset: not called CC=1 SCAR=6.9
Pod undocumented
46 0 $self->[NODES]=undef;
47 0 $self->[FILE]=undef;
48 }
49 sub get_node_list {
50 0 ▶ return [];
Subroutine get_node_list: not called CC=1 SCAR=6.9
Pod undocumented
51 }
52 sub start_file {
53 0 ▶ my ($self)=@_;
Subroutine start_file: not called CC=1 SCAR=6.9
Pod undocumented
54 0 return $self->[FILE];
55 }
56  
57 22 1; # End of PMLTQ::Relation::SimpleListIterator
58  
59 __END__
« blib/lib/PMLTQ/Relation/AncestorIterator.pm ↑ Summary blib/lib/PMLTQ/Relation/TreeIterator.pm »