| 1 | ############################################################################## | ||||||||||||||||||||||||||||
| 2 | # | ||||||||||||||||||||||||||||
| 3 | # This library is free software; you can redistribute it and/or | ||||||||||||||||||||||||||||
| 4 | # modify it under the terms of the GNU Library General Public | ||||||||||||||||||||||||||||
| 5 | # License as published by the Free Software Foundation; either | ||||||||||||||||||||||||||||
| 6 | # version 2 of the License, or (at your option) any later version. | ||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||
| 8 | # This library is distributed in the hope that it will be useful, | ||||||||||||||||||||||||||||
| 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||||||||||||||||||||
| 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||||||||||||||||||||||||||
| 11 | # Library General Public License for more details. | ||||||||||||||||||||||||||||
| 12 | # | ||||||||||||||||||||||||||||
| 13 | # You should have received a copy of the GNU Library General Public | ||||||||||||||||||||||||||||
| 14 | # License along with this library; if not, write to the | ||||||||||||||||||||||||||||
| 15 | # Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||||||||||||||||||||||||||||
| 16 | # Boston, MA 02111-1307, USA. | ||||||||||||||||||||||||||||
| 17 | # | ||||||||||||||||||||||||||||
| 18 | # Jabber | ||||||||||||||||||||||||||||
| 19 | # Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/ | ||||||||||||||||||||||||||||
| 20 | # | ||||||||||||||||||||||||||||
| 21 | ############################################################################## | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | ############################################################################## | ||||||||||||||||||||||||||||
| 25 | # | ||||||||||||||||||||||||||||
| 26 | # Op - Base Op class | ||||||||||||||||||||||||||||
| 27 | # | ||||||||||||||||||||||||||||
| 28 | ############################################################################## | ||||||||||||||||||||||||||||
| 29 | package XML::Stream::XPath::Op; | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 12 | ▶ | use 5.008; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 32 | 12 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 33 | 12 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 34 | 12 | ▶ | use vars qw( $VERSION ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 12 | $VERSION = "1.23_07"; | |||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | sub new | ||||||||||||||||||||||||||||
| 39 | { | ||||||||||||||||||||||||||||
| 40 | 148 | ▶ | my $proto = shift; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 41 | 148 | return &allocate($proto,@_); | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | sub allocate | ||||||||||||||||||||||||||||
| 45 | { | ||||||||||||||||||||||||||||
| 46 | 703 | ▶ | my $proto = shift; | ||||||||||||||||||||||||||
|
Subroutine
allocate: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 47 | 703 | my $self = { }; | |||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 703 | bless($self,$proto); | |||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 703 | $self->{TYPE} = shift; | |||||||||||||||||||||||||||
| 52 | 703 | $self->{VALUE} = shift; | |||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 703 | return $self; | |||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | sub getValue | ||||||||||||||||||||||||||||
| 58 | { | ||||||||||||||||||||||||||||
| 59 | 14 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
getValue: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 60 | 14 | return $self->{VALUE}; | |||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | sub calcStr | ||||||||||||||||||||||||||||
| 64 | { | ||||||||||||||||||||||||||||
| 65 | 28 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
calcStr: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 66 | 28 | return $self->{VALUE}; | |||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | sub getType | ||||||||||||||||||||||||||||
| 70 | { | ||||||||||||||||||||||||||||
| 71 | 14 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
getType: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 72 | 14 | return $self->{TYPE}; | |||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | sub isValid | ||||||||||||||||||||||||||||
| 77 | { | ||||||||||||||||||||||||||||
| 78 | 20 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
isValid: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 79 | 20 | my $ctxt = shift; | |||||||||||||||||||||||||||
| 80 | 20 | return 1; | |||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | sub display | ||||||||||||||||||||||||||||
| 84 | { | ||||||||||||||||||||||||||||
| 85 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
display: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 86 | 0 | my $space = shift; | |||||||||||||||||||||||||||
| 87 | 0 | ▶ | $space = "" unless defined($space); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | 0 | print $space,"OP: type($self->{TYPE}) value($self->{VALUE})\n"; | |||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | ############################################################################## | ||||||||||||||||||||||||||||
| 95 | # | ||||||||||||||||||||||||||||
| 96 | # PositionOp - class to handle [0] ops | ||||||||||||||||||||||||||||
| 97 | # | ||||||||||||||||||||||||||||
| 98 | ############################################################################## | ||||||||||||||||||||||||||||
| 99 | package XML::Stream::XPath::PositionOp; | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | 12 | ▶ | use vars qw (@ISA); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 102 | 12 | @ISA = ( "XML::Stream::XPath::Op" ); | |||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | sub new | ||||||||||||||||||||||||||||
| 105 | { | ||||||||||||||||||||||||||||
| 106 | 0 | ▶ | my $proto = shift; | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 107 | 0 | my $self = $proto->allocate("POSITION",""); | |||||||||||||||||||||||||||
| 108 | 0 | $self->{POS} = shift; | |||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | 0 | return $self; | |||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | sub isValid | ||||||||||||||||||||||||||||
| 115 | { | ||||||||||||||||||||||||||||
| 116 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
isValid: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 117 | 0 | my $ctxt = shift; | |||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | 0 | my @elems = $$ctxt->getList(); | |||||||||||||||||||||||||||
| 120 | 0 | my @valid_elems; | |||||||||||||||||||||||||||
| 121 | 0 | ▶ | if ($#elems+1 < $self->{POS}) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 122 | { | ||||||||||||||||||||||||||||
| 123 | 0 | return; | |||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | 0 | push(@valid_elems, $elems[$self->{POS}-1]); | |||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | 0 | $$ctxt->setList(@valid_elems); | |||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | 0 | return 1; | |||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | ############################################################################## | ||||||||||||||||||||||||||||
| 136 | # | ||||||||||||||||||||||||||||
| 137 | # ContextOp - class to handle [...] ops | ||||||||||||||||||||||||||||
| 138 | # | ||||||||||||||||||||||||||||
| 139 | ############################################################################## | ||||||||||||||||||||||||||||
| 140 | package XML::Stream::XPath::ContextOp; | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | 12 | ▶ | use vars qw (@ISA); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 143 | 12 | @ISA = ( "XML::Stream::XPath::Op" ); | |||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | sub new | ||||||||||||||||||||||||||||
| 146 | { | ||||||||||||||||||||||||||||
| 147 | 84 | ▶ | my $proto = shift; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 148 | 84 | my $self = $proto->allocate("CONTEXT",""); | |||||||||||||||||||||||||||
| 149 | 84 | $self->{OP} = shift; | |||||||||||||||||||||||||||
| 150 | 84 | return $self; | |||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | sub isValid | ||||||||||||||||||||||||||||
| 155 | { | ||||||||||||||||||||||||||||
| 156 | 84 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
isValid: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||
| 157 | 84 | my $ctxt = shift; | |||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | 84 | my @elems = $$ctxt->getList(); | |||||||||||||||||||||||||||
| 160 | 84 | my @valid_elems; | |||||||||||||||||||||||||||
| 161 | 84 | foreach my $elem (@elems) | |||||||||||||||||||||||||||
| 162 | { | ||||||||||||||||||||||||||||
| 163 | 120 | my $tmp_ctxt = XML::Stream::XPath::Value->new($elem); | |||||||||||||||||||||||||||
| 164 | 120 | $tmp_ctxt->in_context(1); | |||||||||||||||||||||||||||
| 165 | 120 | ▶ | if ($self->{OP}->isValid(\$tmp_ctxt)) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 166 | { | ||||||||||||||||||||||||||||
| 167 | 19 | push(@valid_elems,$elem); | |||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | 84 | $$ctxt->setList(@valid_elems); | |||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | 84 | ▶ | if ($#valid_elems == -1) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 174 | { | ||||||||||||||||||||||||||||
| 175 | 71 | return; | |||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | 13 | return 1; | |||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | sub display | ||||||||||||||||||||||||||||
| 183 | { | ||||||||||||||||||||||||||||
| 184 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
display: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 185 | 0 | my $space = shift; | |||||||||||||||||||||||||||
| 186 | 0 | ▶ | $space = "" unless defined($space); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | 0 | print "${space}OP: type(CONTEXT) op: \n"; | |||||||||||||||||||||||||||
| 189 | 0 | $self->{OP}->display("$space "); | |||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||
| 195 | ############################################################################## | ||||||||||||||||||||||||||||
| 196 | # | ||||||||||||||||||||||||||||
| 197 | # AllOp - class to handle // ops | ||||||||||||||||||||||||||||
| 198 | # | ||||||||||||||||||||||||||||
| 199 | ############################################################################## | ||||||||||||||||||||||||||||
| 200 | package XML::Stream::XPath::AllOp; | ||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | 12 | ▶ | use vars qw (@ISA); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 203 | 12 | @ISA = ( "XML::Stream::XPath::Op" ); | |||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||
| 205 | sub new | ||||||||||||||||||||||||||||
| 206 | { | ||||||||||||||||||||||||||||
| 207 | 14 | ▶ | my $proto = shift; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 208 | 14 | my $name = shift; | |||||||||||||||||||||||||||
| 209 | 14 | my $self = $proto->allocate("ALL",$name); | |||||||||||||||||||||||||||
| 210 | 14 | return $self; | |||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||
| 214 | sub isValid | ||||||||||||||||||||||||||||
| 215 | { | ||||||||||||||||||||||||||||
| 216 | 14 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
isValid: called CC=4 SCAR=14.5
| |||||||||||||||||||||||||||||
| 217 | 14 | my $ctxt = shift; | |||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||
| 219 | 14 | my @elems = $$ctxt->getList(); | |||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | 14 | ▶ | if ($#elems == -1) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 222 | { | ||||||||||||||||||||||||||||
| 223 | 0 | return; | |||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | 14 | my @valid_elems; | |||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | 14 | foreach my $elem (@elems) | |||||||||||||||||||||||||||
| 229 | { | ||||||||||||||||||||||||||||
| 230 | 18 | push(@valid_elems,$self->descend($elem)); | |||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||
| 233 | 14 | $$ctxt->setList(@valid_elems); | |||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||
| 235 | 14 | ▶ | if ($#valid_elems == -1) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 236 | { | ||||||||||||||||||||||||||||
| 237 | 0 | return; | |||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||
| 240 | 14 | return 1; | |||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | sub descend | ||||||||||||||||||||||||||||
| 245 | { | ||||||||||||||||||||||||||||
| 246 | 344 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
descend: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||
| 247 | 344 | my $elem = shift; | |||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||
| 249 | 344 | my @valid_elems; | |||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | 344 | ▶ | if (($self->{VALUE} eq "*") || (&XML::Stream::GetXMLData("tag",$elem) eq $self->{VALUE})) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"VALUE"} eq "*" or &XML::Stream::GetXMLData("tag", $elem) eq $self->{"VALUE"}
MC/DC50%1/2
$self->{"VALUE"} eq "*" or &XML::Stream::GetXMLData("tag", $elem) eq $self->{"VALUE"}
$self->{"VALUE"} eq "*"
&XML::Stream::GetXMLData("tag", $elem) eq $self->{"VALUE"}
Truth table66%2/3
A or B
A= $self->{"VALUE"} eq "*"B= &XML::Stream::GetXMLData("tag", $elem) eq $self->{"VALUE"}
| |||||||||||||||||||||||||||||
| 252 | { | ||||||||||||||||||||||||||||
| 253 | 46 | push(@valid_elems,$elem); | |||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | 344 | foreach my $child (&XML::Stream::GetXMLData("child array",$elem,"*")) | |||||||||||||||||||||||||||
| 257 | { | ||||||||||||||||||||||||||||
| 258 | 326 | push(@valid_elems,$self->descend($child)); | |||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||
| 261 | 344 | return @valid_elems; | |||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||
| 266 | ############################################################################## | ||||||||||||||||||||||||||||
| 267 | # | ||||||||||||||||||||||||||||
| 268 | # NodeOp - class to handle ops based on node names | ||||||||||||||||||||||||||||
| 269 | # | ||||||||||||||||||||||||||||
| 270 | ############################################################################## | ||||||||||||||||||||||||||||
| 271 | package XML::Stream::XPath::NodeOp; | ||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||
| 273 | 12 | ▶ | use vars qw (@ISA); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 274 | 12 | @ISA = ( "XML::Stream::XPath::Op" ); | |||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | sub new | ||||||||||||||||||||||||||||
| 277 | { | ||||||||||||||||||||||||||||
| 278 | 69 | ▶ | my $proto = shift; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 279 | 69 | my $name = shift; | |||||||||||||||||||||||||||
| 280 | 69 | my $is_root = shift; | |||||||||||||||||||||||||||
| 281 | 69 | ▶ | $is_root = 0 unless defined($is_root); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 282 | 69 | my $self = $proto->allocate("NODE",$name); | |||||||||||||||||||||||||||
| 283 | 69 | $self->{ISROOT} = $is_root; | |||||||||||||||||||||||||||
| 284 | 69 | return $self; | |||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||
| 288 | sub isValid | ||||||||||||||||||||||||||||
| 289 | { | ||||||||||||||||||||||||||||
| 290 | 65 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
isValid: called CC=10 SCAR=25.5
| |||||||||||||||||||||||||||||
| 291 | 65 | my $ctxt = shift; | |||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||
| 293 | 65 | ▶ | if ($self->{ISROOT}) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 294 | { | ||||||||||||||||||||||||||||
| 295 | 0 | my $elem = $$ctxt->getFirstElem(); | |||||||||||||||||||||||||||
| 296 | 0 | ▶ | if (&XML::Stream::GetXMLData("tag",$elem) ne $self->{VALUE}) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 297 | { | ||||||||||||||||||||||||||||
| 298 | 0 | return; | |||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||
| 300 | 0 | return 1; | |||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||
| 303 | 65 | my @valid_elems; | |||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||
| 305 | 65 | foreach my $elem ($$ctxt->getList()) | |||||||||||||||||||||||||||
| 306 | { | ||||||||||||||||||||||||||||
| 307 | 61 | my $valid = 0; | |||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||
| 309 | 61 | foreach my $child (&XML::Stream::GetXMLData("child array",$elem,"*")) | |||||||||||||||||||||||||||
| 310 | { | ||||||||||||||||||||||||||||
| 311 | 493 | ▶ | if (($self->{VALUE} eq "*") || | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->{"VALUE"} eq "*" or &XML::Stream::GetXMLData("tag", $child) eq $self->{"VALUE"}
MC/DC100%2/2
$self->{"VALUE"} eq "*" or &XML::Stream::GetXMLData("tag", $child) eq $self->{"VALUE"}
$self->{"VALUE"} eq "*"
&XML::Stream::GetXMLData("tag", $child) eq $self->{"VALUE"}
Truth table100%3/3
A or B
A= $self->{"VALUE"} eq "*"B= &XML::Stream::GetXMLData("tag", $child) eq $self->{"VALUE"}
| |||||||||||||||||||||||||||||
| 312 | (&XML::Stream::GetXMLData("tag",$child) eq $self->{VALUE})) | ||||||||||||||||||||||||||||
| 313 | { | ||||||||||||||||||||||||||||
| 314 | 87 | ▶ | if ($$ctxt->in_context()) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 315 | { | ||||||||||||||||||||||||||||
| 316 | 0 | $valid = 1; | |||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||
| 318 | else | ||||||||||||||||||||||||||||
| 319 | { | ||||||||||||||||||||||||||||
| 320 | 87 | push(@valid_elems,$child); | |||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||
| 324 | 61 | ▶ | if ($valid) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 325 | { | ||||||||||||||||||||||||||||
| 326 | 0 | push(@valid_elems,$elem); | |||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||
| 330 | 65 | $$ctxt->setList(@valid_elems); | |||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||
| 332 | 65 | ▶ | if ($#valid_elems == -1) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 333 | { | ||||||||||||||||||||||||||||
| 334 | 10 | return; | |||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||
| 337 | 55 | return 1; | |||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||
| 341 | sub calcStr | ||||||||||||||||||||||||||||
| 342 | { | ||||||||||||||||||||||||||||
| 343 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
calcStr: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 344 | 2 | my $elem = shift; | |||||||||||||||||||||||||||
| 345 | 2 | return &XML::Stream::GetXMLData("value",$elem); | |||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||
| 349 | ############################################################################## | ||||||||||||||||||||||||||||
| 350 | # | ||||||||||||||||||||||||||||
| 351 | # EqualOp - class to handle [ x = y ] ops | ||||||||||||||||||||||||||||
| 352 | # | ||||||||||||||||||||||||||||
| 353 | ############################################################################## | ||||||||||||||||||||||||||||
| 354 | package XML::Stream::XPath::EqualOp; | ||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||
| 356 | 12 | ▶ | use vars qw (@ISA); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 357 | 12 | @ISA = ( "XML::Stream::XPath::Op" ); | |||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||
| 359 | sub new | ||||||||||||||||||||||||||||
| 360 | { | ||||||||||||||||||||||||||||
| 361 | 144 | ▶ | my $proto = shift; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 362 | 144 | my $self = $proto->allocate("EQUAL",""); | |||||||||||||||||||||||||||
| 363 | 144 | $self->{OP_L} = shift; | |||||||||||||||||||||||||||
| 364 | 144 | $self->{OP_R} = shift; | |||||||||||||||||||||||||||
| 365 | 144 | return $self; | |||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||
| 369 | sub isValid | ||||||||||||||||||||||||||||
| 370 | { | ||||||||||||||||||||||||||||
| 371 | 162 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
isValid: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||
| 372 | 162 | my $ctxt = shift; | |||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||
| 374 | 162 | my $tmp_ctxt = XML::Stream::XPath::Value->new(); | |||||||||||||||||||||||||||
| 375 | 162 | $tmp_ctxt->setList($$ctxt->getList()); | |||||||||||||||||||||||||||
| 376 | 162 | $tmp_ctxt->in_context(0); | |||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||
| 378 | 162 | ▶ | if (!$self->{OP_L}->isValid(\$tmp_ctxt) || !$self->{OP_R}->isValid(\$tmp_ctxt)) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"OP_L"}->isValid(\$tmp_ctxt) and $self->{"OP_R"}->isValid(\$tmp_ctxt)
MC/DC50%1/2
$self->{"OP_L"}->isValid(\$tmp_ctxt) and $self->{"OP_R"}->isValid(\$tmp_ctxt)
$self->{"OP_L"}->isValid(\$tmp_ctxt)
$self->{"OP_R"}->isValid(\$tmp_ctxt)
Truth table66%2/3
A and B
A= $self->{"OP_L"}->isValid(\$tmp_ctxt)B= $self->{"OP_R"}->isValid(\$tmp_ctxt)
| |||||||||||||||||||||||||||||
| 379 | { | ||||||||||||||||||||||||||||
| 380 | 148 | return; | |||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||
| 383 | 14 | my @valid_elems; | |||||||||||||||||||||||||||
| 384 | 14 | foreach my $elem ($tmp_ctxt->getList) | |||||||||||||||||||||||||||
| 385 | { | ||||||||||||||||||||||||||||
| 386 | 14 | ▶ | if ($self->{OP_L}->calcStr($elem) eq $self->{OP_R}->calcStr($elem)) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 387 | { | ||||||||||||||||||||||||||||
| 388 | 5 | push(@valid_elems,$elem); | |||||||||||||||||||||||||||
| 389 | } | ||||||||||||||||||||||||||||
| 390 | } | ||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||
| 392 | 14 | ▶ | if ( $#valid_elems > -1) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 393 | { | ||||||||||||||||||||||||||||
| 394 | 5 | @valid_elems = $$ctxt->getList(); | |||||||||||||||||||||||||||
| 395 | } | ||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||
| 397 | 14 | $$ctxt->setList(@valid_elems); | |||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||
| 399 | 14 | ▶ | if ($#valid_elems == -1) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 400 | { | ||||||||||||||||||||||||||||
| 401 | 9 | return; | |||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||
| 404 | 5 | return 1; | |||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||
| 408 | sub display | ||||||||||||||||||||||||||||
| 409 | { | ||||||||||||||||||||||||||||
| 410 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
display: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 411 | 0 | my $space = shift; | |||||||||||||||||||||||||||
| 412 | 0 | ▶ | $space = "" unless defined($space); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||
| 414 | 0 | print $space,"OP: type(EQUAL)\n"; | |||||||||||||||||||||||||||
| 415 | 0 | print $space," op_l: "; | |||||||||||||||||||||||||||
| 416 | 0 | $self->{OP_L}->display($space." "); | |||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||
| 418 | 0 | print $space," op_r: "; | |||||||||||||||||||||||||||
| 419 | 0 | $self->{OP_R}->display($space." "); | |||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||
| 424 | ############################################################################## | ||||||||||||||||||||||||||||
| 425 | # | ||||||||||||||||||||||||||||
| 426 | # NotEqualOp - class to handle [ x != y ] ops | ||||||||||||||||||||||||||||
| 427 | # | ||||||||||||||||||||||||||||
| 428 | ############################################################################## | ||||||||||||||||||||||||||||
| 429 | package XML::Stream::XPath::NotEqualOp; | ||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||
| 431 | 12 | ▶ | use vars qw (@ISA); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 432 | 12 | @ISA = ( "XML::Stream::XPath::Op" ); | |||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||
| 434 | sub new | ||||||||||||||||||||||||||||
| 435 | { | ||||||||||||||||||||||||||||
| 436 | 2 | ▶ | my $proto = shift; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 437 | 2 | my $self = $proto->allocate("NOTEQUAL",""); | |||||||||||||||||||||||||||
| 438 | 2 | $self->{OP_L} = shift; | |||||||||||||||||||||||||||
| 439 | 2 | $self->{OP_R} = shift; | |||||||||||||||||||||||||||
| 440 | 2 | return $self; | |||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||
| 444 | sub isValid | ||||||||||||||||||||||||||||
| 445 | { | ||||||||||||||||||||||||||||
| 446 | 6 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
isValid: called CC=7 SCAR=19.7
| |||||||||||||||||||||||||||||
| 447 | 6 | my $ctxt = shift; | |||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||
| 449 | 6 | my $tmp_ctxt = XML::Stream::XPath::Value->new(); | |||||||||||||||||||||||||||
| 450 | 6 | $tmp_ctxt->setList($$ctxt->getList()); | |||||||||||||||||||||||||||
| 451 | 6 | $tmp_ctxt->in_context(0); | |||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||
| 453 | 6 | ▶ | if (!$self->{OP_L}->isValid(\$tmp_ctxt) || !$self->{OP_R}->isValid(\$tmp_ctxt)) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"OP_L"}->isValid(\$tmp_ctxt) and $self->{"OP_R"}->isValid(\$tmp_ctxt)
MC/DC0%0/2
$self->{"OP_L"}->isValid(\$tmp_ctxt) and $self->{"OP_R"}->isValid(\$tmp_ctxt)
$self->{"OP_L"}->isValid(\$tmp_ctxt)
$self->{"OP_R"}->isValid(\$tmp_ctxt)
Truth table33%1/3
A and B
A= $self->{"OP_L"}->isValid(\$tmp_ctxt)B= $self->{"OP_R"}->isValid(\$tmp_ctxt)
| |||||||||||||||||||||||||||||
| 454 | { | ||||||||||||||||||||||||||||
| 455 | 0 | return; | |||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||
| 458 | 6 | my @valid_elems; | |||||||||||||||||||||||||||
| 459 | 6 | foreach my $elem ($tmp_ctxt->getList) | |||||||||||||||||||||||||||
| 460 | { | ||||||||||||||||||||||||||||
| 461 | 6 | ▶ | if ($self->{OP_L}->calcStr($elem) ne $self->{OP_R}->calcStr($elem)) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 462 | { | ||||||||||||||||||||||||||||
| 463 | 4 | push(@valid_elems,$elem); | |||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||
| 465 | } | ||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||
| 467 | 6 | ▶ | if ( $#valid_elems > -1) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 468 | { | ||||||||||||||||||||||||||||
| 469 | 4 | @valid_elems = $$ctxt->getList(); | |||||||||||||||||||||||||||
| 470 | } | ||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||
| 472 | 6 | $$ctxt->setList(@valid_elems); | |||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||
| 474 | 6 | ▶ | if ($#valid_elems == -1) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 475 | { | ||||||||||||||||||||||||||||
| 476 | 2 | return; | |||||||||||||||||||||||||||
| 477 | } | ||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||
| 479 | 4 | return 1; | |||||||||||||||||||||||||||
| 480 | } | ||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||
| 483 | sub display | ||||||||||||||||||||||||||||
| 484 | { | ||||||||||||||||||||||||||||
| 485 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
display: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 486 | 0 | my $space = shift; | |||||||||||||||||||||||||||
| 487 | 0 | ▶ | $space = "" unless defined($space); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||
| 489 | 0 | print $space,"OP: type(NOTEQUAL)\n"; | |||||||||||||||||||||||||||
| 490 | 0 | print $space," op_l: "; | |||||||||||||||||||||||||||
| 491 | 0 | $self->{OP_L}->display($space." "); | |||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||
| 493 | 0 | print $space," op_r: "; | |||||||||||||||||||||||||||
| 494 | 0 | $self->{OP_R}->display($space." "); | |||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||
| 499 | ############################################################################## | ||||||||||||||||||||||||||||
| 500 | # | ||||||||||||||||||||||||||||
| 501 | # AttributeOp - class to handle @foo ops. | ||||||||||||||||||||||||||||
| 502 | # | ||||||||||||||||||||||||||||
| 503 | ############################################################################## | ||||||||||||||||||||||||||||
| 504 | package XML::Stream::XPath::AttributeOp; | ||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||
| 506 | 12 | ▶ | use vars qw (@ISA); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 507 | 12 | @ISA = ( "XML::Stream::XPath::Op" ); | |||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||
| 509 | sub new | ||||||||||||||||||||||||||||
| 510 | { | ||||||||||||||||||||||||||||
| 511 | 156 | ▶ | my $proto = shift; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 512 | 156 | my $name = shift; | |||||||||||||||||||||||||||
| 513 | 156 | my $self = $proto->allocate("ATTRIBUTE",$name); | |||||||||||||||||||||||||||
| 514 | 156 | return $self; | |||||||||||||||||||||||||||
| 515 | } | ||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||
| 518 | sub isValid | ||||||||||||||||||||||||||||
| 519 | { | ||||||||||||||||||||||||||||
| 520 | 186 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
isValid: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||
| 521 | 186 | my $ctxt = shift; | |||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||
| 523 | 186 | my @elems = $$ctxt->getList(); | |||||||||||||||||||||||||||
| 524 | 186 | my @valid_elems; | |||||||||||||||||||||||||||
| 525 | my @values; | ||||||||||||||||||||||||||||
| 526 | 186 | my %attribs; | |||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||
| 528 | 186 | foreach my $elem (@elems) | |||||||||||||||||||||||||||
| 529 | { | ||||||||||||||||||||||||||||
| 530 | 194 | ▶ | if ($self->{VALUE} ne "*") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 531 | { | ||||||||||||||||||||||||||||
| 532 | 192 | ▶ | if (&XML::Stream::GetXMLData("value",$elem,"",$self->{VALUE})) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 533 | { | ||||||||||||||||||||||||||||
| 534 | 36 | $self->{VAL} = $self->calcStr($elem); | |||||||||||||||||||||||||||
| 535 | 36 | push(@valid_elems,$elem); | |||||||||||||||||||||||||||
| 536 | 36 | push(@values,$self->{VAL}); | |||||||||||||||||||||||||||
| 537 | } | ||||||||||||||||||||||||||||
| 538 | } | ||||||||||||||||||||||||||||
| 539 | else | ||||||||||||||||||||||||||||
| 540 | { | ||||||||||||||||||||||||||||
| 541 | 2 | my %attrib = &XML::Stream::GetXMLData("attribs",$elem); | |||||||||||||||||||||||||||
| 542 | 2 | ▶ | if (scalar(keys(%attrib)) > 0) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 543 | { | ||||||||||||||||||||||||||||
| 544 | 2 | push(@valid_elems,$elem); | |||||||||||||||||||||||||||
| 545 | 2 | foreach my $key (keys(%attrib)) | |||||||||||||||||||||||||||
| 546 | { | ||||||||||||||||||||||||||||
| 547 | 2 | $attribs{$key} = $attrib{$key}; | |||||||||||||||||||||||||||
| 548 | } | ||||||||||||||||||||||||||||
| 549 | } | ||||||||||||||||||||||||||||
| 550 | } | ||||||||||||||||||||||||||||
| 551 | } | ||||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||
| 553 | 186 | $$ctxt->setList(@valid_elems); | |||||||||||||||||||||||||||
| 554 | 186 | $$ctxt->setValues(@values); | |||||||||||||||||||||||||||
| 555 | 186 | $$ctxt->setAttribs(%attribs); | |||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||
| 557 | 186 | ▶ | if ($#valid_elems == -1) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 558 | { | ||||||||||||||||||||||||||||
| 559 | 150 | return; | |||||||||||||||||||||||||||
| 560 | } | ||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||
| 562 | 36 | return 1; | |||||||||||||||||||||||||||
| 563 | } | ||||||||||||||||||||||||||||
| 564 | |||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||
| 566 | sub getValue | ||||||||||||||||||||||||||||
| 567 | { | ||||||||||||||||||||||||||||
| 568 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
getValue: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 569 | 0 | return $self->{VAL}; | |||||||||||||||||||||||||||
| 570 | } | ||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||
| 573 | sub calcStr | ||||||||||||||||||||||||||||
| 574 | { | ||||||||||||||||||||||||||||
| 575 | 48 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
calcStr: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 576 | 48 | my $elem = shift; | |||||||||||||||||||||||||||
| 577 | 48 | return &XML::Stream::GetXMLData("value",$elem,"",$self->{VALUE}); | |||||||||||||||||||||||||||
| 578 | } | ||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||
| 583 | ############################################################################## | ||||||||||||||||||||||||||||
| 584 | # | ||||||||||||||||||||||||||||
| 585 | # AndOp - class to handle [ .... and .... ] ops | ||||||||||||||||||||||||||||
| 586 | # | ||||||||||||||||||||||||||||
| 587 | ############################################################################## | ||||||||||||||||||||||||||||
| 588 | package XML::Stream::XPath::AndOp; | ||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||
| 590 | 12 | ▶ | use vars qw (@ISA); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 591 | 12 | @ISA = ( "XML::Stream::XPath::Op" ); | |||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||
| 593 | sub new | ||||||||||||||||||||||||||||
| 594 | { | ||||||||||||||||||||||||||||
| 595 | 4 | ▶ | my $proto = shift; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 596 | 4 | my $self = $proto->allocate("AND","and"); | |||||||||||||||||||||||||||
| 597 | 4 | $self->{OP_L} = shift; | |||||||||||||||||||||||||||
| 598 | 4 | $self->{OP_R} = shift; | |||||||||||||||||||||||||||
| 599 | 4 | return $self; | |||||||||||||||||||||||||||
| 600 | } | ||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||
| 603 | sub isValid | ||||||||||||||||||||||||||||
| 604 | { | ||||||||||||||||||||||||||||
| 605 | 18 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
isValid: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 606 | 18 | my $ctxt = shift; | |||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||
| 608 | 18 | my $opl = $self->{OP_L}->isValid($ctxt); | |||||||||||||||||||||||||||
| 609 | 18 | my $opr = $self->{OP_R}->isValid($ctxt); | |||||||||||||||||||||||||||
| 610 | |||||||||||||||||||||||||||||
| 611 | 18 | ▶ | if ($opl && $opr) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$opl and $opr
MC/DC100%2/2
$opl and $opr
$opl
$opr
Truth table100%3/3
A and B
A= $oplB= $opr
| |||||||||||||||||||||||||||||
| 612 | { | ||||||||||||||||||||||||||||
| 613 | 4 | return 1; | |||||||||||||||||||||||||||
| 614 | } | ||||||||||||||||||||||||||||
| 615 | else | ||||||||||||||||||||||||||||
| 616 | { | ||||||||||||||||||||||||||||
| 617 | 14 | return; | |||||||||||||||||||||||||||
| 618 | } | ||||||||||||||||||||||||||||
| 619 | } | ||||||||||||||||||||||||||||
| 620 | |||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||
| 622 | sub display | ||||||||||||||||||||||||||||
| 623 | { | ||||||||||||||||||||||||||||
| 624 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
display: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 625 | 0 | my $space = shift; | |||||||||||||||||||||||||||
| 626 | 0 | ▶ | $space = "" unless defined($space); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||
| 628 | 0 | print $space,"OP: type(AND)\n"; | |||||||||||||||||||||||||||
| 629 | 0 | print $space," op_l: \n"; | |||||||||||||||||||||||||||
| 630 | 0 | $self->{OP_L}->display($space." "); | |||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||
| 632 | 0 | print $space," op_r: \n"; | |||||||||||||||||||||||||||
| 633 | 0 | $self->{OP_R}->display($space." "); | |||||||||||||||||||||||||||
| 634 | } | ||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||
| 636 | |||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||
| 638 | ############################################################################## | ||||||||||||||||||||||||||||
| 639 | # | ||||||||||||||||||||||||||||
| 640 | # OrOp - class to handle [ .... or .... ] ops | ||||||||||||||||||||||||||||
| 641 | # | ||||||||||||||||||||||||||||
| 642 | ############################################################################## | ||||||||||||||||||||||||||||
| 643 | package XML::Stream::XPath::OrOp; | ||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||
| 645 | 12 | ▶ | use vars qw (@ISA); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 646 | 12 | @ISA = ( "XML::Stream::XPath::Op" ); | |||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||
| 648 | sub new | ||||||||||||||||||||||||||||
| 649 | { | ||||||||||||||||||||||||||||
| 650 | 68 | ▶ | my $proto = shift; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 651 | 68 | my $self = $proto->allocate("OR","or"); | |||||||||||||||||||||||||||
| 652 | 68 | $self->{OP_L} = shift; | |||||||||||||||||||||||||||
| 653 | 68 | $self->{OP_R} = shift; | |||||||||||||||||||||||||||
| 654 | 68 | return $self; | |||||||||||||||||||||||||||
| 655 | } | ||||||||||||||||||||||||||||
| 656 | |||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||
| 658 | sub isValid | ||||||||||||||||||||||||||||
| 659 | { | ||||||||||||||||||||||||||||
| 660 | 68 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
isValid: called CC=5 SCAR=16.8
| |||||||||||||||||||||||||||||
| 661 | 68 | my $ctxt = shift; | |||||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||||
| 663 | 68 | my @elems = $$ctxt->getList(); | |||||||||||||||||||||||||||
| 664 | 68 | my @valid_elems; | |||||||||||||||||||||||||||
| 665 | |||||||||||||||||||||||||||||
| 666 | 68 | foreach my $elem (@elems) | |||||||||||||||||||||||||||
| 667 | { | ||||||||||||||||||||||||||||
| 668 | 68 | my $tmp_ctxt_l = XML::Stream::XPath::Value->new($elem); | |||||||||||||||||||||||||||
| 669 | 68 | $tmp_ctxt_l->in_context(1); | |||||||||||||||||||||||||||
| 670 | 68 | my $tmp_ctxt_r = XML::Stream::XPath::Value->new($elem); | |||||||||||||||||||||||||||
| 671 | 68 | $tmp_ctxt_r->in_context(1); | |||||||||||||||||||||||||||
| 672 | |||||||||||||||||||||||||||||
| 673 | 68 | my $opl = $self->{OP_L}->isValid(\$tmp_ctxt_l); | |||||||||||||||||||||||||||
| 674 | 68 | my $opr = $self->{OP_R}->isValid(\$tmp_ctxt_r); | |||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||
| 676 | 68 | ▶ | if ($opl || $opr) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$opl or $opr
MC/DC0%0/2
$opl or $opr
$opl
$opr
Truth table33%1/3
A or B
A= $oplB= $opr
| |||||||||||||||||||||||||||||
| 677 | { | ||||||||||||||||||||||||||||
| 678 | 0 | push(@valid_elems,$elem); | |||||||||||||||||||||||||||
| 679 | } | ||||||||||||||||||||||||||||
| 680 | } | ||||||||||||||||||||||||||||
| 681 | |||||||||||||||||||||||||||||
| 682 | 68 | $$ctxt->setList(@valid_elems); | |||||||||||||||||||||||||||
| 683 | |||||||||||||||||||||||||||||
| 684 | 68 | ▶ | if ($#valid_elems == -1) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 685 | { | ||||||||||||||||||||||||||||
| 686 | 68 | return; | |||||||||||||||||||||||||||
| 687 | } | ||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||
| 689 | 0 | return 1; | |||||||||||||||||||||||||||
| 690 | } | ||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||
| 692 | |||||||||||||||||||||||||||||
| 693 | sub display | ||||||||||||||||||||||||||||
| 694 | { | ||||||||||||||||||||||||||||
| 695 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
display: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 696 | 0 | my $space = shift; | |||||||||||||||||||||||||||
| 697 | 0 | ▶ | $space = "" unless defined($space); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||
| 699 | 0 | print "${space}OP: type(OR)\n"; | |||||||||||||||||||||||||||
| 700 | 0 | print "$space op_l: "; | |||||||||||||||||||||||||||
| 701 | 0 | $self->{OP_L}->display("$space "); | |||||||||||||||||||||||||||
| 702 | |||||||||||||||||||||||||||||
| 703 | 0 | print "$space op_r: "; | |||||||||||||||||||||||||||
| 704 | 0 | $self->{OP_R}->display("$space "); | |||||||||||||||||||||||||||
| 705 | } | ||||||||||||||||||||||||||||
| 706 | |||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||
| 708 | |||||||||||||||||||||||||||||
| 709 | ############################################################################## | ||||||||||||||||||||||||||||
| 710 | # | ||||||||||||||||||||||||||||
| 711 | # FunctionOp - class to handle xxxx(...) ops | ||||||||||||||||||||||||||||
| 712 | # | ||||||||||||||||||||||||||||
| 713 | ############################################################################## | ||||||||||||||||||||||||||||
| 714 | package XML::Stream::XPath::FunctionOp; | ||||||||||||||||||||||||||||
| 715 | |||||||||||||||||||||||||||||
| 716 | 12 | ▶ | use vars qw (@ISA); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 717 | 12 | @ISA = ( "XML::Stream::XPath::Op" ); | |||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||
| 719 | sub new | ||||||||||||||||||||||||||||
| 720 | { | ||||||||||||||||||||||||||||
| 721 | 14 | ▶ | my $proto = shift; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 722 | 14 | my $function = shift; | |||||||||||||||||||||||||||
| 723 | 14 | my $self = $proto->allocate("FUNCTION",$function); | |||||||||||||||||||||||||||
| 724 | 14 | $self->{CLOSED} = 0; | |||||||||||||||||||||||||||
| 725 | 14 | return $self; | |||||||||||||||||||||||||||
| 726 | } | ||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||
| 728 | |||||||||||||||||||||||||||||
| 729 | sub addArg | ||||||||||||||||||||||||||||
| 730 | { | ||||||||||||||||||||||||||||
| 731 | 6 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
addArg: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 732 | 6 | my $arg = shift; | |||||||||||||||||||||||||||
| 733 | |||||||||||||||||||||||||||||
| 734 | 6 | push(@{$self->{ARGOPS}},$arg); | |||||||||||||||||||||||||||
| 735 | } | ||||||||||||||||||||||||||||
| 736 | |||||||||||||||||||||||||||||
| 737 | |||||||||||||||||||||||||||||
| 738 | sub isValid | ||||||||||||||||||||||||||||
| 739 | { | ||||||||||||||||||||||||||||
| 740 | 26 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
isValid: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 741 | 26 | my $ctxt = shift; | |||||||||||||||||||||||||||
| 742 | |||||||||||||||||||||||||||||
| 743 | 26 | my $result; | |||||||||||||||||||||||||||
| 744 | 26 | eval("\$result = &{\$XML::Stream::XPath::FUNCTIONS{\$self->{VALUE}}}(\$ctxt,\@{\$self->{ARGOPS}});"); | |||||||||||||||||||||||||||
| 745 | 26 | return $result; | |||||||||||||||||||||||||||
| 746 | } | ||||||||||||||||||||||||||||
| 747 | |||||||||||||||||||||||||||||
| 748 | |||||||||||||||||||||||||||||
| 749 | sub calcStr | ||||||||||||||||||||||||||||
| 750 | { | ||||||||||||||||||||||||||||
| 751 | 14 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
calcStr: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 752 | 14 | my $elem = shift; | |||||||||||||||||||||||||||
| 753 | |||||||||||||||||||||||||||||
| 754 | 14 | my $result; | |||||||||||||||||||||||||||
| 755 | 14 | eval("\$result = &{\$XML::Stream::XPath::VALUES{\$self->{VALUE}}}(\$elem);"); | |||||||||||||||||||||||||||
| 756 | 14 | return $result; | |||||||||||||||||||||||||||
| 757 | |||||||||||||||||||||||||||||
| 758 | } | ||||||||||||||||||||||||||||
| 759 | |||||||||||||||||||||||||||||
| 760 | |||||||||||||||||||||||||||||
| 761 | sub display | ||||||||||||||||||||||||||||
| 762 | { | ||||||||||||||||||||||||||||
| 763 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
display: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 764 | 0 | my $space = shift; | |||||||||||||||||||||||||||
| 765 | 0 | ▶ | $space = "" unless defined($space); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 766 | |||||||||||||||||||||||||||||
| 767 | 0 | print $space,"OP: type(FUNCTION)\n"; | |||||||||||||||||||||||||||
| 768 | 0 | print $space," $self->{VALUE}(\n"; | |||||||||||||||||||||||||||
| 769 | 0 | foreach my $arg (@{$self->{ARGOPS}}) | |||||||||||||||||||||||||||
| 770 | { | ||||||||||||||||||||||||||||
| 771 | 0 | print $arg,"\n"; | |||||||||||||||||||||||||||
| 772 | 0 | $arg->display($space." "); | |||||||||||||||||||||||||||
| 773 | } | ||||||||||||||||||||||||||||
| 774 | 0 | print "$space )\n"; | |||||||||||||||||||||||||||
| 775 | } | ||||||||||||||||||||||||||||
| 776 | |||||||||||||||||||||||||||||
| 777 | |||||||||||||||||||||||||||||
| 778 | sub function_name | ||||||||||||||||||||||||||||
| 779 | { | ||||||||||||||||||||||||||||
| 780 | 8 | ▶ | my $ctxt = shift; | ||||||||||||||||||||||||||
|
Subroutine
function_name: called CC=4 SCAR=14.0
| |||||||||||||||||||||||||||||
| 781 | 8 | my (@args) = @_; | |||||||||||||||||||||||||||
| 782 | |||||||||||||||||||||||||||||
| 783 | 8 | my @elems = $$ctxt->getList(); | |||||||||||||||||||||||||||
| 784 | 8 | my @valid_elems; | |||||||||||||||||||||||||||
| 785 | my @valid_values; | ||||||||||||||||||||||||||||
| 786 | 8 | foreach my $elem (@elems) | |||||||||||||||||||||||||||
| 787 | { | ||||||||||||||||||||||||||||
| 788 | 8 | my $text = &value_name($elem); | |||||||||||||||||||||||||||
| 789 | 8 | ▶ | if (defined($text)) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 790 | { | ||||||||||||||||||||||||||||
| 791 | 8 | push(@valid_elems,$elem); | |||||||||||||||||||||||||||
| 792 | 8 | push(@valid_values,$text); | |||||||||||||||||||||||||||
| 793 | } | ||||||||||||||||||||||||||||
| 794 | } | ||||||||||||||||||||||||||||
| 795 | |||||||||||||||||||||||||||||
| 796 | 8 | $$ctxt->setList(@valid_elems); | |||||||||||||||||||||||||||
| 797 | 8 | $$ctxt->setValues(@valid_values); | |||||||||||||||||||||||||||
| 798 | |||||||||||||||||||||||||||||
| 799 | 8 | ▶ | if ($#valid_elems == -1) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 800 | { | ||||||||||||||||||||||||||||
| 801 | 0 | return; | |||||||||||||||||||||||||||
| 802 | } | ||||||||||||||||||||||||||||
| 803 | |||||||||||||||||||||||||||||
| 804 | 8 | return 1; | |||||||||||||||||||||||||||
| 805 | } | ||||||||||||||||||||||||||||
| 806 | |||||||||||||||||||||||||||||
| 807 | |||||||||||||||||||||||||||||
| 808 | sub function_not | ||||||||||||||||||||||||||||
| 809 | { | ||||||||||||||||||||||||||||
| 810 | 6 | ▶ | my $ctxt = shift; | ||||||||||||||||||||||||||
|
Subroutine
function_not: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||
| 811 | 6 | my (@args) = @_; | |||||||||||||||||||||||||||
| 812 | |||||||||||||||||||||||||||||
| 813 | 6 | my @elems = $$ctxt->getList(); | |||||||||||||||||||||||||||
| 814 | 6 | my @valid_elems; | |||||||||||||||||||||||||||
| 815 | 6 | foreach my $elem (@elems) | |||||||||||||||||||||||||||
| 816 | { | ||||||||||||||||||||||||||||
| 817 | 6 | my $tmp_ctxt = XML::Stream::XPath::Value->new($elem); | |||||||||||||||||||||||||||
| 818 | 6 | $tmp_ctxt->in_context(1); | |||||||||||||||||||||||||||
| 819 | 6 | ▶ | if (!($args[0]->isValid(\$tmp_ctxt))) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 820 | { | ||||||||||||||||||||||||||||
| 821 | 2 | push(@valid_elems,$elem); | |||||||||||||||||||||||||||
| 822 | } | ||||||||||||||||||||||||||||
| 823 | } | ||||||||||||||||||||||||||||
| 824 | |||||||||||||||||||||||||||||
| 825 | 6 | $$ctxt->setList(@valid_elems); | |||||||||||||||||||||||||||
| 826 | |||||||||||||||||||||||||||||
| 827 | 6 | ▶ | if ($#valid_elems == -1) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 828 | { | ||||||||||||||||||||||||||||
| 829 | 4 | return; | |||||||||||||||||||||||||||
| 830 | } | ||||||||||||||||||||||||||||
| 831 | |||||||||||||||||||||||||||||
| 832 | 2 | return 1; | |||||||||||||||||||||||||||
| 833 | } | ||||||||||||||||||||||||||||
| 834 | |||||||||||||||||||||||||||||
| 835 | |||||||||||||||||||||||||||||
| 836 | sub function_text | ||||||||||||||||||||||||||||
| 837 | { | ||||||||||||||||||||||||||||
| 838 | 4 | ▶ | my $ctxt = shift; | ||||||||||||||||||||||||||
|
Subroutine
function_text: called CC=4 SCAR=14.0
| |||||||||||||||||||||||||||||
| 839 | 4 | my (@args) = @_; | |||||||||||||||||||||||||||
| 840 | |||||||||||||||||||||||||||||
| 841 | 4 | my @elems = $$ctxt->getList(); | |||||||||||||||||||||||||||
| 842 | 4 | my @valid_elems; | |||||||||||||||||||||||||||
| 843 | my @valid_values; | ||||||||||||||||||||||||||||
| 844 | 4 | foreach my $elem (@elems) | |||||||||||||||||||||||||||
| 845 | { | ||||||||||||||||||||||||||||
| 846 | 4 | my $text = &value_text($elem); | |||||||||||||||||||||||||||
| 847 | 4 | ▶ | if (defined($text)) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 848 | { | ||||||||||||||||||||||||||||
| 849 | 4 | push(@valid_elems,$elem); | |||||||||||||||||||||||||||
| 850 | 4 | push(@valid_values,$text); | |||||||||||||||||||||||||||
| 851 | } | ||||||||||||||||||||||||||||
| 852 | } | ||||||||||||||||||||||||||||
| 853 | |||||||||||||||||||||||||||||
| 854 | 4 | $$ctxt->setList(@valid_elems); | |||||||||||||||||||||||||||
| 855 | 4 | $$ctxt->setValues(@valid_values); | |||||||||||||||||||||||||||
| 856 | |||||||||||||||||||||||||||||
| 857 | 4 | ▶ | if ($#valid_elems == -1) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 858 | { | ||||||||||||||||||||||||||||
| 859 | 0 | return; | |||||||||||||||||||||||||||
| 860 | } | ||||||||||||||||||||||||||||
| 861 | |||||||||||||||||||||||||||||
| 862 | 4 | return 1; | |||||||||||||||||||||||||||
| 863 | } | ||||||||||||||||||||||||||||
| 864 | |||||||||||||||||||||||||||||
| 865 | |||||||||||||||||||||||||||||
| 866 | sub function_startswith | ||||||||||||||||||||||||||||
| 867 | { | ||||||||||||||||||||||||||||
| 868 | 8 | ▶ | my $ctxt = shift; | ||||||||||||||||||||||||||
|
Subroutine
function_startswith: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||
| 869 | 8 | my (@args) = @_; | |||||||||||||||||||||||||||
| 870 | |||||||||||||||||||||||||||||
| 871 | 8 | my @elems = $$ctxt->getList(); | |||||||||||||||||||||||||||
| 872 | 8 | my @valid_elems; | |||||||||||||||||||||||||||
| 873 | 8 | foreach my $elem (@elems) | |||||||||||||||||||||||||||
| 874 | { | ||||||||||||||||||||||||||||
| 875 | 8 | my $val1 = $args[0]->calcStr($elem); | |||||||||||||||||||||||||||
| 876 | 8 | my $val2 = $args[1]->calcStr($elem); | |||||||||||||||||||||||||||
| 877 | |||||||||||||||||||||||||||||
| 878 | 8 | ▶ | if (substr($val1,0,length($val2)) eq $val2) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 879 | { | ||||||||||||||||||||||||||||
| 880 | 4 | push(@valid_elems,$elem); | |||||||||||||||||||||||||||
| 881 | } | ||||||||||||||||||||||||||||
| 882 | } | ||||||||||||||||||||||||||||
| 883 | |||||||||||||||||||||||||||||
| 884 | 8 | $$ctxt->setList(@valid_elems); | |||||||||||||||||||||||||||
| 885 | |||||||||||||||||||||||||||||
| 886 | 8 | ▶ | if ($#valid_elems == -1) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 887 | { | ||||||||||||||||||||||||||||
| 888 | 4 | return; | |||||||||||||||||||||||||||
| 889 | } | ||||||||||||||||||||||||||||
| 890 | |||||||||||||||||||||||||||||
| 891 | 4 | return 1; | |||||||||||||||||||||||||||
| 892 | } | ||||||||||||||||||||||||||||
| 893 | |||||||||||||||||||||||||||||
| 894 | |||||||||||||||||||||||||||||
| 895 | sub value_name | ||||||||||||||||||||||||||||
| 896 | { | ||||||||||||||||||||||||||||
| 897 | 14 | ▶ | my $elem = shift; | ||||||||||||||||||||||||||
|
Subroutine
value_name: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 898 | 14 | return &XML::Stream::GetXMLData("tag",$elem); | |||||||||||||||||||||||||||
| 899 | } | ||||||||||||||||||||||||||||
| 900 | |||||||||||||||||||||||||||||
| 901 | |||||||||||||||||||||||||||||
| 902 | sub value_text | ||||||||||||||||||||||||||||
| 903 | { | ||||||||||||||||||||||||||||
| 904 | 12 | ▶ | my $elem = shift; | ||||||||||||||||||||||||||
|
Subroutine
value_text: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 905 | 12 | return &XML::Stream::GetXMLData("value",$elem); | |||||||||||||||||||||||||||
| 906 | } | ||||||||||||||||||||||||||||
| 907 | |||||||||||||||||||||||||||||
| 908 | |||||||||||||||||||||||||||||
| 909 | |||||||||||||||||||||||||||||
| 910 | 12 | $XML::Stream::XPath::FUNCTIONS{'name'} = \&function_name; | |||||||||||||||||||||||||||
| 911 | 12 | $XML::Stream::XPath::FUNCTIONS{'not'} = \&function_not; | |||||||||||||||||||||||||||
| 912 | 12 | $XML::Stream::XPath::FUNCTIONS{'text'} = \&function_text; | |||||||||||||||||||||||||||
| 913 | 12 | $XML::Stream::XPath::FUNCTIONS{'starts-with'} = \&function_startswith; | |||||||||||||||||||||||||||
| 914 | |||||||||||||||||||||||||||||
| 915 | 12 | $XML::Stream::XPath::VALUES{'name'} = \&value_name; | |||||||||||||||||||||||||||
| 916 | 12 | $XML::Stream::XPath::VALUES{'text'} = \&value_text; | |||||||||||||||||||||||||||
| 917 | |||||||||||||||||||||||||||||
| 918 | 12 | 1; | |||||||||||||||||||||||||||
| 919 | |||||||||||||||||||||||||||||
| 920 | |||||||||||||||||||||||||||||