Tools/EUtilities/Info/FieldInfo.pm

filter: Statementstmt 79.5% 39 / 49 Branchbran 66.6% 8 / 12 Conditioncond 46.6% 7 / 15 MC/DCmcdc 20.0% 2 / 10 Subroutinesub 94.1% 16 / 17 Podpod 100% 11 / 11 totaltotal 72.8% 83 / 114 CC 13 SCAR 9.8
CC
13
Cov
71%
to_string
6.0
is_date
3.7
is_singletoken
3.7
CRAP 2.7
« DB/EUtilities.pm ↑ Summary Tools/EUtilities/EUtilDataI.pm »
1 package Bio::Tools::EUtilities::Info::FieldInfo;
2 BEGIN {
3 3 ▶ $Bio::Tools::EUtilities::Info::FieldInfo::AUTHORITY = 'cpan:BIOPERLML';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 }
5 {
6 3 $Bio::Tools::EUtilities::Info::FieldInfo::VERSION = '1.73';
7 }
8 3 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 3 ▶use base qw(Bio::Root::Root Bio::Tools::EUtilities::EUtilDataI);
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 # ABSTRACT: Class for storing einfo field data.
14 # AUTHOR: Chris Fields <cjfields@bioperl.org>
15 # OWNER: 2006-2013 Chris Fields
16 # LICENSE: Perl_5
17  
18  
19  
20 sub new {
21 41 ▶ my ($class, @args) = @_;
Subroutine new: called CC=1 SCAR=0.0
Pod documented
22 41 my $self = $class->SUPER::new(@args);
23 41 $self->eutil('einfo');
24 41 $self->datatype('fieldinfo');
25 41 return $self;
26 }
27  
28  
29 2 ▶sub get_term_count { return shift->{'_termcount'} }
Subroutine get_term_count: called CC=1 SCAR=0.0
Pod documented
30  
31  
32 2 ▶sub get_field_name { return shift->{'_fullname'} }
Subroutine get_field_name: called CC=1 SCAR=0.0
Pod documented
33  
34  
35 3 *get_full_name = \&get_field_name;
36  
37  
38 2 ▶sub get_field_code { return shift->{'_name'} }
Subroutine get_field_code: called CC=1 SCAR=0.0
Pod documented
39  
40  
41 2 ▶sub get_field_description { return shift->{'_description'} }
Subroutine get_field_description: called CC=1 SCAR=0.0
Pod documented
42  
43  
44 sub is_date {
45 2 ▶ my $self = shift;
Subroutine is_date: called CC=3 SCAR=13.1
Pod documented
46 2 ▶ ($self->{'_isdate'} && $self->{'_isdate'} eq 'Y') ? return 1 : return 0;
Branch: 1 branch
BranchTrueFalseTotal
$self->{'_isdate'} && $self->{'_isdate'} eq 'Y' ? : 0 2 2
Condition33%1/3
$self->{"_isdate"} and $self->{"_isdate"} eq "Y"
!ll&&!rl&&r
020
MC/DC0%0/2
$self->{"_isdate"} and $self->{"_isdate"} eq "Y"
$self->{"_isdate"} $self->{"_isdate"} eq "Y"
Truth table33%1/3
A and B
A= $self->{"_isdate"}B= $self->{"_isdate"} eq "Y"
ABresult
0X0
100
111
47 }
48  
49  
50 sub is_singletoken {
51 2 ▶ my $self = shift;
Subroutine is_singletoken: called CC=3 SCAR=13.1
Pod documented
52 2 ▶ ($self->{'_singletoken'} && $self->{'_singletoken'} eq 'Y') ? return 1 : return 0;
Branch: 1 branch
BranchTrueFalseTotal
$self->{'_singletoken'} && $self->{'_singletoken'} eq 'Y' ? : 2 0 2
Condition33%1/3
$self->{"_singletoken"} and $self->{"_singletoken"} eq "Y"
!ll&&!rl&&r
002
MC/DC0%0/2
$self->{"_singletoken"} and $self->{"_singletoken"} eq "Y"
$self->{"_singletoken"} $self->{"_singletoken"} eq "Y"
Truth table33%1/3
A and B
A= $self->{"_singletoken"}B= $self->{"_singletoken"} eq "Y"
ABresult
0X0
100
111
53 }
54  
55  
56 sub is_hierarchy {
57 2 ▶ my $self = shift;
Subroutine is_hierarchy: called CC=3 SCAR=13.1
Pod documented
58 2 ▶ ($self->{'hierarchy'} && $self->{'hierarchy'} eq 'Y') ? return 1 : return 0;
Branch: 1 branch
BranchTrueFalseTotal
$self->{'hierarchy'} && $self->{'hierarchy'} eq 'Y' ? : 0 2 2
Condition33%1/3
$self->{"hierarchy"} and $self->{"hierarchy"} eq "Y"
!ll&&!rl&&r
200
MC/DC0%0/2
$self->{"hierarchy"} and $self->{"hierarchy"} eq "Y"
$self->{"hierarchy"} $self->{"hierarchy"} eq "Y"
Truth table33%1/3
A and B
A= $self->{"hierarchy"}B= $self->{"hierarchy"} eq "Y"
ABresult
0X0
100
111
59 }
60  
61  
62 sub is_hidden {
63 2 ▶ my $self = shift;
Subroutine is_hidden: called CC=3 SCAR=11.1
Pod documented
64 2 ▶ ($self->{'_ishidden'} && $self->{'_ishidden'} eq 'Y') ? return 1 : return 0;
Branch: 1 branch
BranchTrueFalseTotal
$self->{'_ishidden'} && $self->{'_ishidden'} eq 'Y' ? : 1 1 2
Condition66%2/3
$self->{"_ishidden"} and $self->{"_ishidden"} eq "Y"
!ll&&!rl&&r
011
MC/DC50%1/2
$self->{"_ishidden"} and $self->{"_ishidden"} eq "Y"
$self->{"_ishidden"} $self->{"_ishidden"} eq "Y"
Truth table66%2/3
A and B
A= $self->{"_ishidden"}B= $self->{"_ishidden"} eq "Y"
ABresult
0X0
100
111
65 }
66  
67  
68 sub is_numerical {
69 2 ▶ my $self = shift;
Subroutine is_numerical: called CC=3 SCAR=11.1
Pod documented
70 2 ▶ ($self->{'_isnumerical'} && $self->{'_isnumerical'} eq 'Y') ? return 1 : return 0;
Branch: 1 branch
BranchTrueFalseTotal
$self->{'_isnumerical'} && $self->{'_isnumerical'} eq 'Y' ? : 1 1 2
Condition66%2/3
$self->{"_isnumerical"} and $self->{"_isnumerical"} eq "Y"
!ll&&!rl&&r
011
MC/DC50%1/2
$self->{"_isnumerical"} and $self->{"_isnumerical"} eq "Y"
$self->{"_isnumerical"} $self->{"_isnumerical"} eq "Y"
Truth table66%2/3
A and B
A= $self->{"_isnumerical"}B= $self->{"_isnumerical"} eq "Y"
ABresult
0X0
100
111
71 }
72  
73 # private EUtilDataI method
74  
75 sub _add_data {
76 41 ▶ my ($self, $simple) = @_;
Subroutine _add_data: called CC=2 SCAR=7.1
77 41 ▶ map { $self->{'_'.lc $_} = $simple->{$_} unless ref $simple->{$_}} keys %$simple;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $simple->{$_} 410 0 410
78 }
79  
80  
81 sub to_string {
82 0 ▶ my $self = shift;
Subroutine to_string: not called CC=2 SCAR=17.9
Pod documented
83 # order method name
84 0 my %tags = (1 => ['get_field_code' => 'Field Code'],
85 2 => ['get_field_name' => 'Field Name'],
86 3 => ['get_field_description' => 'Description'],
87 4 => ['get_term_count' => 'Term Count']);
88 0 my $string;
89 0 for my $tag (sort {$a <=> $b} keys %tags) {
90 0 my ($m, $nm) = ($tags{$tag}->[0], $tags{$tag}->[1]);
91 0 $string .= sprintf("%-20s%s\n", $nm,
92 $self->_text_wrap('', ' 'x20 .':', ":".$self->$m));
93 }
94 $string .= sprintf("%-20s%s\n", "Attributes",
95 0 $self->_text_wrap('', ' 'x20 .':', ":".join(',', grep {$self->$_} qw(is_date
96 is_singletoken is_hierarchy is_hidden is_numerical))));
97 0 return $string;
98 }
99  
100 3 1;
101  
102 __END__
« DB/EUtilities.pm ↑ Summary Tools/EUtilities/EUtilDataI.pm »