Tools/EUtilities/Info/FieldInfo.pm

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