PML/Schema/Member.pm

filter: Statementstmt 89.7% 35 / 39 Branchbran 50.0% 2 / 4 Conditioncond 33.3% 4 / 12 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 81.2% 13 / 16 Podpod 100% 8 / 8 totaltotal 73.8% 62 / 84 CC 7 SCAR 15.1
CC
7
Cov
75%
get_knit_name
11.7
is_atomic
2.0
get_decl_type_str
2.0
CRAP 4.5
« PML/Alt.pm ↑ Summary PML/Seq.pm »
1 package Treex::PML::Schema::Member;
2  
3 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 9 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 9 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
8 9 $VERSION='2.29'; # version template
9 }
10 9 ▶no warnings 'uninitialized';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 9 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 9 ▶use Treex::PML::Schema::Constants;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 9 ▶use base qw( Treex::PML::Schema::Decl );
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16  
17 =head1 NAME
18  
19 Treex::PML::Schema::Member - implements declaration of a member of a structure.
20  
21 =head1 INHERITANCE
22  
23 This class inherits from L<Treex::PML::Schema::Decl>.
24  
25 =head1 METHODS
26  
27 See the super-class for the complete list.
28  
29 =over 3
30  
31 =item $decl->get_decl_type ()
32  
33 Returns the constant PML_MEMBER_DECL.
34  
35 =item $decl->get_decl_type_str ()
36  
37 Returns the string 'member'.
38  
39 =item $decl->get_name ()
40  
41 Return name of the member.
42  
43 =item $decl->is_required ()
44  
45 Return 1 if the member is declared as required, 0 otherwise.
46  
47 =item $decl->is_attribute ()
48  
49 Return 1 if the member is declared as attribute, 0 otherwise.
50  
51 =item $decl->get_parent_struct ()
52  
53 Return the structure declaration the member belongs to.
54  
55 =item $decl->get_knit_name ()
56  
57 Return the member's name with a possible suffix '.rf' chopped-off, if
58 either the member itself has a role '#KNIT' or its content is a list
59 and has a role '#KNIT'. Otherwise return just the member's name.
60  
61 =back
62  
63 =cut
64  
65 0 ▶sub is_atomic { undef }
Subroutine is_atomic: not called CC=1 SCAR=6.9
Pod documented
66 2677 ▶sub get_decl_type { return PML_MEMBER_DECL; }
Subroutine get_decl_type: called CC=1 SCAR=0.0
Pod documented
67 0 ▶sub get_decl_type_str { return 'member'; }
Subroutine get_decl_type_str: not called CC=1 SCAR=6.9
Pod documented
68 1229 ▶sub get_name { return $_[0]->{-name}; }
Subroutine get_name: called CC=1 SCAR=0.0
Pod documented
69 910 ▶sub is_required { return $_[0]->{required}; }
Subroutine is_required: called CC=1 SCAR=0.0
Pod documented
70 115 ▶sub is_attribute { return $_[0]->{as_attribute}; }
Subroutine is_attribute: called CC=1 SCAR=0.0
Pod documented
71 9 *get_parent_struct = \&Treex::PML::Schema::Decl::get_parent_decl;
72  
73 0 ▶sub validate_object {
Subroutine validate_object: not called CC=1 SCAR=6.9
Pod documented
74 0 shift->get_content_decl->validate_object(@_);
75 }
76  
77 7 ▶sub get_knit_name {
Subroutine get_knit_name: called CC=7 SCAR=24.6
Pod documented
78 7 my $self = shift;
79 7 my $name = $self->{-name};
80 7 my $knit_name = $name;
81 7 ▶ if ($knit_name=~s/\.rf$//) {
Branch: 1 branch
BranchTrueFalseTotal
if ($knit_name =~ s/\.rf$//) 7 0 7
82 7 my $cont;
83 7 ▶ if ( $self->{role} eq '#KNIT' or
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"role"} eq "#KNIT" or $cont = $self->get_content_decl and $cont->get_decl_type == 6 || $cont->get_decl_type == 7 and $cont->get_role eq "#KNIT") 7 0 7
Condition33%4/12
$self->{"role"} eq "#KNIT" or $cont = $self->get_content_decl and $cont->get_decl_type == 6 || $cont->get_decl_type == 7 and $cont->get_role eq "#KNIT"
l!l&&r!l&&!r
070
$cont = $self->get_content_decl and $cont->get_decl_type == 6 || $cont->get_decl_type == 7 and $cont->get_role eq "#KNIT"
!ll&&!rl&&r
007
$cont = $self->get_content_decl and $cont->get_decl_type == 6 || $cont->get_decl_type == 7
!ll&&!rl&&r
007
$cont->get_decl_type == 6 or $cont->get_decl_type == 7
l!l&&r!l&&!r
700
MC/DC0%0/5
$self->{"role"} eq "#KNIT" or $cont = $self->get_content_decl and $cont->get_decl_type == 6 || $cont->get_decl_type == 7 and $cont->get_role eq "#KNIT"
$self->{"role"} eq "#KNIT" $cont = $self->get_content_decl $cont->get_decl_type == 6 $cont->get_decl_type == 7 $cont->get_role eq "#KNIT"
Truth table14%1/7
A or B and C or D and E
A= $self->{"role"} eq "#KNIT"B= $cont = $self->get_content_declC= $cont->get_decl_type == 6D= $cont->get_decl_type == 7E= $cont->get_role eq "#KNIT"
ABCDEresult
1XXXX1
011X11
010111
00XXX0
0100X0
011X00
010100
84 (($cont = $self->get_content_decl) and
85 ($cont->get_decl_type == PML_LIST_DECL
86 or
87 $cont->get_decl_type == PML_ALT_DECL)
88 and
89 $cont->get_role eq '#KNIT')) {
90 7 return $knit_name
91 }
92 }
93 0 return $name;
94 }
95  
96  
97 9 1;
98 __END__
« PML/Alt.pm ↑ Summary PML/Seq.pm »