Tools/EUtilities/Info/FieldInfo.pm

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