blib/lib/PMLTQ/Relation/Treex/AEParentCIterator.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/SiblingIterator.pm ↑ Summary blib/lib/PMLTQ/Relation/Treex/AEParentIterator.pm »
1 package PMLTQ::Relation::Treex::AEParentCIterator;
2 11 our $AUTHORITY = 'cpan:MATY';
3 11 $PMLTQ::Relation::Treex::AEParentCIterator::VERSION = '1.2.2';
4 # ABSTRACT: Different implementation of effective parent relation iterator on a-nodes for Treex treebanks
5  
6  
7 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 11 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 11 ▶use base qw(PMLTQ::Relation::SimpleListIterator);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 11 ▶use PMLTQ::PML2BASE;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 use PMLTQ::Relation {
12 11 name => 'eparentC',
13 table_name => 'adata__#eparents_c',
14 schema => 'treex_document',
15 reversed_relation => 'implementation:echildC',
16 start_node_type => 'a-node',
17 target_node_type => 'a-node',
18 iterator_class => __PACKAGE__,
19 test_code => q(grep($_ == $end, PMLTQ::Relation::Treex::AGetEParentsC($start)) ? 1 : 0),
20 11 ▶};
Subroutine BEGIN: called CC=1 SCAR=0.0
21 11 ▶use PMLTQ::Relation::Treex;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 sub get_node_list {
24 0 ▶ my ( $self, $node ) = @_;
Subroutine get_node_list: not called CC=1 SCAR=6.9
Pod undocumented
25 0 my $fsfile = $self->start_file;
26 0 return [ map [ $_, $fsfile ], PMLTQ::Relation::Treex::AGetEParentsC($node) ];
27 }
28  
29 sub dump_relation {
30 0 ▶ my ($tree, $hash, $fh ) = @_;
Subroutine dump_relation: not called CC=6 SCAR=37.4
Pod undocumented
31  
32 0 my $name = $tree->type->get_schema->get_root_name;
33 0 ▶ die 'Trying dump relation eparent for incompatible schema' unless $name =~ /^treex_document/;
Branch: 1 branch
BranchTrueFalseTotal
unless $name =~ /^treex_document/ 0 0 0
34  
35 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
36 0 ▶ return unless $struct_name eq 'a-root';
Branch: 1 branch
BranchTrueFalseTotal
unless $struct_name eq "a-root" 0 0 0
37  
38 0 for my $node ( $tree->descendants ) {
39 0 for my $p ( PMLTQ::Relation::Treex::AGetEParentsC($node) ) {
40 0 $fh->print( PMLTQ::PML2BASE::mkdump( $hash->{$node}{'#idx'}, $hash->{$p}{'#idx'} ) );
41 }
42 }
43 }
44  
45 11 1;
46  
47 __END__
« blib/lib/PMLTQ/Relation/SiblingIterator.pm ↑ Summary blib/lib/PMLTQ/Relation/Treex/AEParentIterator.pm »