blib/lib/Lingua/Ogmios/Annotations/Token.pm

filter: Statementstmt 80.3% 49 / 61 Branchbran 60.0% 6 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 16 / 20 Podpod 0.0% 0 / 17 totaltotal 65.7% 71 / 108 CC 6 SCAR 9.4
CC
6
Cov
77%
new
6.8
isAlpha
2.0
isNum
2.0
CRAP 2.6
« blib/lib/Lingua/Ogmios/LearningDataSet/Attribute.pm ↑ Summary blib/lib/Lingua/Ogmios/NLPWrappers/PatternParser.pm »
1 package Lingua::Ogmios::Annotations::Token;
2  
3 16 ▶use Lingua::Ogmios::Annotations::Element;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 16 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 16 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 16 our @ISA = qw(Lingua::Ogmios::Annotations::Element);
8  
9 sub new
10 6464 ▶{
Subroutine new: called CC=6 SCAR=19.2
Pod undocumented
11 6464 my ($class, $fields) = @_;
12 6464 ▶ if (!defined $fields->{'content'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $fields->{"content"}) 0 6464 6464
13 0 die("content is not defined");
14 }
15 6464 ▶ if (!defined $fields->{'id'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $fields->{"id"}) 6463 1 6464
16 6463 $fields->{'id'} = -1;
17 }
18 my $token = $class->SUPER::new({
19 6464 'id' => $fields->{'id'},
20 # 'form' => $fields->{'content'},
21 }
22 );
23  
24
25 6464 ▶ if (!defined $fields->{'type'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $fields->{"type"}) 0 6464 6464
26 0 die("type is not defined");
27 }
28 6464 ▶ if (!defined $fields->{'from'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $fields->{"from"}) 0 6464 6464
29 0 die("from is not defined");
30 }
31 6464 ▶ if (!defined $fields->{'to'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $fields->{"to"}) 0 6464 6464
32 0 die("to is not defined");
33 }
34  
35 6464 bless ($token,$class);
36 6464 $token->setContent($fields->{'content'});
37 6464 $token->setType($fields->{'type'});
38 6464 $token->setFrom($fields->{'from'});
39 6464 $token->setTo($fields->{'to'});
40
41 6464 return $token;
42 }
43  
44 30423 ▶sub getContent {
Subroutine getContent: called CC=1 SCAR=0.0
Pod undocumented
45 30423 my ($self) = @_;
46  
47 # return($self->getForm);
48 30423 return($self->{'content'});
49 }
50  
51 6464 ▶sub setContent {
Subroutine setContent: called CC=1 SCAR=0.0
Pod undocumented
52 6464 my ($self, $content) = @_;
53  
54 # $self->setForm($content);
55 6464 $self->{'content'}=$content;
56 }
57  
58 6464 ▶sub setType {
Subroutine setType: called CC=1 SCAR=0.0
Pod undocumented
59 6464 my ($self, $type) = @_;
60  
61 6464 $self->{'type'} = $type;
62 }
63  
64 6464 ▶sub setFrom {
Subroutine setFrom: called CC=1 SCAR=0.0
Pod undocumented
65 6464 my ($self, $from) = @_;
66  
67 6464 $self->{'from'} = $from;
68  
69 }
70  
71 6464 ▶sub setTo {
Subroutine setTo: called CC=1 SCAR=0.0
Pod undocumented
72 6464 my ($self, $to) = @_;
73  
74 6464 $self->{'to'} = $to;
75 }
76  
77 7614 ▶sub getType {
Subroutine getType: called CC=1 SCAR=0.0
Pod undocumented
78 7614 my ($self) = @_;
79  
80 7614 return($self->{'type'});
81 }
82  
83 7614 ▶sub isType {
Subroutine isType: called CC=1 SCAR=0.0
Pod undocumented
84 7614 my ($self, $type) = @_;
85  
86 7614 return($self->getType eq $type);
87 }
88  
89 7450 ▶sub isSep {
Subroutine isSep: called CC=1 SCAR=0.0
Pod undocumented
90 7450 my ($self) = @_;
91  
92 7450 return($self->isType('sep'));
93 }
94  
95 164 ▶sub isSymb {
Subroutine isSymb: called CC=1 SCAR=0.0
Pod undocumented
96 164 my ($self) = @_;
97  
98 164 return($self->isType('symb'));
99 }
100  
101 0 ▶sub isAlpha {
Subroutine isAlpha: not called CC=1 SCAR=6.9
Pod undocumented
102 0 my ($self) = @_;
103  
104 0 return($self->isType('alpha'));
105 }
106  
107 0 ▶sub isNum {
Subroutine isNum: not called CC=1 SCAR=6.9
Pod undocumented
108 0 my ($self) = @_;
109  
110 0 return($self->isType('num'));
111 }
112  
113 44 ▶sub getFrom {
Subroutine getFrom: called CC=1 SCAR=0.0
Pod undocumented
114 44 my ($self) = @_;
115  
116 44 return($self->{'from'});
117  
118 }
119  
120 44 ▶sub getTo {
Subroutine getTo: called CC=1 SCAR=0.0
Pod undocumented
121 44 my ($self) = @_;
122  
123 44 return($self->{'to'});
124 }
125  
126  
127 0 ▶sub printXML {
Subroutine printXML: not called CC=1 SCAR=6.9
Pod undocumented
128 0 my ($self, $order) = @_;
129  
130 0 print $self->XMLout($order);
131 }
132  
133 657 ▶sub XMLout {
Subroutine XMLout: called CC=1 SCAR=0.0
Pod undocumented
134 657 my ($self, $order) = @_;
135  
136 657 return($self->SUPER::XMLout("token", $order));
137 }
138  
139 # sub before {
140 # my ($self, $token2) = @_;
141  
142 # return($self->
143 # }
144  
145 0 ▶sub getElementFormList {
Subroutine getElementFormList: not called CC=1 SCAR=6.9
Pod undocumented
146 0 my ($self) = @_;
147  
148 # warn $self->getContent . "\n";
149  
150 0 return($self->getContent);
151  
152 }
153  
154  
155 16 1;
156  
157 __END__
« blib/lib/Lingua/Ogmios/LearningDataSet/Attribute.pm ↑ Summary blib/lib/Lingua/Ogmios/NLPWrappers/PatternParser.pm »