« blib/lib/PMLTQ/Relation/ChildnodeIterator.pm
↑ Summary
blib/lib/PMLTQ/Relation/CurrentTreeIterator.pm »
| 1 | package PMLTQ::Relation::DescendantIterator; | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 12 | our $AUTHORITY = 'cpan:MATY'; | |||||||||||||||||||||||||||||||||||||||||||||
| 3 | 12 | $PMLTQ::Relation::DescendantIterator::VERSION = '1.2.2'; | |||||||||||||||||||||||||||||||||||||||||||||
| 4 | # ABSTRACT: Iterates over descendant nodes | ||||||||||||||||||||||||||||||||||||||||||||||
| 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::Iterator); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 12 | ▶ | use constant CONDITIONS=>0; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 12 | ▶ | use constant NODE=>1; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 12 | ▶ | use constant TOP=>2; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 12 | ▶ | use constant FILE=>3; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||
| 16 | sub start { | ||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | ▶ | my ($self,$parent,$fsfile)=@_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | ▶ | if ($fsfile) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | $self->[FILE]=$fsfile; | |||||||||||||||||||||||||||||||||||||||||||||
| 20 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | $fsfile=$self->[FILE]; | |||||||||||||||||||||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | my $n= $parent->firstson; | |||||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | $self->[NODE]=$n; | |||||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | $self->[TOP]=$parent; | |||||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | return ($n && $self->[CONDITIONS]->($n,$fsfile)) ? $n : ($n && $self->next); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$n and $self->[0]->($n, $fsfile)
$n and $self->next
MC/DC0%0/2
$n and $self->[0]->($n, $fsfile)
$n
$self->[0]->($n, $fsfile)
MC/DC0%0/2
$n and $self->next
$n
$self->next
Truth table0%0/3
A and B
A= $nB= $self->[0]->($n, $fsfile)
Truth table0%0/3
A and B
A= $nB= $self->next
| |||||||||||||||||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 28 | sub next { | ||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | ▶ | my ($self)=@_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | my $conditions=$self->[CONDITIONS]; | |||||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | my $top = $self->[TOP]; | |||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | my $n=$self->[NODE]->following($top); | |||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | my $fsfile=$self->[FILE]; | |||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | $n=$n->following($top) while ($n and !$conditions->($n,$fsfile)); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$n and not &$conditions($n, $fsfile)
MC/DC0%0/2
$n and not &$conditions($n, $fsfile)
$n
not &$conditions($n, $fsfile)
Truth table0%0/3
A and not(B)
A= $nB= not &$conditions($n, $fsfile)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | return $self->[NODE]=$n; | |||||||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 37 | sub node { | ||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | ▶ | return $_[0]->[NODE]; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
node: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 40 | sub file { | ||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | return $_[0]->[FILE]; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
file: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 43 | sub reset { | ||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | my ($self)=@_; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reset: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | $self->[NODE]=undef; | |||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | $self->[TOP]=undef; | |||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | $self->[FILE]=undef; | |||||||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 12 | 1; # End of PMLTQ::Relation::DescendantIterator | |||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||
| 52 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||