line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lingua::Ogmios::Annotations::Enumeration; |
2
|
|
|
|
|
|
|
|
3
|
16
|
|
|
16
|
|
73
|
use strict; |
|
16
|
|
|
|
|
28
|
|
|
16
|
|
|
|
|
368
|
|
4
|
16
|
|
|
16
|
|
80
|
use warnings; |
|
16
|
|
|
|
|
29
|
|
|
16
|
|
|
|
|
417
|
|
5
|
|
|
|
|
|
|
|
6
|
16
|
|
|
16
|
|
80
|
use Lingua::Ogmios::Annotations::Element; |
|
16
|
|
|
|
|
37
|
|
|
16
|
|
|
|
|
14575
|
|
7
|
|
|
|
|
|
|
our @ISA = qw(Lingua::Ogmios::Annotations::Element); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
# |
12
|
|
|
|
|
|
|
# |
13
|
|
|
|
|
|
|
#
|
14
|
|
|
|
|
|
|
# (log_id?, comments*, enumeration+) > |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# |
17
|
|
|
|
|
|
|
#
|
18
|
|
|
|
|
|
|
# list_refid_components, |
19
|
|
|
|
|
|
|
# form?) > |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# |
22
|
|
|
|
|
|
|
#
|
23
|
|
|
|
|
|
|
# (refid_word | refid_phrase |
24
|
|
|
|
|
|
|
# | refid_semantic_unit)+ > |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# |
27
|
|
|
|
|
|
|
# |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub new { |
30
|
0
|
|
|
0
|
0
|
|
my ($class, $fields) = @_; |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
my @refTypes = ('refid_phrase', 'refid_word', 'refid_semantic_unit'); |
33
|
|
|
|
|
|
|
|
34
|
0
|
0
|
|
|
|
|
if (!defined $fields->{'id'}) { |
35
|
0
|
|
|
|
|
|
$fields->{'id'} = -1; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
# if (!defined $fields->{'list_refid_components'}) { # list_refid_components |
38
|
|
|
|
|
|
|
# die("list_refid_components is not defined"); |
39
|
|
|
|
|
|
|
# } |
40
|
|
|
|
|
|
|
my $enumeration = $class->SUPER::new({ |
41
|
0
|
|
|
|
|
|
'id' => $fields->{'id'}, |
42
|
|
|
|
|
|
|
# 'form' => $fields->{'form'}, |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
); |
45
|
0
|
|
|
|
|
|
bless ($enumeration,$class); |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
my $i = 0; |
48
|
0
|
|
|
|
|
|
my $reference_name; |
49
|
|
|
|
|
|
|
my $ref; |
50
|
0
|
|
|
|
|
|
foreach $ref (@refTypes) { |
51
|
0
|
0
|
|
|
|
|
if (defined $fields->{$ref}) { |
52
|
0
|
|
|
|
|
|
$reference_name = $ref; |
53
|
0
|
|
|
|
|
|
last; |
54
|
|
|
|
|
|
|
} |
55
|
0
|
|
|
|
|
|
$i++; |
56
|
|
|
|
|
|
|
} |
57
|
0
|
0
|
|
|
|
|
if ($i == scalar(@refTypes)) { |
58
|
0
|
|
|
|
|
|
die("reference (list) is not defined"); |
59
|
|
|
|
|
|
|
} |
60
|
0
|
|
|
|
|
|
$enumeration->list_refid_components($reference_name, $fields->{$reference_name}); |
61
|
|
|
|
|
|
|
|
62
|
0
|
0
|
|
|
|
|
if (defined $fields->{'form'}) { |
63
|
0
|
|
|
|
|
|
$enumeration->setForm($fields->{'form'}); |
64
|
|
|
|
|
|
|
} |
65
|
0
|
0
|
|
|
|
|
if (defined $fields->{'type'}) { |
66
|
0
|
|
|
|
|
|
$enumeration->type($fields->{'type'}); |
67
|
|
|
|
|
|
|
} |
68
|
0
|
0
|
|
|
|
|
if (defined $fields->{'log_id'}) { |
69
|
0
|
|
|
|
|
|
$enumeration->setLogId($fields->{'log_id'}); |
70
|
|
|
|
|
|
|
} |
71
|
0
|
|
|
|
|
|
return($enumeration); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub list_refid_components { |
76
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
77
|
0
|
|
|
|
|
|
my $ref; |
78
|
|
|
|
|
|
|
my $elt; |
79
|
|
|
|
|
|
|
|
80
|
0
|
0
|
0
|
|
|
|
if ((@_) && (scalar @_ == 2)) { |
81
|
0
|
|
|
|
|
|
$self->{'list_refid_components'} = {}; |
82
|
0
|
|
|
|
|
|
$self->{'list_refid_components'}->{'reference'} = shift; |
83
|
0
|
|
|
|
|
|
$self->{'list_refid_components'}->{$self->{'list_refid_components'}->{'reference'}} = []; |
84
|
0
|
|
|
|
|
|
$ref = shift; |
85
|
0
|
|
|
|
|
|
foreach $elt (@$ref) { |
86
|
0
|
|
|
|
|
|
push @{$self->{'list_refid_components'}->{$self->{'list_refid_components'}->{'reference'}}}, $elt; |
|
0
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
} |
89
|
0
|
|
|
|
|
|
return($self->{'list_refid_components'}->{$self->{'list_refid_components'}->{'reference'}}); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub type { |
94
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
95
|
|
|
|
|
|
|
|
96
|
0
|
0
|
|
|
|
|
$self->{'type'} = shift if @_; |
97
|
0
|
|
|
|
|
|
return($self->{'type'}); |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub reference { |
101
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
102
|
0
|
|
|
|
|
|
my $ref; |
103
|
|
|
|
|
|
|
my $elt; |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
# if ((@_) && (scalar @_ == 2)) { |
106
|
|
|
|
|
|
|
# $self->{'reference'} = shift; |
107
|
|
|
|
|
|
|
# $self->{$self->{'reference'}} = []; |
108
|
|
|
|
|
|
|
# $ref = shift; |
109
|
|
|
|
|
|
|
# foreach $elt (@$ref) { |
110
|
|
|
|
|
|
|
# push @{$self->{$self->{'reference'}}}, $elt; |
111
|
|
|
|
|
|
|
# } |
112
|
|
|
|
|
|
|
# } |
113
|
0
|
|
|
|
|
|
return($self->{'list_refid_components'}->{$self->reference_name}); |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub addComponent { |
118
|
0
|
|
|
0
|
0
|
|
my ($self, $component) = @_; |
119
|
|
|
|
|
|
|
|
120
|
0
|
|
|
|
|
|
push @{$self->list_refid_components}, $component; |
|
0
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub reference_name { |
125
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
126
|
|
|
|
|
|
|
|
127
|
0
|
0
|
|
|
|
|
$self->{'list_refid_components'}->{'reference'} = shift if @_; |
128
|
0
|
|
|
|
|
|
return $self->{'list_refid_components'}->{'reference'}; |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub getReferenceSize { |
133
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
134
|
|
|
|
|
|
|
|
135
|
0
|
|
|
|
|
|
my $token; |
136
|
0
|
|
|
|
|
|
my $size = 0; |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
# for $element (@{$self->list_refid_components}) { |
139
|
|
|
|
|
|
|
# $size += $element->getReferenceSize; |
140
|
|
|
|
|
|
|
# } |
141
|
|
|
|
|
|
|
|
142
|
0
|
|
|
|
|
|
$token = $self->start_token; |
143
|
|
|
|
|
|
|
|
144
|
0
|
|
|
|
|
|
while(!($token->equals($self->end_token))) { |
145
|
0
|
|
|
|
|
|
$size++; |
146
|
0
|
|
|
|
|
|
$token = $token->next; |
147
|
|
|
|
|
|
|
} |
148
|
0
|
|
|
|
|
|
$size++; |
149
|
|
|
|
|
|
|
|
150
|
0
|
|
|
|
|
|
return($size); |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
sub end_token { |
156
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
# warn $self->reference_name ; |
159
|
|
|
|
|
|
|
|
160
|
0
|
0
|
|
|
|
|
if ($self->reference_name eq "list_refid_token") { |
161
|
0
|
|
|
|
|
|
return($self->reference->[$#{$self->reference}]); |
|
0
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
#if list_refid token -> OK |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
# if refid word -> word->start_token |
166
|
|
|
|
|
|
|
# OR |
167
|
|
|
|
|
|
|
# if refid phrase -> enumeration->start_token |
168
|
0
|
0
|
0
|
|
|
|
if (($self->reference_name eq "refid_word") || |
|
|
|
0
|
|
|
|
|
169
|
|
|
|
|
|
|
($self->reference_name eq "refid_phrase") || |
170
|
|
|
|
|
|
|
($self->reference_name eq "refid_semantic_unit")){ |
171
|
0
|
|
|
|
|
|
return($self->reference->[$#{$self->reference}]->end_token); |
|
0
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
} |
173
|
0
|
|
|
|
|
|
return(undef); |
174
|
|
|
|
|
|
|
} |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
sub start_token { |
177
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
# warn $self->reference_name; |
180
|
|
|
|
|
|
|
|
181
|
0
|
0
|
|
|
|
|
if ($self->reference_name eq "list_refid_token") { |
182
|
0
|
|
|
|
|
|
return($self->reference->[0]); |
183
|
|
|
|
|
|
|
} |
184
|
|
|
|
|
|
|
#if list_refid token -> OK |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
# if refid word -> word->start_token |
187
|
|
|
|
|
|
|
# OR |
188
|
|
|
|
|
|
|
# if refid phrase -> enumeration->start_token |
189
|
0
|
0
|
0
|
|
|
|
if (($self->reference_name eq "refid_word") || |
|
|
|
0
|
|
|
|
|
190
|
|
|
|
|
|
|
($self->reference_name eq "refid_phrase") || |
191
|
|
|
|
|
|
|
($self->reference_name eq "refid_semantic_unit")){ |
192
|
0
|
|
|
|
|
|
return($self->reference->[0]->start_token); |
193
|
|
|
|
|
|
|
} |
194
|
0
|
|
|
|
|
|
return(undef); |
195
|
|
|
|
|
|
|
} |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
sub XMLout { |
200
|
0
|
|
|
0
|
0
|
|
my ($self, $order) = @_; |
201
|
|
|
|
|
|
|
|
202
|
0
|
|
|
|
|
|
return($self->SUPER::XMLout("enumeration", $order)); |
203
|
|
|
|
|
|
|
} |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
sub getElementFormList { |
206
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
207
|
|
|
|
|
|
|
|
208
|
0
|
|
|
|
|
|
my $element; |
209
|
|
|
|
|
|
|
my @elements; |
210
|
|
|
|
|
|
|
|
211
|
0
|
|
|
|
|
|
foreach $element (@{$self->list_refid_components}) { |
|
0
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
# warn $element->getForm ."\n"; |
213
|
0
|
|
|
|
|
|
push @elements, $element->getElementFormList; |
214
|
|
|
|
|
|
|
} |
215
|
0
|
|
|
|
|
|
return(@elements); |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
} |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
1; |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
__END__ |