« blib/lib/Lingua/Ogmios/NLPWrappers/Flemm.pm
↑ Summary
blib/lib/Lingua/Ogmios/Annotations/AnaphoraRelation.pm »
| 1 | package Lingua::Ogmios::Annotations::Element; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 16 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 16 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | sub new | ||||||||||||||||||||||||||||
| 8 | 6665 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=15.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 9 | 6665 | my ($class, $fields) = @_; | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 6665 | ▶ | if (!defined $fields->{'id'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 12 | 0 | die("id is not defined"); | |||||||||||||||||||||||||||
| 13 | } | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | my $element = { | ||||||||||||||||||||||||||||
| 16 | 6665 | 'id' => $fields->{'id'}, | |||||||||||||||||||||||||||
| 17 | 'log_id' => undef, | ||||||||||||||||||||||||||||
| 18 | 'form' => undef, | ||||||||||||||||||||||||||||
| 19 | 'next' => undef, | ||||||||||||||||||||||||||||
| 20 | 'previous' => undef, | ||||||||||||||||||||||||||||
| 21 | }; | ||||||||||||||||||||||||||||
| 22 | 6665 | bless ($element,$class); | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 6665 | ▶ | if (defined $fields->{'log_id'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 25 | 0 | $element->setLogId($fields->{'log_id'}); | |||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 6665 | ▶ | if (defined $fields->{'form'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 29 | 0 | $element->setForm($fields->{'form'}); | |||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 6665 | return $element; | |||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 127779 | ▶ | sub next { | ||||||||||||||||||||||||||
|
Subroutine
next: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 36 | 127779 | my $self = shift; | |||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 127779 | ▶ | $self->{'next'} = shift if @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 39 | 127779 | return($self->{'next'}); | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 6840 | ▶ | sub previous { | ||||||||||||||||||||||||||
|
Subroutine
previous: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 43 | 6840 | my $self = shift; | |||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 6840 | ▶ | $self->{'previous'} = shift if @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 46 | 6840 | return($self->{'previous'}); | |||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 121026 | ▶ | sub equals { | ||||||||||||||||||||||||||
|
Subroutine
equals: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 50 | 121026 | my ($self, $element) = @_; | |||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 121026 | ▶ | if ($self->getId == $element->getId) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 53 | 405 | return(1); | |||||||||||||||||||||||||||
| 54 | } else { | ||||||||||||||||||||||||||||
| 55 | 120621 | return(0); | |||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 35199 | ▶ | sub _getField { | ||||||||||||||||||||||||||
|
Subroutine
_getField: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 60 | 35199 | my ($self, $field) = @_; | |||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 35199 | return($self->{$field}); | |||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 88 | ▶ | sub _setField { | ||||||||||||||||||||||||||
|
Subroutine
_setField: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 66 | 88 | my ($self, $field, $value) = @_; | |||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | 88 | $self->{$field} = $value; | |||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 566235 | ▶ | sub getId { | ||||||||||||||||||||||||||
|
Subroutine
getId: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 72 | 566235 | my ($self) = @_; | |||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 566235 | return($self->{'id'}); | |||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | 6664 | ▶ | sub setId { | ||||||||||||||||||||||||||
|
Subroutine
setId: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 78 | 6664 | my ($self, $id) = @_; | |||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | 6664 | $self->{'id'} = $id; | |||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | 0 | ▶ | sub getLogId { | ||||||||||||||||||||||||||
|
Subroutine
getLogId: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 84 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | 0 | return($self->{'log_id'}); | |||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | 0 | ▶ | sub setLogId { | ||||||||||||||||||||||||||
|
Subroutine
setLogId: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 90 | 0 | my ($self, $log_id) = @_; | |||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | 0 | $self->{'log_id'} = $log_id; | |||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | 82 | ▶ | sub getForm { | ||||||||||||||||||||||||||
|
Subroutine
getForm: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 96 | 82 | my ($self) = @_; | |||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | 82 | return($self->{'form'}); | |||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | 123 | ▶ | sub setForm { | ||||||||||||||||||||||||||
|
Subroutine
setForm: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 102 | 123 | my ($self, $form) = @_; | |||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | # $self->{'form'} = $self->_xmlencode($form); | ||||||||||||||||||||||||||||
| 105 | 123 | $self->{'form'} = $form; | |||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | 1 | ▶ | sub print { | ||||||||||||||||||||||||||
|
Subroutine
print: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 110 | 1 | my ($self, $fh) = @_; | |||||||||||||||||||||||||||
| 111 | 1 | ▶ | if (!defined $fh) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 112 | 0 | $fh = \*STDERR | |||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||
| 114 | 1 | my $field; | |||||||||||||||||||||||||||
| 115 | 1 | foreach $field (keys %$self) { | |||||||||||||||||||||||||||
| 116 | 9 | ▶ | if (defined $self->{$field}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 117 | 5 | print "$field => " . $self->{$field} . "\n"; | |||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||
| 120 | 1 | return(0); | |||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | 0 | ▶ | sub printXML { | ||||||||||||||||||||||||||
|
Subroutine
printXML: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 125 | 0 | my ($self, $name, $order) = @_; | |||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | 0 | print $self->XMLout($name, $order); | |||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | 6 | ▶ | sub _XMLoutField { | ||||||||||||||||||||||||||
|
Subroutine
_XMLoutField: called CC=14 SCAR=35.8
| |||||||||||||||||||||||||||||
| 131 | 6 | my ($self, $field, $field_content, $shift) = @_; | |||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | 6 | my $str; | |||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | my $elt; | ||||||||||||||||||||||||||||
| 136 | 6 | my $internal_field; | |||||||||||||||||||||||||||
| 137 | 6 | my $position; | |||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | 6 | ▶ | if (!defined($shift)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 141 | 0 | $shift = "\t\t"; | |||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | # warn "$field - " . ref($field_content) . "\n"; | ||||||||||||||||||||||||||||
| 145 | 6 | ▶ | if (ref($field_content) eq "ARRAY") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 146 | 3 | $position = index($field, "list_"); | |||||||||||||||||||||||||||
| 147 | 3 | ▶ | if ($position == 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 148 | 3 | $str .= "$shift<$field>\n"; | |||||||||||||||||||||||||||
| 149 | 3 | $internal_field = substr($field, $position + 5); | |||||||||||||||||||||||||||
| 150 | 3 | foreach $elt (@{$field_content}) { | |||||||||||||||||||||||||||
| 151 | 3 | $str .= $self->_XMLoutField($internal_field, $elt, "$shift\t"); | |||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||
| 153 | 3 | $str .= "$shift</$field>\n"; | |||||||||||||||||||||||||||
| 154 | } else { | ||||||||||||||||||||||||||||
| 155 | 0 | foreach $elt (@{$field_content}) { | |||||||||||||||||||||||||||
| 156 | 0 | $str .= $self->_XMLoutField($field, $elt, "$shift"); | |||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | 6 | ▶ | if (ref($field_content) eq "HASH") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 162 | 0 | $str .= "$shift<$field>\n"; | |||||||||||||||||||||||||||
| 163 | 0 | ▶ | if (defined($internal_field = $field_content->{"reference"})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 164 | 0 | foreach $elt (@{$field_content->{$field_content->{"reference"}}}) { | |||||||||||||||||||||||||||
| 165 | 0 | $str .= $self->_XMLoutField($internal_field, $elt, "$shift\t"); | |||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||
| 167 | } else { | ||||||||||||||||||||||||||||
| 168 | 0 | ▶ | if ($field eq "weights") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 169 | 0 | foreach $elt (keys %$field_content) { | |||||||||||||||||||||||||||
| 170 | # if (!defined ($field_content->{$elt})) { | ||||||||||||||||||||||||||||
| 171 | # warn "$elt\n"; | ||||||||||||||||||||||||||||
| 172 | # } | ||||||||||||||||||||||||||||
| 173 | 0 | $str .= "$shift\t<weight name=\"$elt\">"; | |||||||||||||||||||||||||||
| 174 | 0 | $str .= $field_content->{$elt} . "</weight>\n"; | |||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||
| 176 | } else { | ||||||||||||||||||||||||||||
| 177 | 0 | foreach $elt (keys %$field_content) { | |||||||||||||||||||||||||||
| 178 | # $str .= "$shift<$elt>" . $field_content->{$elt} . "</$elt>\n"; | ||||||||||||||||||||||||||||
| 179 | 0 | $str .= $self->_XMLoutField($elt,$field_content->{$elt},"$shift\t"); #"$shift<$elt>" . $field_content->{$elt} . "</$elt>\n"; | |||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||
| 183 | 0 | $str .= "$shift</$field>\n"; | |||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | 6 | ▶ | if (index(ref($field_content), "Lingua::Ogmios") > -1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 187 | # warn "$field: " . $field_content->getId . "\n"; | ||||||||||||||||||||||||||||
| 188 | 0 | $str .= "$shift<$field>"; | |||||||||||||||||||||||||||
| 189 | # $str .= $field_content->getId . " = " . $field_content; | ||||||||||||||||||||||||||||
| 190 | 0 | $str .= $field_content->getId; | |||||||||||||||||||||||||||
| 191 | 0 | $str .= "</$field>\n"; | |||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | 6 | ▶ | if (ref($field_content) eq "") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 195 | 3 | $str .= "$shift<$field>"; | |||||||||||||||||||||||||||
| 196 | 3 | $str .= $field_content; | |||||||||||||||||||||||||||
| 197 | 3 | $str .= "</$field>\n"; | |||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||
| 199 | 6 | return($str); | |||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | 660 | ▶ | sub XMLout { | ||||||||||||||||||||||||||
|
Subroutine
XMLout: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 203 | 660 | my ($self, $name, $order) = @_; | |||||||||||||||||||||||||||
| 204 | 660 | my $field; | |||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | my $str; | ||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | 660 | my $elt; | |||||||||||||||||||||||||||
| 209 | 660 | my $internal_field; | |||||||||||||||||||||||||||
| 210 | 660 | my $position; | |||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||
| 212 | # warn "$name\n"; | ||||||||||||||||||||||||||||
| 213 | 660 | $str = "\t<$name>\n"; | |||||||||||||||||||||||||||
| 214 | 660 | foreach $field (@$order) { | |||||||||||||||||||||||||||
| 215 | # warn "-->$field\n"; | ||||||||||||||||||||||||||||
| 216 | 3306 | ▶ | if (defined $self->_getField($field)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 217 | 3295 | ▶ | if ((defined(ref($self->_getField($field)))) && (ref($self->_getField($field)) ne "")) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined ref $self->_getField($field) and ref $self->_getField($field) ne ""
MC/DC50%1/2
defined ref $self->_getField($field) and ref $self->_getField($field) ne ""
defined ref $self->_getField($field)
ref $self->_getField($field) ne ""
Truth table66%2/3
A and B
A= defined ref $self->_getField($field)B= ref $self->_getField($field) ne ""
| |||||||||||||||||||||||||||||
| 218 | 3 | $str .= $self->_XMLoutField($field, $self->_getField($field), "\t\t") ; | |||||||||||||||||||||||||||
| 219 | } else { | ||||||||||||||||||||||||||||
| 220 | 3292 | $str .= "\t\t<$field>" . $self->_xmlencode($self->_getField($field)) . "</$field>\n"; | |||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||
| 224 | 660 | $str .= "\t</$name>\n"; | |||||||||||||||||||||||||||
| 225 | 660 | return($str); | |||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | 0 | ▶ | sub XMLout_orig { | ||||||||||||||||||||||||||
|
Subroutine
XMLout_orig: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 229 | 0 | my ($self, $name, $order) = @_; | |||||||||||||||||||||||||||
| 230 | 0 | my $field; | |||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | my $str; | ||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||
| 234 | 0 | my $elt; | |||||||||||||||||||||||||||
| 235 | 0 | my $internal_field; | |||||||||||||||||||||||||||
| 236 | 0 | my $position; | |||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | 0 | $str = "\t<$name>\n"; | |||||||||||||||||||||||||||
| 239 | 0 | foreach $field (@$order) { | |||||||||||||||||||||||||||
| 240 | 0 | ▶ | if (defined $self->_getField($field)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 241 | 0 | ▶ | if (ref $self->_getField($field) eq "ARRAY") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 242 | 0 | $str .= "\t\t<$field>"; | |||||||||||||||||||||||||||
| 243 | 0 | $position = index($field, "list_"); | |||||||||||||||||||||||||||
| 244 | 0 | ▶ | if ($position == 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 245 | 0 | $str .= "\n"; | |||||||||||||||||||||||||||
| 246 | 0 | $internal_field = substr($field, $position + 5); | |||||||||||||||||||||||||||
| 247 | 0 | foreach $elt (@{$self->_getField($field)}) { | |||||||||||||||||||||||||||
| 248 | 0 | $str .= "\t\t\t<$internal_field>" . $elt->getId . "</$internal_field>\n"; | |||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||
| 250 | 0 | $str .= "\t\t"; | |||||||||||||||||||||||||||
| 251 | } else { | ||||||||||||||||||||||||||||
| 252 | 0 | $str .= $self->_getField($field)->[0] ; | |||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||
| 255 | 0 | $str .= "</$field>\n"; | |||||||||||||||||||||||||||
| 256 | } else { | ||||||||||||||||||||||||||||
| 257 | 0 | ▶ | if (ref $self->_getField($field) eq "HASH") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 258 | 0 | $str .= "\t\t<$field>"; | |||||||||||||||||||||||||||
| 259 | # $position = index($field, "list_"); | ||||||||||||||||||||||||||||
| 260 | # if ($position == 0) { | ||||||||||||||||||||||||||||
| 261 | 0 | $str .= "\n"; | |||||||||||||||||||||||||||
| 262 | 0 | $internal_field = $self->_getField($field)->{"reference"}; | |||||||||||||||||||||||||||
| 263 | 0 | foreach $elt (@{$self->_getField($field)->{$self->_getField($field)->{"reference"}}}) { | |||||||||||||||||||||||||||
| 264 | 0 | $str .= "\t\t\t<$internal_field>" . $elt->getId . "</$internal_field>\n"; | |||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||
| 266 | 0 | $str .= "\t\t"; | |||||||||||||||||||||||||||
| 267 | 0 | $str .= "</$field>\n"; | |||||||||||||||||||||||||||
| 268 | } else { | ||||||||||||||||||||||||||||
| 269 | 0 | $str .= "\t\t<$field>" . $self->_xmlencode($self->_getField($field)) . "</$field>\n"; | |||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||
| 274 | 0 | $str .= "\t</$name>\n"; | |||||||||||||||||||||||||||
| 275 | 0 | return($str); | |||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||
| 278 | 168 | ▶ | sub _xmldecode { # to be optimized | ||||||||||||||||||||||||||
|
Subroutine
_xmldecode: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 279 | 168 | my ($self, $string) = @_; | |||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||
| 281 | 168 | $string =~ s/&/&/go; | |||||||||||||||||||||||||||
| 282 | 168 | $string =~ s/"/\"/og; | |||||||||||||||||||||||||||
| 283 | 168 | $string =~ s/'/\'/og; | |||||||||||||||||||||||||||
| 284 | 168 | $string =~ s/</</og; | |||||||||||||||||||||||||||
| 285 | 168 | $string =~ s/>/>/og; | |||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | 168 | return($string); | |||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | 3285 | ▶ | sub _xmlencode { # to be optimized | ||||||||||||||||||||||||||
|
Subroutine
_xmlencode: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 291 | 3285 | my ($self, $string) = @_; | |||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||
| 293 | 3285 | $string =~ s/&/&/og; | |||||||||||||||||||||||||||
| 294 | 3285 | $string =~ s/\"/"/og; | |||||||||||||||||||||||||||
| 295 | 3285 | $string =~ s/\'/'/og; | |||||||||||||||||||||||||||
| 296 | 3285 | $string =~ s/</</og; | |||||||||||||||||||||||||||
| 297 | 3285 | $string =~ s/>/>/og; | |||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||
| 299 | 3285 | return($string); | |||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||
| 302 | 0 | ▶ | sub getFrom { | ||||||||||||||||||||||||||
|
Subroutine
getFrom: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 303 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||
| 305 | 0 | return($self->start_token->getFrom); | |||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||
| 308 | 0 | ▶ | sub getTo { | ||||||||||||||||||||||||||
|
Subroutine
getTo: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 309 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | 0 | return($self->end_token->getFrom); | |||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||
| 314 | 0 | ▶ | sub isBefore { | ||||||||||||||||||||||||||
|
Subroutine
isBefore: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 315 | 0 | my ($self, $element) = @_; | |||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||
| 317 | 0 | ▶ | if ($self->getTo < $element->getFrom) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 318 | 0 | return(1); | |||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||
| 320 | 0 | return(0); | |||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||
| 323 | 0 | ▶ | sub isAfter { | ||||||||||||||||||||||||||
|
Subroutine
isAfter: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 324 | 0 | my ($self, $element) = @_; | |||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||
| 326 | 0 | ▶ | if ($element->getTo < $self->getFrom) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 327 | 0 | return(1); | |||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||
| 329 | 0 | return(0); | |||||||||||||||||||||||||||
| 330 | } | ||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||
| 333 | 0 | ▶ | sub contains { | ||||||||||||||||||||||||||
|
Subroutine
contains: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 334 | 0 | my ($self, $element) = @_; | |||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||
| 336 | # warn "------------------------------------------------------------------------\n"; | ||||||||||||||||||||||||||||
| 337 | # warn $element->getForm . "\n"; | ||||||||||||||||||||||||||||
| 338 | 0 | my $offset_start; | |||||||||||||||||||||||||||
| 339 | my $offset_end; | ||||||||||||||||||||||||||||
| 340 | 0 | ▶ | if (ref($self) eq "Lingua::Ogmios::Annotations::Token") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 341 | 0 | $offset_start = $self->getFrom; | |||||||||||||||||||||||||||
| 342 | 0 | $offset_end = $self->getTo; | |||||||||||||||||||||||||||
| 343 | } else { | ||||||||||||||||||||||||||||
| 344 | 0 | $offset_start = $element->start_token->getFrom; | |||||||||||||||||||||||||||
| 345 | 0 | $offset_end = $element->end_token->getTo; | |||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||
| 347 | # warn "\t$offset\n\n"; | ||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||
| 349 | 0 | ▶ | if (($self->start_token->getFrom <= $offset_start) && | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->start_token->getFrom <= $offset_start and $offset_end <= $self->end_token->getTo
MC/DC0%0/2
$self->start_token->getFrom <= $offset_start and $offset_end <= $self->end_token->getTo
$self->start_token->getFrom <= $offset_start
$offset_end <= $self->end_token->getTo
Truth table0%0/3
A and B
A= $self->start_token->getFrom <= $offset_startB= $offset_end <= $self->end_token->getTo
| |||||||||||||||||||||||||||||
| 350 | ($offset_end <= $self->end_token->getTo)) { | ||||||||||||||||||||||||||||
| 351 | # warn "OK\n"; | ||||||||||||||||||||||||||||
| 352 | 0 | return(1); | |||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||
| 354 | 0 | return(0); | |||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||
| 358 | 16 | 1; | |||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||
| 360 | __END__ | ||||||||||||||||||||||||||||