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

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