Meta/List.pm

filter: Statementstmt 61.8% 196 / 317 Branchbran 38.1% 77 / 202 Conditioncond 26.6% 29 / 109 MC/DCmcdc 9.8% 7 / 71 Subroutinesub 90.9% 20 / 22 Podpod 46.6% 7 / 15 totaltotal 45.6% 336 / 736 CC 144 SCAR 56.2
CC
144
Cov
48%
buildIndexAll
930.0
buildIndex
311.1
createIndex
223.4
CRAP 275.4
↑ Summary Meta/File/List.pm »
1 #
2 # @author Bodo (Hugo) Barwich
3 # @version 2025-10-21
4 # @package Object::Meta
5 # @subpackage Object/Meta/List.pm
6  
7 # This Module defines Classes to manage Data in an indexed List
8 #
9 #---------------------------------
10 # Requirements:
11 # - The Perl Package "libconst-fast-perl" must be installed
12 #
13 #---------------------------------
14 # Features:
15 # - Numerical Key Values in Object::Meta::List
16 # - Adding a Object::Meta Object to the Object::Meta::List by the Index Value
17 #
18  
19 #==============================================================================
20 # The Object::Meta::List Package
21  
22 =head1 NAME
23  
24 Object::Meta::List - Library to access C<Object::Meta> objects by B<Index Value>
25 and by insertion order.
26  
27 C<Object::Meta::List> enherits from C<Object::Meta> the capability to store Meta Data
28 which is used to create autogenerated object indices in-memory.
29  
30 =cut
31  
32 package Object::Meta::List;
33  
34 #----------------------------------------------------------------------------
35 #Dependencies
36  
37 4 ▶use parent 'Object::Meta';
Subroutine BEGIN: called CC=1 SCAR=0.0
38  
39 4 ▶use Scalar::Util qw(blessed);
Subroutine BEGIN: called CC=1 SCAR=0.0
40  
41 4 ▶use constant LIST_ENTRIES => 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
42 4 ▶use constant LIST_ENTRIES_INDEXED => 3;
Subroutine BEGIN: called CC=1 SCAR=0.0
43  
44 4 ▶use constant PRIMARY_INDEXNAME => 'primary';
Subroutine BEGIN: called CC=1 SCAR=0.0
45  
46 #----------------------------------------------------------------------------
47 #Constructors
48  
49 =head1 METHODS
50  
51 =head2 Constructor
52  
53 =head3 new ( [ DATA ] )
54  
55 This is the constructor for a new C<Object::Meta::List> object.
56  
57 Since C<Object::Meta::List> is also a C<Object::Meta> it can also hold meta data.
58  
59 B<Parameters:>
60  
61 =over 4
62  
63 =item C<DATA>
64  
65 The B<raw data> which is passed in a hash like fashion, using key and value pairs.
66 This is passed to the inherited C<Object::Meta> constructor.
67  
68 =back
69  
70 =cut
71  
72 13 ▶sub new {
Subroutine new: called CC=2 SCAR=7.2
Pod documented
73 13 ▶ my $class = ref( $_[0] ) || $_[0];
Condition33%1/3
ref $_[0] || $_[0]
l!l&&r!l&&!r
0130
MC/DC0%0/2
ref $_[0] || $_[0]
ref $_[0] $_[0]
Truth table33%1/3
A || B
A= ref $_[0]B= $_[0]
ABresult
1X1
011
000
74  
75 13 my $self = $class->SUPER::new( @_[ 1 .. $#_ ] );
76  
77 #Create the additional Entry Lists
78 13 $self->[LIST_ENTRIES] = ();
79 13 $self->[LIST_ENTRIES_INDEXED] = ();
80  
81 #Give the Object back
82 13 return $self;
83 }
84  
85 13 ▶sub DESTROY {
Subroutine DESTROY: called CC=1 SCAR=0.0
86 13 my $self = $_[0];
87  
88 #Free the Entry Lists
89 13 $self->[LIST_ENTRIES] = ();
90 13 $self->[LIST_ENTRIES_INDEXED] = ();
91  
92 #Call Base Class Destructor
93 13 $self->SUPER::DESTROY;
94 }
95  
96 #----------------------------------------------------------------------------
97 #Administration Methods
98  
99 9 ▶sub setIndexField {
Subroutine setIndexField: called CC=4 SCAR=15.0
Pod documented
100 9 my ( $self, $sindexname, $sindexfield ) = @_;
101  
102 9 ▶ unless ( defined $sindexfield ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $sindexfield) 9 0 9
103 9 $sindexfield = $sindexname;
104 9 $sindexname = PRIMARY_INDEXNAME;
105 }
106  
107 #print "'" . (caller(1))[3] . "' : Signal to '" . (caller(0))[3] . "'\n";
108 #print "" . (caller(0))[3] . " - idx nm: '$sindexname'; idx fld: '$sindexfield'\n";
109  
110 9 ▶ if ( defined $sindexfield
Branch: 1 branch
BranchTrueFalseTotal
if (defined $sindexfield and $sindexfield ne "") 9 0 9
Condition33%1/3
defined $sindexfield and $sindexfield ne ""
!ll&&!rl&&r
009
MC/DC0%0/2
defined $sindexfield and $sindexfield ne ""
defined $sindexfield $sindexfield ne ""
Truth table33%1/3
A and B
A= defined $sindexfieldB= $sindexfield ne ""
ABresult
0X0
100
111
111 && $sindexfield ne "" )
112 {
113 9 $self->createIndex(
114 ( 'indexname' => $sindexname, 'checkfield' => $sindexfield ) );
115 }
116 }
117  
118 =head2 Administration Methods
119  
120 =head3 Add ( [ C<Object::Meta> | DATA ] )
121  
122 This adds new items to the list.
123  
124 If no parameter is given it creates an empty instance of C<Object::Meta>
125 and adds it to the list
126  
127 B<Parameters:>
128  
129 =over 4
130  
131 =item C<Object::Meta>
132  
133 An instance of C<Object::Meta> to be added to the list.
134  
135 =item C<DATA>
136  
137 A hash with data to create an instance of C<Object::Meta> and add it to the list.
138  
139 =back
140  
141 B<Returns:> C<Object::Meta> - The object which was created or added.
142  
143 See L<Method C<Object::Meta::new()>|Object::Meta/"new ( [ DATA ] )">
144  
145 =cut
146  
147 30 ▶sub Add {
Subroutine Add: called CC=10 SCAR=24.2
Pod documented
148 30 my $self = $_[0];
149 30 my $mtaety = undef;
150  
151 30 ▶ if ( scalar(@_) > 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @_ > 1) 30 0 30
152 30 ▶ if ( defined blessed $_[1] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined builtin::blessed($_[1])) { } 15 15 30
153 15 $mtaety = $_[1];
154 }
155 else #Parameter is not an Object
156 {
157 15 ▶ if ( scalar(@_) > 2 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @_ > 2) { } 6 9 15
158  
159 #Create the new Object::Meta from the given Parameters
160 6 $mtaety = Object::Meta::->new( @_[ 1 .. $#_ ] );
161 }
162 else #A Single Scalar Parameter
163 {
164 #Create the new Object::Meta with the Index Value
165 9 $mtaety = Object::Meta::->new( $self->getIndexField, $_[1] );
166 }
167 }
168 }
169  
170 30 ▶ if ( defined $mtaety ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $mtaety) 30 0 30
171 30 ▶ unless ( $mtaety->isa('Object::Meta') ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($mtaety->isa("Object::Meta")) 0 30 30
172 0 $mtaety = undef;
173 }
174 }
175  
176 30 ▶ $mtaety = Object::Meta::->new unless ( defined $mtaety );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $mtaety 0 30 30
177  
178 30 ▶ if ( defined $mtaety
Branch: 1 branch
BranchTrueFalseTotal
if (defined $mtaety and $mtaety->isa("Object::Meta")) 30 0 30
Condition33%1/3
defined $mtaety and $mtaety->isa("Object::Meta")
!ll&&!rl&&r
0030
MC/DC0%0/2
defined $mtaety and $mtaety->isa("Object::Meta")
defined $mtaety $mtaety->isa("Object::Meta")
Truth table33%1/3
A and B
A= defined $mtaetyB= $mtaety->isa("Object::Meta")
ABresult
0X0
100
111
179 && $mtaety->isa("Object::Meta") )
180 {
181 30 my $ietycnt = $self->getMetaObjectCount;
182  
183 30 push @{ $self->[LIST_ENTRIES] }, ($mtaety);
184  
185 30 ▶ $ietycnt = 0 if ( $ietycnt < 0 );
Branch: 1 branch
BranchTrueFalseTotal
if $ietycnt < 0 0 30 30
186  
187 #Update the MetaEntry Count
188 30 $self->setMeta( "entrycount", $ietycnt + 1 );
189  
190 #Add the the MetaEntry Object to the Index Lists
191 30 $self->_indexMetaObject($mtaety);
192  
193 } #if(defined $mtaety && $mtaety->isa("Object::Meta"))
194  
195 #Give the added Object::Meta back
196 30 return $mtaety;
197 }
198  
199 30 ▶sub _indexMetaObject {
Subroutine _indexMetaObject: called CC=18 SCAR=29.2
200 30 my ( $self, $mtaety ) = @_;
201  
202 30 ▶ if ( defined $mtaety
Branch: 1 branch
BranchTrueFalseTotal
if (defined $mtaety and $mtaety->isa("Object::Meta")) 30 0 30
Condition33%1/3
defined $mtaety and $mtaety->isa("Object::Meta")
!ll&&!rl&&r
0030
MC/DC0%0/2
defined $mtaety and $mtaety->isa("Object::Meta")
defined $mtaety $mtaety->isa("Object::Meta")
Truth table33%1/3
A and B
A= defined $mtaetyB= $mtaety->isa("Object::Meta")
ABresult
0X0
100
111
203 && $mtaety->isa('Object::Meta') )
204 {
205 30 my $hshidxcnfs = $self->getMeta( 'indexconfiguration', {} );
206 30 my $hshidxcnf = undef;
207 30 my $iupdidxcnf = 0;
208  
209 30 my $slstmnidxvl = '';
210 30 my $slstidxvl = '';
211 30 my $slstchkvl = '';
212  
213 30 foreach ( keys %{$hshidxcnfs} ) {
214 36 $hshidxcnf = $hshidxcnfs->{$_};
215  
216 36 ▶ if ( defined $hshidxcnf ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $hshidxcnf) 36 0 36
217 $mtaety->setIndexField( $hshidxcnf->{'indexfield'} )
218 36 ▶ if ( $hshidxcnf->{'indexname'} eq PRIMARY_INDEXNAME );
Branch: 1 branch
BranchTrueFalseTotal
if $hshidxcnf->{"indexname"} eq "primary" 24 12 36
219  
220 $slstmnidxvl =
221 36 $mtaety->get( $hshidxcnf->{'indexfield'}, undef );
222 $slstchkvl = $mtaety->get( $hshidxcnf->{'checkfield'},
223 36 undef, $hshidxcnf->{'meta'} );
224 36 $slstidxvl = '';
225  
226 36 ▶ if ( defined $slstchkvl
Branch: 1 branch
BranchTrueFalseTotal
if (defined $slstchkvl and $slstchkvl ne "") 32 4 36
Condition66%2/3
defined $slstchkvl and $slstchkvl ne ""
!ll&&!rl&&r
4032
MC/DC50%1/2
defined $slstchkvl and $slstchkvl ne ""
defined $slstchkvl $slstchkvl ne ""
Truth table66%2/3
A and B
A= defined $slstchkvlB= $slstchkvl ne ""
ABresult
0X0
100
111
227 && $slstchkvl ne '' )
228 {
229 32 ▶ if ( $hshidxcnf->{'checkvalue'} ne '' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($hshidxcnf->{'checkvalue'} ne '') { } 8 24 32
230 $slstidxvl = $slstmnidxvl
231 8 ▶ if ( "$slstchkvl" eq $hshidxcnf->{'checkvalue'} . ''
Branch: 1 branch
BranchTrueFalseTotal
if "$slstchkvl" eq $hshidxcnf->{"checkvalue"} . '' and defined $slstmnidxvl 6 2 8
Condition66%2/3
"$slstchkvl" eq $hshidxcnf->{"checkvalue"} . '' and defined $slstmnidxvl
!ll&&!rl&&r
206
MC/DC50%1/2
"$slstchkvl" eq $hshidxcnf->{"checkvalue"} . '' and defined $slstmnidxvl
"$slstchkvl" eq $hshidxcnf->{"checkvalue"} . '' defined $slstmnidxvl
Truth table66%2/3
A and B
A= "$slstchkvl" eq $hshidxcnf->{"checkvalue"} . ''B= defined $slstmnidxvl
ABresult
0X0
100
111
232 && defined $slstmnidxvl );
233  
234 }
235 else #Its not a by Value Index
236 {
237 24 $slstidxvl = $slstmnidxvl;
238 } #if($hshidxcnf->{"checkvalue"} ne "")
239 } #if(defined $slstchkvl && $slstchkvl ne "")
240  
241 #print "idx nm: '$hshidxcnf->{'indexname'}'; chk fld: '$hshidxcnf->{'checkfield'}'; fld vl: '$slstchkvl'; idx vl: '$slstidxvl'\n";
242  
243 36 ▶ if ( $slstidxvl ne '' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($slstidxvl ne "") 30 6 36
244 $self->[LIST_ENTRIES_INDEXED]{ $hshidxcnf->{'indexname'} }
245 = ()
246 unless (
247 defined $self->[LIST_ENTRIES_INDEXED]
248 30 ▶ { $hshidxcnf->{'indexname'} } );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->[3]{$hshidxcnf->{"indexname"}} 12 18 30
249  
250 30 ▶ unless (
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->[3]{$hshidxcnf->{"indexname"}}{$slstidxvl}) 30 0 30
251 defined $self->[LIST_ENTRIES_INDEXED]
252 { $hshidxcnf->{'indexname'} }{$slstidxvl} )
253 {
254 $self->[LIST_ENTRIES_INDEXED]
255 30 { $hshidxcnf->{'indexname'} }{$slstidxvl} = $mtaety;
256  
257 #Count the Entries
258 30 ▶ if ( defined $hshidxcnf->{'count'}
Branch: 1 branch
BranchTrueFalseTotal
if (defined $hshidxcnf->{'count'} and $hshidxcnf->{'count'} > 0) { } 18 12 30
Condition66%2/3
defined $hshidxcnf->{"count"} and $hshidxcnf->{"count"} > 0
!ll&&!rl&&r
01218
MC/DC50%1/2
defined $hshidxcnf->{"count"} and $hshidxcnf->{"count"} > 0
defined $hshidxcnf->{"count"} $hshidxcnf->{"count"} > 0
Truth table66%2/3
A and B
A= defined $hshidxcnf->{"count"}B= $hshidxcnf->{"count"} > 0
ABresult
0X0
100
111
259 && $hshidxcnf->{'count'} > 0 )
260 {
261 18 $hshidxcnf->{'count'}++;
262 }
263 else {
264 12 $hshidxcnf->{'count'} = 1;
265 }
266  
267 30 ▶ $iupdidxcnf = 1 unless ($iupdidxcnf);
Branch: 1 branch
BranchTrueFalseTotal
unless $iupdidxcnf 24 6 30
268  
269 } #unless(defined $self->[LIST_ENTRIES_INDEXED]{$hshidxcnf->{'indexname'}}{$slstidxvl})
270 } #if($sidxvl ne "")
271  
272 } #if(defined $hshidxcnf)
273 } #foreach (keys %{$hshidxcnfs})
274  
275 30 ▶ if ($iupdidxcnf) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iupdidxcnf) 24 6 30
276 24 $self->setMeta( 'indexconfiguration', $hshidxcnfs );
277 } #if($iupdidxcnf)
278 } #if(defined $mtaety && $mtaety->isa('Object::Meta'))
279 }
280  
281 14 ▶sub createIndex {
Subroutine createIndex: called CC=28 SCAR=54.1
Pod undocumented
282 14 my $self = shift;
283  
284 #Take the Method Parameters and set Default Values
285 14 my %hshprms = (
286 "indexname" => "",
287 "indexfield" => "",
288 "checkfield" => "",
289 "checkvalue" => "",
290 "meta" => 0,
291 "subset" => 0,
292 "rebuild" => 0,
293 @_
294 );
295  
296 14 ▶ if ( $hshprms{"checkfield"} ne "" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($hshprms{"checkfield"} ne "") 14 0 14
297 14 my $hshidxcnfs = $self->getMeta( "indexconfiguration", {} );
298 14 my $sidxnm = $hshprms{"indexname"};
299 14 my $iupdidxcnf = 0;
300  
301 14 ▶ unless ( defined $sidxnm
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $sidxnm and $sidxnm ne "") 0 14 14
Condition33%1/3
defined $sidxnm and $sidxnm ne ""
!ll&&!rl&&r
0014
MC/DC0%0/2
defined $sidxnm and $sidxnm ne ""
defined $sidxnm $sidxnm ne ""
Truth table33%1/3
A and B
A= defined $sidxnmB= $sidxnm ne ""
ABresult
0X0
100
111
302 && $sidxnm ne "" )
303 {
304 0 $sidxnm = $hshprms{"checkfield"};
305  
306 $sidxnm .= "_" . $hshprms{"checkvalue"}
307 if ( defined $hshprms{"checkvalue"}
308 0 ▶ && $hshprms{"checkvalue"} ne "" );
Branch: 1 branch
BranchTrueFalseTotal
if defined $hshprms{"checkvalue"} and $hshprms{"checkvalue"} ne "" 0 0 0
Condition0%0/3
defined $hshprms{"checkvalue"} and $hshprms{"checkvalue"} ne ""
!ll&&!rl&&r
000
MC/DC0%0/2
defined $hshprms{"checkvalue"} and $hshprms{"checkvalue"} ne ""
defined $hshprms{"checkvalue"} $hshprms{"checkvalue"} ne ""
Truth table0%0/3
A and B
A= defined $hshprms{"checkvalue"}B= $hshprms{"checkvalue"} ne ""
ABresult
0X0
100
111
309  
310 } #unless(defined $sidxnm && $sidxnm ne "")
311  
312 14 ▶ unless ( defined $hshprms{"indexfield"}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $hshprms{"indexfield"} and $hshprms{"indexfield"} ne "") 14 0 14
Condition33%1/3
defined $hshprms{"indexfield"} and $hshprms{"indexfield"} ne ""
!ll&&!rl&&r
0140
MC/DC0%0/2
defined $hshprms{"indexfield"} and $hshprms{"indexfield"} ne ""
defined $hshprms{"indexfield"} $hshprms{"indexfield"} ne ""
Truth table33%1/3
A and B
A= defined $hshprms{"indexfield"}B= $hshprms{"indexfield"} ne ""
ABresult
0X0
100
111
313 && $hshprms{"indexfield"} ne "" )
314 {
315 14 ▶ if ( defined $hshprms{"checkvalue"}
Branch: 1 branch
BranchTrueFalseTotal
if (defined $hshprms{'checkvalue'} and $hshprms{'checkvalue'} ne '') { } 4 10 14
Condition66%2/3
defined $hshprms{"checkvalue"} and $hshprms{"checkvalue"} ne ""
!ll&&!rl&&r
0104
MC/DC50%1/2
defined $hshprms{"checkvalue"} and $hshprms{"checkvalue"} ne ""
defined $hshprms{"checkvalue"} $hshprms{"checkvalue"} ne ""
Truth table66%2/3
A and B
A= defined $hshprms{"checkvalue"}B= $hshprms{"checkvalue"} ne ""
ABresult
0X0
100
111
316 && $hshprms{"checkvalue"} ne "" )
317 {
318 4 $hshprms{"indexfield"} = $self->getIndexField;
319 }
320 else {
321 10 $hshprms{"indexfield"} = $hshprms{"checkfield"};
322 }
323  
324 14 $iupdidxcnf = 1;
325 } #unless(defined $hshprms{"indexfield"} && $hshprms{"indexfield"} ne "")
326  
327 $hshprms{"subset"} = 1
328 if ( defined $hshprms{"checkvalue"}
329 14 ▶ && $hshprms{"checkvalue"} ne "" );
Branch: 1 branch
BranchTrueFalseTotal
if defined $hshprms{"checkvalue"} and $hshprms{"checkvalue"} ne "" 4 10 14
Condition66%2/3
defined $hshprms{"checkvalue"} and $hshprms{"checkvalue"} ne ""
!ll&&!rl&&r
0104
MC/DC50%1/2
defined $hshprms{"checkvalue"} and $hshprms{"checkvalue"} ne ""
defined $hshprms{"checkvalue"} $hshprms{"checkvalue"} ne ""
Truth table66%2/3
A and B
A= defined $hshprms{"checkvalue"}B= $hshprms{"checkvalue"} ne ""
ABresult
0X0
100
111
330  
331 0 ▶ %{$hshidxcnfs} = () unless ( defined $hshidxcnfs );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $hshidxcnfs 0 14 14
332  
333 14 ▶ if ( defined $hshidxcnfs->{$sidxnm} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $hshidxcnfs->{$sidxnm}) { } 0 14 14
334 0 ▶ unless ( defined $hshidxcnfs->{$sidxnm}{"name"}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $hshidxcnfs->{$sidxnm}{"name"} and $hshidxcnfs->{$sidxnm}{"name"} eq $sidxnm) 0 0 0
Condition0%0/3
defined $hshidxcnfs->{$sidxnm}{"name"} and $hshidxcnfs->{$sidxnm}{"name"} eq $sidxnm
!ll&&!rl&&r
000
MC/DC0%0/2
defined $hshidxcnfs->{$sidxnm}{"name"} and $hshidxcnfs->{$sidxnm}{"name"} eq $sidxnm
defined $hshidxcnfs->{$sidxnm}{"name"} $hshidxcnfs->{$sidxnm}{"name"} eq $sidxnm
Truth table0%0/3
A and B
A= defined $hshidxcnfs->{$sidxnm}{"name"}B= $hshidxcnfs->{$sidxnm}{"name"} eq $sidxnm
ABresult
0X0
100
111
335 && $hshidxcnfs->{$sidxnm}{"name"} eq $sidxnm )
336 {
337 0 $hshidxcnfs->{$sidxnm}{"name"} = $sidxnm;
338 0 $iupdidxcnf = 1;
339 }
340  
341 0 ▶ unless ( defined $hshidxcnfs->{$sidxnm}{"indexfield"}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $hshidxcnfs->{$sidxnm}{"indexfield"} and $hshidxcnfs->{$sidxnm}{"indexfield"} eq $hshprms{"indexfield"}) 0 0 0
Condition0%0/3
defined $hshidxcnfs->{$sidxnm}{"indexfield"} and $hshidxcnfs->{$sidxnm}{"indexfield"} eq $hshprms{"indexfield"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $hshidxcnfs->{$sidxnm}{"indexfield"} and $hshidxcnfs->{$sidxnm}{"indexfield"} eq $hshprms{"indexfield"}
defined $hshidxcnfs->{$sidxnm}{"indexfield"} $hshidxcnfs->{$sidxnm}{"indexfield"} eq $hshprms{"indexfield"}
Truth table0%0/3
A and B
A= defined $hshidxcnfs->{$sidxnm}{"indexfield"}B= $hshidxcnfs->{$sidxnm}{"indexfield"} eq $hshprms{"indexfield"}
ABresult
0X0
100
111
342 && $hshidxcnfs->{$sidxnm}{"indexfield"} eq
343 $hshprms{"indexfield"} )
344 {
345 0 $hshidxcnfs->{$sidxnm}{"indexfield"} = $hshprms{"indexfield"};
346 0 $iupdidxcnf = 1;
347 }
348  
349 0 ▶ unless ( defined $hshidxcnfs->{$sidxnm}{"checkfield"}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $hshidxcnfs->{$sidxnm}{"checkfield"} and $hshidxcnfs->{$sidxnm}{"checkfield"} eq $hshprms{"checkfield"}) 0 0 0
Condition0%0/3
defined $hshidxcnfs->{$sidxnm}{"checkfield"} and $hshidxcnfs->{$sidxnm}{"checkfield"} eq $hshprms{"checkfield"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $hshidxcnfs->{$sidxnm}{"checkfield"} and $hshidxcnfs->{$sidxnm}{"checkfield"} eq $hshprms{"checkfield"}
defined $hshidxcnfs->{$sidxnm}{"checkfield"} $hshidxcnfs->{$sidxnm}{"checkfield"} eq $hshprms{"checkfield"}
Truth table0%0/3
A and B
A= defined $hshidxcnfs->{$sidxnm}{"checkfield"}B= $hshidxcnfs->{$sidxnm}{"checkfield"} eq $hshprms{"checkfield"}
ABresult
0X0
100
111
350 && $hshidxcnfs->{$sidxnm}{"checkfield"} eq
351 $hshprms{"checkfield"} )
352 {
353 0 $hshidxcnfs->{$sidxnm}{"checkfield"} = $hshprms{"checkfield"};
354 0 $iupdidxcnf = 1;
355 }
356  
357 0 ▶ unless ( defined $hshidxcnfs->{$sidxnm}{"checkvalue"}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $hshidxcnfs->{$sidxnm}{"checkvalue"} and $hshidxcnfs->{$sidxnm}{"checkvalue"} eq $hshprms{"checkvalue"}) 0 0 0
Condition0%0/3
defined $hshidxcnfs->{$sidxnm}{"checkvalue"} and $hshidxcnfs->{$sidxnm}{"checkvalue"} eq $hshprms{"checkvalue"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $hshidxcnfs->{$sidxnm}{"checkvalue"} and $hshidxcnfs->{$sidxnm}{"checkvalue"} eq $hshprms{"checkvalue"}
defined $hshidxcnfs->{$sidxnm}{"checkvalue"} $hshidxcnfs->{$sidxnm}{"checkvalue"} eq $hshprms{"checkvalue"}
Truth table0%0/3
A and B
A= defined $hshidxcnfs->{$sidxnm}{"checkvalue"}B= $hshidxcnfs->{$sidxnm}{"checkvalue"} eq $hshprms{"checkvalue"}
ABresult
0X0
100
111
358 && $hshidxcnfs->{$sidxnm}{"checkvalue"} eq
359 $hshprms{"checkvalue"} )
360 {
361 0 $hshidxcnfs->{$sidxnm}{"checkvalue"} = $hshprms{"checkvalue"};
362 0 $iupdidxcnf = 1;
363 }
364  
365 0 ▶ unless ( defined $hshidxcnfs->{$sidxnm}{"meta"}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $hshidxcnfs->{$sidxnm}{"meta"} and $hshidxcnfs->{$sidxnm}{"meta"} == $hshprms{"meta"}) 0 0 0
Condition0%0/3
defined $hshidxcnfs->{$sidxnm}{"meta"} and $hshidxcnfs->{$sidxnm}{"meta"} == $hshprms{"meta"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $hshidxcnfs->{$sidxnm}{"meta"} and $hshidxcnfs->{$sidxnm}{"meta"} == $hshprms{"meta"}
defined $hshidxcnfs->{$sidxnm}{"meta"} $hshidxcnfs->{$sidxnm}{"meta"} == $hshprms{"meta"}
Truth table0%0/3
A and B
A= defined $hshidxcnfs->{$sidxnm}{"meta"}B= $hshidxcnfs->{$sidxnm}{"meta"} == $hshprms{"meta"}
ABresult
0X0
100
111
366 && $hshidxcnfs->{$sidxnm}{"meta"} == $hshprms{"meta"} )
367 {
368 0 $hshidxcnfs->{$sidxnm}{"meta"} = $hshprms{"meta"};
369 0 $iupdidxcnf = 1;
370 }
371  
372 0 ▶ unless ( defined $hshidxcnfs->{$sidxnm}{"subset"}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $hshidxcnfs->{$sidxnm}{"subset"} and $hshidxcnfs->{$sidxnm}{"subset"} == $hshprms{"subset"}) 0 0 0
Condition0%0/3
defined $hshidxcnfs->{$sidxnm}{"subset"} and $hshidxcnfs->{$sidxnm}{"subset"} == $hshprms{"subset"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $hshidxcnfs->{$sidxnm}{"subset"} and $hshidxcnfs->{$sidxnm}{"subset"} == $hshprms{"subset"}
defined $hshidxcnfs->{$sidxnm}{"subset"} $hshidxcnfs->{$sidxnm}{"subset"} == $hshprms{"subset"}
Truth table0%0/3
A and B
A= defined $hshidxcnfs->{$sidxnm}{"subset"}B= $hshidxcnfs->{$sidxnm}{"subset"} == $hshprms{"subset"}
ABresult
0X0
100
111
373 && $hshidxcnfs->{$sidxnm}{"subset"} == $hshprms{"subset"} )
374 {
375 0 $hshidxcnfs->{$sidxnm}{"subset"} = $hshprms{"subset"};
376 0 $iupdidxcnf = 1;
377 }
378  
379 0 ▶ unless ( defined $hshidxcnfs->{$sidxnm}{"count"} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $hshidxcnfs->{$sidxnm}{"count"}) 0 0 0
380 0 $hshidxcnfs->{$sidxnm}{"count"} = 0;
381 0 $iupdidxcnf = 1;
382 }
383 }
384 else #The Index Definition does not exist yet
385 {
386 14 $iupdidxcnf = 1;
387  
388 14 $hshidxcnfs->{$sidxnm}{"indexname"} = $sidxnm;
389 14 $hshidxcnfs->{$sidxnm}{"indexfield"} = $hshprms{"indexfield"};
390 14 $hshidxcnfs->{$sidxnm}{"checkfield"} = $hshprms{"checkfield"};
391 14 $hshidxcnfs->{$sidxnm}{"checkvalue"} = $hshprms{"checkvalue"};
392 14 $hshidxcnfs->{$sidxnm}{"meta"} = $hshprms{"meta"};
393 14 $hshidxcnfs->{$sidxnm}{"subset"} = $hshprms{"subset"};
394 14 $hshidxcnfs->{$sidxnm}{"count"} = 0;
395 } #if(defined $hshidxcnfs->{$sidxnm})
396  
397 14 ▶ if ($iupdidxcnf) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iupdidxcnf) 14 0 14
398 14 $self->setMeta( "indexconfiguration", $hshidxcnfs );
399  
400 14 $hshprms{"rebuild"} = 1;
401 } #if($iupdidxcnf)
402  
403 #Build the Index and fill it with MetaEntry Objects
404 14 $self->buildIndex( $sidxnm, $hshprms{"rebuild"} );
405  
406 } #if($hshprms{"checkfield"} ne "")
407 }
408  
409 14 ▶sub buildIndex {
Subroutine buildIndex: called CC=34 SCAR=57.4
Pod undocumented
410 14 my $self = shift;
411 14 my $sindexname = shift;
412 14 ▶ my $irebuild = shift || 0;
Condition50%1/2
shift() || 0
l!l
140
MC/DC0%0/1
shift() || 0
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
413  
414 14 ▶ $sindexname = PRIMARY_INDEXNAME unless ( defined $sindexname );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $sindexname 0 14 14
415  
416 #print "" .(caller(0))[3] . " - idx: '$sindexname', rbd: '$irebuild'. go ...\n";
417  
418 14 ▶ if ( defined $sindexname
Branch: 1 branch
BranchTrueFalseTotal
if (defined $sindexname and $sindexname ne "") 14 0 14
Condition33%1/3
defined $sindexname and $sindexname ne ""
!ll&&!rl&&r
0014
MC/DC0%0/2
defined $sindexname and $sindexname ne ""
defined $sindexname $sindexname ne ""
Truth table33%1/3
A and B
A= defined $sindexnameB= $sindexname ne ""
ABresult
0X0
100
111
419 && $sindexname ne "" )
420 {
421 14 my $hshidxcnfs = $self->getMeta( "indexconfiguration", {} );
422 14 my $hshidxcnf = undef;
423 14 my $sidxvl = "";
424 14 my $iidxcnt = -1;
425 14 my $iupdidxcnf = 0;
426  
427 $hshidxcnf = $hshidxcnfs->{$sindexname}
428 14 ▶ if ( defined $hshidxcnfs->{$sindexname} );
Branch: 1 branch
BranchTrueFalseTotal
if defined $hshidxcnfs->{$sindexname} 14 0 14
429  
430 14 ▶ if ( defined $hshidxcnf
Branch: 1 branch
BranchTrueFalseTotal
if (defined $hshidxcnf and defined $hshidxcnf->{"checkfield"}) 14 0 14
Condition33%1/3
defined $hshidxcnf and defined $hshidxcnf->{"checkfield"}
!ll&&!rl&&r
0014
MC/DC0%0/2
defined $hshidxcnf and defined $hshidxcnf->{"checkfield"}
defined $hshidxcnf defined $hshidxcnf->{"checkfield"}
Truth table33%1/3
A and B
A= defined $hshidxcnfB= defined $hshidxcnf->{"checkfield"}
ABresult
0X0
100
111
431 && defined $hshidxcnf->{"checkfield"} )
432 {
433 14 ▶ unless ( defined $hshidxcnf->{"indexfield"}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $hshidxcnf->{"indexfield"} and $hshidxcnf->{"indexfield"} ne "") 0 14 14
Condition33%1/3
defined $hshidxcnf->{"indexfield"} and $hshidxcnf->{"indexfield"} ne ""
!ll&&!rl&&r
0014
MC/DC0%0/2
defined $hshidxcnf->{"indexfield"} and $hshidxcnf->{"indexfield"} ne ""
defined $hshidxcnf->{"indexfield"} $hshidxcnf->{"indexfield"} ne ""
Truth table33%1/3
A and B
A= defined $hshidxcnf->{"indexfield"}B= $hshidxcnf->{"indexfield"} ne ""
ABresult
0X0
100
111
434 && $hshidxcnf->{"indexfield"} ne "" )
435 {
436 0 $hshidxcnf->{"indexfield"} = $hshidxcnf->{"checkfield"};
437  
438 0 $iupdidxcnf = 1;
439 }
440  
441 $iidxcnt = $hshidxcnf->{"count"}
442 14 ▶ if ( defined $hshidxcnf->{"count"} );
Branch: 1 branch
BranchTrueFalseTotal
if defined $hshidxcnf->{"count"} 14 0 14
443  
444 } #if(defined $hshidxcnf && defined $hshidxcnf->{"checkfield"})
445  
446 #print "idx fld: '$sidxfld'; chk fld: '$schkfld'; chk vl: '$schkvl'"
447 # . "; mta: '$imta'; set: '$isbset'\n";
448  
449 14 ▶ if ( defined $hshidxcnf
Branch: 1 branch
BranchTrueFalseTotal
if (defined $hshidxcnf and defined $hshidxcnf->{"checkfield"} and $hshidxcnf->{"checkfield"} ne "") 14 0 14
Condition33%2/6
defined $hshidxcnf and defined $hshidxcnf->{"checkfield"} and $hshidxcnf->{"checkfield"} ne ""
!ll&&!rl&&r
0014
defined $hshidxcnf and defined $hshidxcnf->{"checkfield"}
!ll&&!rl&&r
0014
MC/DC0%0/3
defined $hshidxcnf and defined $hshidxcnf->{"checkfield"} and $hshidxcnf->{"checkfield"} ne ""
defined $hshidxcnf defined $hshidxcnf->{"checkfield"} $hshidxcnf->{"checkfield"} ne ""
Truth table25%1/4
A and B and C
A= defined $hshidxcnfB= defined $hshidxcnf->{"checkfield"}C= $hshidxcnf->{"checkfield"} ne ""
ABCresult
0XX0
10X0
1100
1111
450 && defined $hshidxcnf->{"checkfield"}
451 && $hshidxcnf->{"checkfield"} ne "" )
452 {
453 14 my $ietycnt = $self->getMetaObjectCount;
454  
455 #Check the Index when the List was updated or when the Index was changed
456 14 my $ibld = $iupdidxcnf;
457  
458 14 ▶ if ($irebuild) {
Branch: 1 branch
BranchTrueFalseTotal
if ($irebuild) 14 0 14
459 14 ▶ if ( defined $self->[LIST_ENTRIES_INDEXED]{$sindexname} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->[3]{$sindexname}) 0 14 14
460 0 $self->[LIST_ENTRIES_INDEXED]{$sindexname} = ();
461 } #if(defined $self->{"_list_entries_indexed"}{$sindexname})
462  
463 14 $iidxcnt = 0;
464 14 $iupdidxcnf = 1;
465  
466 #Check the Index
467 14 $ibld = 1;
468 } #if($irebuild)
469  
470 14 ▶ if ( defined $self->[LIST_ENTRIES_INDEXED]{$sindexname} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->[3]{$sindexname}) { } 0 14 14
471  
472 #Check the Index
473 0 ▶ $ibld = 1 if ( $iidxcnt < 0 );
Branch: 1 branch
BranchTrueFalseTotal
if $iidxcnt < 0 0 0 0
474 }
475 else #The Index still doesn't exist
476 {
477 14 $self->[LIST_ENTRIES_INDEXED]{$sindexname} = ();
478  
479 #Check the Index
480 14 $ibld = 1;
481 } #if(defined $self->{"_list_entries_indexed"}{$sindexname})
482  
483 14 ▶ if ( $ietycnt > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ietycnt > 0) { } 0 14 14
484 0 ▶ unless ( $hshidxcnf->{"subset"} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($hshidxcnf->{"subset"}) 0 0 0
485 0 ▶ $ibld = 1 if ( $ibld || $ietycnt != $iidxcnt );
Branch: 1 branch
BranchTrueFalseTotal
if $ibld or $ietycnt != $iidxcnt 0 0 0
Condition0%0/3
$ibld or $ietycnt != $iidxcnt
l!l&&r!l&&!r
000
MC/DC0%0/2
$ibld or $ietycnt != $iidxcnt
$ibld $ietycnt != $iidxcnt
Truth table0%0/3
A or B
A= $ibldB= $ietycnt != $iidxcnt
ABresult
1X1
011
000
486 } #unless($hshidxcnf->{"subset"})
487 }
488 else #There aren't any Objects in the List
489 {
490 14 $ibld = 0;
491 } #if($ietycnt > 0)
492  
493 #print "ety cnt: '$ietycnt'; idx ety cnt: '$iidxcnt'; bld: '$ibld'\n";
494  
495 14 ▶ if ($ibld) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ibld) 0 14 14
496 0 my $ety = undef;
497 0 my $sidxvl = "";
498 0 my $slstetyidxvl = "";
499 0 my $slstchkvl = undef;
500 0 my $iety = -1;
501  
502 0 $iidxcnt = 0;
503  
504 0 ▶ for ( $iety = 0 ; $iety < $ietycnt ; $iety++ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iety < $ietycnt) 0 0 0
505 0 $ety = $self->[LIST_ENTRIES][$iety];
506 0 $sidxvl = "";
507  
508 0 ▶ if ( defined $ety ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ety) 0 0 0
509 $slstetyidxvl =
510 0 $ety->get( $hshidxcnf->{"indexfield"}, undef );
511 $slstchkvl = $ety->get( $hshidxcnf->{"checkfield"},
512 0 undef, $hshidxcnf->{"meta"} );
513  
514 0 ▶ if ( defined $slstchkvl
Branch: 1 branch
BranchTrueFalseTotal
if (defined $slstchkvl and $slstchkvl ne "") 0 0 0
Condition0%0/3
defined $slstchkvl and $slstchkvl ne ""
!ll&&!rl&&r
000
MC/DC0%0/2
defined $slstchkvl and $slstchkvl ne ""
defined $slstchkvl $slstchkvl ne ""
Truth table0%0/3
A and B
A= defined $slstchkvlB= $slstchkvl ne ""
ABresult
0X0
100
111
515 && $slstchkvl ne "" )
516 {
517 0 ▶ if ( $hshidxcnf->{"checkvalue"} ne "" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($hshidxcnf->{'checkvalue'} ne '') { } 0 0 0
518 $sidxvl = $slstetyidxvl
519 if (
520 0 ▶ "$slstchkvl" eq $hshidxcnf->{"checkvalue"}
Branch: 1 branch
BranchTrueFalseTotal
if "$slstchkvl" eq $hshidxcnf->{"checkvalue"} . '' and defined $slstetyidxvl 0 0 0
Condition0%0/3
"$slstchkvl" eq $hshidxcnf->{"checkvalue"} . '' and defined $slstetyidxvl
!ll&&!rl&&r
000
MC/DC0%0/2
"$slstchkvl" eq $hshidxcnf->{"checkvalue"} . '' and defined $slstetyidxvl
"$slstchkvl" eq $hshidxcnf->{"checkvalue"} . '' defined $slstetyidxvl
Truth table0%0/3
A and B
A= "$slstchkvl" eq $hshidxcnf->{"checkvalue"} . ''B= defined $slstetyidxvl
ABresult
0X0
100
111
521 . ""
522 && defined $slstetyidxvl );
523  
524 }
525 else #Its not a by Value Index
526 {
527 0 $sidxvl = $slstetyidxvl;
528 } #if($sfldvl ne "")
529 } #if(defined $slstchkvl && $slstchkvl ne "")
530  
531 #print "idx nm: '$sindexname'; chk fld: '$schkfld'; fld vl: '$slstchkvl'; idx vl: '$sidxvl'\n";
532  
533 0 ▶ if ( $sidxvl ne "" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sidxvl ne "") 0 0 0
534 0 ▶ unless (
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->[3]{$sindexname}{$sidxvl}) 0 0 0
535 defined $self->[LIST_ENTRIES_INDEXED]
536 {$sindexname}{$sidxvl} )
537 {
538 $self->[LIST_ENTRIES_INDEXED]{$sindexname}
539 0 {$sidxvl} = $ety;
540  
541 #Count the Entries
542 0 $iidxcnt++;
543  
544 0 ▶ $iupdidxcnf = 1 unless ($iupdidxcnf);
Branch: 1 branch
BranchTrueFalseTotal
unless $iupdidxcnf 0 0 0
545  
546 } #unless(defined $self->[LIST_ENTRIES_INDEXED]{$sindexname}{$sidxvl})
547 } #if($sidxvl ne "")
548 } #if(defined $ety)
549 } #for($iety = 0; $iety < $ietycnt; $iety++)
550 } #if($ibld)
551 } #if(defined $hshidxcnf && defined $hshidxcnf->{"checkfield"}
552 # && $hshidxcnf->{"checkfield"} ne "")
553  
554 14 ▶ if ($iupdidxcnf) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iupdidxcnf) 14 0 14
555 14 $hshidxcnfs->{$sindexname}{"count"} = $iidxcnt;
556  
557 14 $self->setMeta( "indexconfiguration", $hshidxcnfs );
558 } #if($iupdidxcnf)
559 } #if(defined $sindexname && $sindexname ne "")
560  
561 }
562  
563 0 ▶sub buildIndexAll {
Subroutine buildIndexAll: not called CC=30 SCAR=68.4
Pod undocumented
564 0 my $self = shift;
565 0 ▶ my $irebuild = shift || 0;
Condition0%0/2
shift() || 0
l!l
00
MC/DC0%0/1
shift() || 0
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
566  
567 0 my $ietycnt = $self->getMetaObjectCount;
568  
569 0 my $hshidxcnfs = $self->getMeta( "indexconfiguration", {} );
570 0 my $hshidxcnf = undef;
571 0 my $sidxnm = "";
572 0 my $iidxcnt = -1;
573  
574 0 my $ibld = 0;
575  
576 0 ▶ if ( scalar( keys %$hshidxcnfs ) > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar keys %$hshidxcnfs > 0) 0 0 0
577 0 foreach $sidxnm ( keys %{$hshidxcnfs} ) {
578 0 $hshidxcnf = $hshidxcnfs->{$sidxnm};
579  
580 0 ▶ if ( defined $hshidxcnf ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $hshidxcnf) 0 0 0
581 0 ▶ unless ( defined $hshidxcnf->{"indexfield"}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $hshidxcnf->{"indexfield"} and $hshidxcnf->{"indexfield"} ne "") 0 0 0
Condition0%0/3
defined $hshidxcnf->{"indexfield"} and $hshidxcnf->{"indexfield"} ne ""
!ll&&!rl&&r
000
MC/DC0%0/2
defined $hshidxcnf->{"indexfield"} and $hshidxcnf->{"indexfield"} ne ""
defined $hshidxcnf->{"indexfield"} $hshidxcnf->{"indexfield"} ne ""
Truth table0%0/3
A and B
A= defined $hshidxcnf->{"indexfield"}B= $hshidxcnf->{"indexfield"} ne ""
ABresult
0X0
100
111
582 && $hshidxcnf->{"indexfield"} ne "" )
583 {
584 0 $hshidxcnf->{"indexfield"} = $hshidxcnf->{"checkfield"};
585  
586 0 $ibld = 1;
587 } #unless(defined $hshidxcnf->{"indexfield"} && $hshidxcnf->{"indexfield"} ne "")
588  
589 $iidxcnt = $hshidxcnf->{"count"}
590 0 ▶ if ( defined $hshidxcnf->{"count"} );
Branch: 1 branch
BranchTrueFalseTotal
if defined $hshidxcnf->{"count"} 0 0 0
591  
592 } #if(defined $hshidxcnf)
593  
594 0 ▶ if ($irebuild) {
Branch: 1 branch
BranchTrueFalseTotal
if ($irebuild) 0 0 0
595 0 ▶ if ( defined $self->[LIST_ENTRIES_INDEXED]{$sidxnm} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->[3]{$sidxnm}) 0 0 0
596 0 $self->[LIST_ENTRIES_INDEXED]{$sidxnm} = ();
597 } #if(defined $self->[LIST_ENTRIES_INDEXED]{$sidxnm})
598  
599 0 $hshidxcnf->{"count"} = 0;
600  
601 #Check the Index
602 0 $ibld = 1;
603 } #if($irebuild)
604  
605 0 ▶ if ( defined $self->[LIST_ENTRIES_INDEXED]{$sidxnm} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->[3]{$sidxnm}) { } 0 0 0
606  
607 #Check the Index
608 0 ▶ $ibld = 1 if ( $iidxcnt < 0 );
Branch: 1 branch
BranchTrueFalseTotal
if $iidxcnt < 0 0 0 0
609 }
610 else #The Index still doesn't exist
611 {
612 0 $self->[LIST_ENTRIES_INDEXED]{$sidxnm} = ();
613  
614 #Check the Index
615 0 $ibld = 1;
616 } #if(defined $self->{"_list_entries_indexed"}{$sidxnm})
617  
618 0 ▶ if ( $ietycnt > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ietycnt > 0) 0 0 0
619 0 ▶ unless ( $hshidxcnf->{"subset"} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($hshidxcnf->{"subset"}) 0 0 0
620 0 ▶ $ibld = 1 if ( $ibld || $ietycnt != $iidxcnt );
Branch: 1 branch
BranchTrueFalseTotal
if $ibld or $ietycnt != $iidxcnt 0 0 0
Condition0%0/3
$ibld or $ietycnt != $iidxcnt
l!l&&r!l&&!r
000
MC/DC0%0/2
$ibld or $ietycnt != $iidxcnt
$ibld $ietycnt != $iidxcnt
Truth table0%0/3
A or B
A= $ibldB= $ietycnt != $iidxcnt
ABresult
1X1
011
000
621 } #unless($hshidxcnf->{"subset"})
622 } #if($ietycnt > 0)
623  
624 #print "idx nm: '$sidxnm'; idx ety cnt: '$iidxcnt'; bld: '$ibld'\n";
625  
626 } #foreach $sidxnm (keys %{$hshidxcnfs})
627  
628 } #if(scalar(keys %$hshidxcnfs) > 0)
629  
630 #print "ety cnt: '$ietycnt'; bld: '$ibld'\n";
631  
632 0 ▶ if ($ibld) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ibld) 0 0 0
633 0 my $ety = undef;
634 0 my $sidxvl = "";
635 0 my $slstetyidxvl = "";
636 0 my $slstchkvl = undef;
637 0 my $iety = -1;
638  
639 0 foreach $sidxnm ( keys %{$hshidxcnfs} ) {
640 0 $hshidxcnfs->{$sidxnm}{"count"} = 0;
641 }
642  
643 0 ▶ for ( $iety = 0 ; $iety < $ietycnt ; $iety++ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iety < $ietycnt) 0 0 0
644 0 $ety = $self->[LIST_ENTRIES][$iety];
645 0 $sidxvl = "";
646  
647 0 ▶ if ( defined $ety ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ety) 0 0 0
648 0 foreach $sidxnm ( keys %{$hshidxcnfs} ) {
649 0 $hshidxcnf = $hshidxcnfs->{$sidxnm};
650  
651 $slstetyidxvl =
652 0 $ety->get( $hshidxcnf->{"indexfield"}, undef );
653 $slstchkvl = $ety->get( $hshidxcnf->{"checkfield"},
654 0 undef, $hshidxcnf->{"meta"} );
655 0 $sidxvl = '';
656  
657 0 ▶ if ( defined $slstchkvl
Branch: 1 branch
BranchTrueFalseTotal
if (defined $slstchkvl and $slstchkvl ne "") 0 0 0
Condition0%0/3
defined $slstchkvl and $slstchkvl ne ""
!ll&&!rl&&r
000
MC/DC0%0/2
defined $slstchkvl and $slstchkvl ne ""
defined $slstchkvl $slstchkvl ne ""
Truth table0%0/3
A and B
A= defined $slstchkvlB= $slstchkvl ne ""
ABresult
0X0
100
111
658 && $slstchkvl ne "" )
659 {
660 0 ▶ if ( $hshidxcnf->{"checkvalue"} ne "" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($hshidxcnf->{'checkvalue'} ne '') { } 0 0 0
661 $sidxvl = $slstetyidxvl
662 if (
663 0 ▶ "$slstchkvl" eq $hshidxcnf->{"checkvalue"} . ""
Branch: 1 branch
BranchTrueFalseTotal
if "$slstchkvl" eq $hshidxcnf->{"checkvalue"} . '' and defined $slstetyidxvl 0 0 0
Condition0%0/3
"$slstchkvl" eq $hshidxcnf->{"checkvalue"} . '' and defined $slstetyidxvl
!ll&&!rl&&r
000
MC/DC0%0/2
"$slstchkvl" eq $hshidxcnf->{"checkvalue"} . '' and defined $slstetyidxvl
"$slstchkvl" eq $hshidxcnf->{"checkvalue"} . '' defined $slstetyidxvl
Truth table0%0/3
A and B
A= "$slstchkvl" eq $hshidxcnf->{"checkvalue"} . ''B= defined $slstetyidxvl
ABresult
0X0
100
111
664 && defined $slstetyidxvl );
665  
666 }
667 else #Its not a by Value Index
668 {
669 0 $sidxvl = $slstetyidxvl;
670 } #if($sfldvl ne "")
671 } #if(defined $slstchkvl && $slstchkvl ne "")
672  
673 #print "idx nm: '$sindexname'; chk fld: '$schkfld'; fld vl: '$slstchkvl'; idx vl: '$sidxvl'\n";
674  
675 0 ▶ if ( $sidxvl ne "" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sidxvl ne "") 0 0 0
676 0 ▶ unless (
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->[3]{$sidxnm}{$sidxvl}) 0 0 0
677 defined $self->[LIST_ENTRIES_INDEXED]{$sidxnm}
678 {$sidxvl} )
679 {
680 0 $self->[LIST_ENTRIES_INDEXED]{$sidxnm}{$sidxvl} =
681 $ety;
682  
683 #Count the Entries
684 0 $hshidxcnf->{"count"}++;
685  
686 0 ▶ $iupdidxcnf = 1 unless ($iupdidxcnf);
Branch: 1 branch
BranchTrueFalseTotal
unless $iupdidxcnf 0 0 0
687  
688 } #unless(defined $self->[LIST_ENTRIES_INDEXED]{$sindexname}{$sidxvl})
689 } #if($sidxvl ne "")
690 } #foreach $sidxnm (keys %{$hshidxcnfs})
691 } #if(defined $ety)
692 } #for($iety = 0; $iety < $ietycnt; $iety++)
693 } #if($ibld)
694  
695 0 ▶ if ($iupdidxcnf) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iupdidxcnf) 0 0 0
696 0 $self->setMeta( "indexconfiguration", $hshidxcnfs );
697 } #if($iupdidxcnf)
698 }
699  
700 1 ▶sub Clear {
Subroutine Clear: called CC=1 SCAR=0.0
Pod documented
701 1 my $self = $_[0];
702 1 my $hshidxcnfs = $self->getMeta( "indexconfiguration", {} );
703  
704 #Execute the Base Class Logic
705 1 $self->SUPER::Clear;
706  
707 #Save the Index Configuration
708 1 $self->setMeta( "indexconfiguration", $hshidxcnfs );
709  
710 #Clear the Object List too
711 1 $self->clearList;
712 }
713  
714 1 ▶sub clearList {
Subroutine clearList: called CC=2 SCAR=6.9
Pod undocumented
715 1 my $self = $_[0];
716 1 my $hshidxcnfs = $self->getMeta( 'indexconfiguration', {} );
717  
718 #Clear the Entry Lists
719 1 $self->[LIST_ENTRIES] = ();
720 1 $self->[LIST_ENTRIES_INDEXED] = ();
721  
722 1 foreach ( keys %{$hshidxcnfs} ) {
723 1 $hshidxcnfs->{$_}{"count"} = 0;
724 }
725 }
726  
727 0 ▶sub clearLists {
Subroutine clearLists: not called CC=1 SCAR=6.9
Pod undocumented
728 0 goto &clearList;
729 }
730  
731 #----------------------------------------------------------------------------
732 #Consultation Methods
733  
734 =head2 Consultation Methods
735  
736 =head3 getIndexField ( [ INDEX ] )
737  
738 This method returns the name of the field that is used to index the instances
739 by the index C<INDEX>.
740  
741 B<Parameters:>
742  
743 =over 4
744  
745 =item C<INDEX>
746  
747 Name of the index. If not given the predefined C<PRIMARY_INDEXNAME> index
748 with name "I<primary>" is used.
749  
750 =back
751  
752 B<Returns:> string - The object with the indexed field having the
753 value I<NAME>.
754  
755 =cut
756  
757 24 ▶sub getIndexField {
Subroutine getIndexField: called CC=4 SCAR=14.3
Pod documented
758 24 my ( $self, $sindexname ) = @_;
759 24 my $sindexfield = '';
760 24 my $hshidxcnfs = $self->getMeta( 'indexconfiguration', {} );
761  
762 24 ▶ $sindexname = PRIMARY_INDEXNAME unless ( defined $sindexname );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $sindexname 24 0 24
763  
764 24 ▶ if ( defined $hshidxcnfs->{$sindexname} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $hshidxcnfs->{$sindexname}) 24 0 24
765 $sindexfield = $hshidxcnfs->{$sindexname}{"indexfield"}
766 24 ▶ if ( defined $hshidxcnfs->{$sindexname}{"indexfield"} );
Branch: 1 branch
BranchTrueFalseTotal
if defined $hshidxcnfs->{$sindexname}{"indexfield"} 24 0 24
767  
768 }
769  
770 24 return $sindexfield;
771 }
772  
773 16 ▶sub getMetaObject {
Subroutine getMetaObject: called CC=5 SCAR=16.6
Pod undocumented
774 16 my ( $self, $iindex ) = @_[ 0 .. 1 ];
775 16 my $rsety = undef;
776  
777 16 ▶ if ( defined $iindex ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $iindex) 16 0 16
778 16 ▶ if ( $iindex =~ /^\-?\d+$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iindex =~ /^\-?\d+$/) { } 16 0 16
779 16 ▶ if ( $iindex > -1
Branch: 1 branch
BranchTrueFalseTotal
if ($iindex > -1 and $iindex < scalar @{$self->[2];}) 3 13 16
Condition66%2/3
$iindex > -1 and $iindex < scalar @{$self->[2];}
!ll&&!rl&&r
0133
MC/DC50%1/2
$iindex > -1 and $iindex < scalar @{$self->[2];}
$iindex > -1 $iindex < scalar @{$self->[2];}
Truth table66%2/3
A and B
A= $iindex > -1B= $iindex < scalar @{$self->[2];}
ABresult
0X0
100
111
780 16 && $iindex < scalar( @{ $self->[LIST_ENTRIES] } ) )
781 {
782 3 $rsety = $self->[LIST_ENTRIES][$iindex];
783 }
784 }
785 else #The Index Value is a Text
786 {
787 #For a Indexed Object Lookup there need to be more parameters
788 0 $rsety = $self->getIdxMetaObject( $iindex, @_[ 2 .. $#_ ] );
789 }
790 }
791  
792 16 return $rsety;
793 }
794  
795 =head3 getIdxMetaObject ( INDEX, NAME )
796  
797 This uses the index of name C<INDEX> to find the C<Object::Meta> object to find
798 the instance.
799  
800 B<Parameters:>
801  
802 =over 4
803  
804 =item C<INDEX>
805  
806 Name of the index.
807  
808 =item C<NAME>
809  
810 The string value for field indexed with the index C<INDEX> of the object.
811  
812 =back
813  
814 B<Returns:> C<Object::Meta> - The object with the indexed field having the
815 value I<NAME>.
816  
817 =cut
818  
819 7 ▶sub getIdxMetaObject {
Subroutine getIdxMetaObject: called CC=5 SCAR=16.4
Pod documented
820 7 my ( $self, $sindexname, $sindexvalue ) = @_;
821 7 my $rsety = undef;
822  
823 7 ▶ unless ( defined $sindexvalue ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $sindexvalue) 7 0 7
824 7 $sindexvalue = $sindexname;
825 7 $sindexname = PRIMARY_INDEXNAME;
826 }
827  
828 #print "idx nm: '$sindexname'; idx vl: '$sindexvalue'\n";
829  
830 7 ▶ if ( $sindexname ne ''
Branch: 1 branch
BranchTrueFalseTotal
if ($sindexname ne "" and defined $self->[3]{$sindexname}) 6 1 7
Condition66%2/3
$sindexname ne "" and defined $self->[3]{$sindexname}
!ll&&!rl&&r
016
MC/DC50%1/2
$sindexname ne "" and defined $self->[3]{$sindexname}
$sindexname ne "" defined $self->[3]{$sindexname}
Truth table66%2/3
A and B
A= $sindexname ne ""B= defined $self->[3]{$sindexname}
ABresult
0X0
100
111
831 && defined $self->[LIST_ENTRIES_INDEXED]{$sindexname} )
832 {
833 $rsety = $self->[LIST_ENTRIES_INDEXED]{$sindexname}{$sindexvalue}
834 if (
835 6 ▶ defined $self->[LIST_ENTRIES_INDEXED]{$sindexname}{$sindexvalue} );
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->[3]{$sindexname}{$sindexvalue} 6 0 6
836  
837 }
838  
839 7 return $rsety;
840 }
841  
842 =head3 getMetaObjectCount
843  
844 This Method gives the Count of C<Object::Meta> objects back that are hold in the List.
845 If the B<Meta Data Field> C<entrycount> is not set it will be created.
846  
847 B<Returns:> integer - The Count of C<Object::Meta> objects in the List
848  
849 =cut
850  
851 64 ▶sub getMetaObjectCount {
Subroutine getMetaObjectCount: called CC=3 SCAR=11.3
Pod documented
852 64 my $self = $_[0];
853 64 my $irscnt = $self->getMeta( 'entrycount', -1 );
854  
855 64 ▶ if ( $irscnt < 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($irscnt < 0) 14 50 64
856 14 ▶ if ( defined $self->[LIST_ENTRIES] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->[2]) { } 0 14 14
857 0 $irscnt = scalar( @{ $self->[LIST_ENTRIES] } );
858 }
859 else {
860 14 $irscnt = 0;
861 }
862  
863 14 $self->setMeta( 'entrycount', $irscnt );
864 } #if($irscnt < 0)
865  
866 64 return $irscnt;
867 }
868  
869 13 ▶sub getIdxMetaObjectCount {
Subroutine getIdxMetaObjectCount: called CC=8 SCAR=28.2
Pod undocumented
870 13 my ( $self, $sindexname ) = @_;
871 13 my $irscnt = -1;
872  
873 13 my $hshidxcnfs = $self->getMeta( 'indexconfiguration', {} );
874  
875 13 ▶ $sindexname = PRIMARY_INDEXNAME unless ( defined $sindexname );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $sindexname 9 4 13
876  
877 13 ▶ if ( $sindexname ne ''
Branch: 1 branch
BranchTrueFalseTotal
if ($sindexname ne "" and defined $hshidxcnfs->{$sindexname}) 13 0 13
Condition33%1/3
$sindexname ne "" and defined $hshidxcnfs->{$sindexname}
!ll&&!rl&&r
0013
MC/DC0%0/2
$sindexname ne "" and defined $hshidxcnfs->{$sindexname}
$sindexname ne "" defined $hshidxcnfs->{$sindexname}
Truth table33%1/3
A and B
A= $sindexname ne ""B= defined $hshidxcnfs->{$sindexname}
ABresult
0X0
100
111
878 && defined $hshidxcnfs->{$sindexname} )
879 {
880 13 $irscnt = $hshidxcnfs->{$sindexname}{"count"};
881 }
882  
883 13 ▶ if ( $irscnt < 0
Branch: 1 branch
BranchTrueFalseTotal
if ($irscnt < 0 and defined $hshidxcnfs->{$sindexname}) 0 13 13
Condition33%1/3
$irscnt < 0 and defined $hshidxcnfs->{$sindexname}
!ll&&!rl&&r
1300
MC/DC0%0/2
$irscnt < 0 and defined $hshidxcnfs->{$sindexname}
$irscnt < 0 defined $hshidxcnfs->{$sindexname}
Truth table33%1/3
A and B
A= $irscnt < 0B= defined $hshidxcnfs->{$sindexname}
ABresult
0X0
100
111
884 && defined $hshidxcnfs->{$sindexname} )
885 {
886 0 $irscnt = scalar( keys %{ $self->[LIST_ENTRIES_INDEXED]{$sindexname} } )
887 0 ▶ if ( defined $self->[LIST_ENTRIES_INDEXED]{$sindexname} );
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->[3]{$sindexname} 0 0 0
888  
889 0 ▶ if ( $irscnt > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($irscnt > 0) 0 0 0
890 0 $hshidxcnfs->{$sindexname}{"count"} = $irscnt;
891  
892 0 $self->setMeta( "indexconfiguration", $hshidxcnfs );
893 } #if($irscnt > 0)
894 } #if($irscnt < 0 && defined $hshidxcnfs->{$sindexname})
895  
896 13 return $irscnt;
897 }
898  
899 2 ▶sub getIdxValueArray {
Subroutine getIdxValueArray: called CC=4 SCAR=14.5
Pod undocumented
900 2 my $self = shift;
901 2 my $sindexname = shift;
902 2 my @arrrs = undef;
903  
904 2 ▶ $sindexname = PRIMARY_INDEXNAME unless ( defined $sindexname );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $sindexname 1 1 2
905  
906 2 ▶ if ( $sindexname ne ""
Branch: 1 branch
BranchTrueFalseTotal
if ($sindexname ne '' and defined $self->[3]{$sindexname}) { } 2 0 2
Condition33%1/3
$sindexname ne "" and defined $self->[3]{$sindexname}
!ll&&!rl&&r
002
MC/DC0%0/2
$sindexname ne "" and defined $self->[3]{$sindexname}
$sindexname ne "" defined $self->[3]{$sindexname}
Truth table33%1/3
A and B
A= $sindexname ne ""B= defined $self->[3]{$sindexname}
ABresult
0X0
100
111
907 && defined $self->[LIST_ENTRIES_INDEXED]{$sindexname} )
908 {
909 2 @arrrs = keys %{ $self->[LIST_ENTRIES_INDEXED]{$sindexname} };
910 }
911 else {
912 0 @arrrs = ();
913 } #if($sindexname ne "" && defined $self->[LIST_ENTRIES_INDEXED]{$sindexname})
914  
915 2 return (@arrrs);
916 }
917  
918 4 return 1;
↑ Summary Meta/File/List.pm »