blib/lib/PMLTQ/Relation/Treex/AEParentIterator.pm

filter: Statementstmt 65.6% 21 / 32 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 75.0% 6 / 8 Podpod 0.0% 0 / 2 totaltotal 55.1% 27 / 49 CC 6 SCAR 30.0
CC
6
Cov
55%
dump_relation
42.0
get_node_list
2.0
BEGIN
1.0
CRAP 20.0
« blib/lib/PMLTQ/Relation/Treex/AEParentCIterator.pm ↑ Summary blib/lib/PMLTQ/Relation/SameTreeIterator.pm »
1 package PMLTQ::Relation::Treex::AEParentIterator;
2 11 our $AUTHORITY = 'cpan:MATY';
3 11 $PMLTQ::Relation::Treex::AEParentIterator::VERSION = '1.2.2';
4 # ABSTRACT: Effective parent relation iterator on a-nodes for Treex treebanks
5  
6 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 11 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 11 ▶use base qw(PMLTQ::Relation::SimpleListIterator);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 11 ▶use PMLTQ::PML2BASE;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 use PMLTQ::Relation {
11 11 name => 'eparent',
12 table_name => 'adata__#eparents',
13 schema => 'treex_document',
14 reversed_relation => 'implementation:echild',
15 start_node_type => 'a-node',
16 target_node_type => 'a-node',
17 iterator_class => __PACKAGE__,
18 test_code => q(grep($_ == $end, PMLTQ::Relation::Treex::AGetEParents($start)) ? 1 : 0),
19 11 ▶};
Subroutine BEGIN: called CC=1 SCAR=0.0
20 11 ▶use PMLTQ::Relation::Treex;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 sub get_node_list {
23 0 ▶ my ( $self, $node ) = @_;
Subroutine get_node_list: not called CC=1 SCAR=6.9
Pod undocumented
24 0 my $fsfile = $self->start_file;
25 0 return [ map [ $_, $fsfile ], PMLTQ::Relation::Treex::AGetEParents($node) ];
26 }
27  
28 sub dump_relation {
29 0 ▶ my ($tree, $hash, $fh ) = @_;
Subroutine dump_relation: not called CC=6 SCAR=37.4
Pod undocumented
30  
31 0 my $name = $tree->type->get_schema->get_root_name;
32 0 ▶ die 'Trying dump relation eparent for incompatible schema' unless $name =~ /^treex_document/;
Branch: 1 branch
BranchTrueFalseTotal
unless $name =~ /^treex_document/ 0 0 0
33  
34 0 ▶ my $struct_name = $tree->type->get_structure_name || '';
Condition0%0/2
$tree->type->get_structure_name || ''
l!l
00
MC/DC0%0/1
$tree->type->get_structure_name || ''
$tree->type->get_structure_name
Truth table0%0/2
A
A= $tree->type->get_structure_name
Aresult
11
00
35 0 ▶ return unless $struct_name eq 'a-root';
Branch: 1 branch
BranchTrueFalseTotal
unless $struct_name eq "a-root" 0 0 0
36  
37 0 for my $node ( $tree->descendants ) {
38 0 for my $p ( PMLTQ::Relation::Treex::AGetEParents($node) ) {
39 0 $fh->print( PMLTQ::PML2BASE::mkdump( $hash->{$node}{'#idx'}, $hash->{$p}{'#idx'} ) );
40 }
41 }
42 }
43  
44 11 1;
45  
46 __END__
« blib/lib/PMLTQ/Relation/Treex/AEParentCIterator.pm ↑ Summary blib/lib/PMLTQ/Relation/SameTreeIterator.pm »