blib/lib/Set/IntRange.pm

filter: Statementstmt 95.1% 453 / 476 Branchbran 88.4% 223 / 252 Conditioncond 73.8% 181 / 245 MC/DCmcdc 56.3% 80 / 142 Subroutinesub 96.9% 63 / 65 Podpod 0.0% 0 / 38 totaltotal 82.1% 1000 / 1218 CC 210 SCAR 19.8
CC
210
Cov
88%
_trace
42.0
from_Enum
12.6
_difference
11.9
CRAP 7.2
↑ Summary
1  
2 ###############################################################################
3 ## ##
4 ## Copyright (c) 1995 - 2009 by Steffen Beyer. ##
5 ## All rights reserved. ##
6 ## ##
7 ## This package is free software; you can redistribute it ##
8 ## and/or modify it under the same terms as Perl itself. ##
9 ## ##
10 ###############################################################################
11  
12 package Set::IntRange;
13  
14 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 8 ▶use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 8 require Exporter;
18  
19 8 @ISA = qw(Exporter);
20  
21 8 @EXPORT = qw();
22  
23 8 @EXPORT_OK = qw();
24  
25 8 $VERSION = '5.2';
26  
27 8 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29 8 ▶use Bit::Vector 7.1;
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31 use overload
32 8 ▶ '""' => '_string',
Subroutine BEGIN: called CC=1 SCAR=0.0
33 'neg' => '_complement',
34 '~' => '_complement',
35 'bool' => '_boolean',
36 '!' => '_not_boolean',
37 'abs' => '_norm',
38 '+' => '_union',
39 '|' => '_union', # alternative for '+'
40 '-' => '_difference',
41 '*' => '_intersection',
42 '&' => '_intersection', # alternative for '*'
43 '^' => '_exclusive_or',
44 '+=' => '_assign_union',
45 '|=' => '_assign_union', # alternative for '+='
46 '-=' => '_assign_difference',
47 '*=' => '_assign_intersection',
48 '&=' => '_assign_intersection', # alternative for '*='
49 '^=' => '_assign_exclusive_or',
50 '==' => '_equal',
51 '!=' => '_not_equal',
52 '<' => '_true_sub_set',
53 '<=' => '_sub_set',
54 '>' => '_true_super_set',
55 '>=' => '_super_set',
56 'cmp' => '_compare', # also enables lt, le, gt, ge, eq, ne
57 '=' => '_clone',
58 8 'fallback' => undef;
59  
60 sub new
61 191 ▶{
Subroutine new: called CC=8 SCAR=21.3
Pod undocumented
62 191 ▶ croak "Usage: \$set = Set::IntRange->new(\$lower,\$upper);"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 3 6 185 191
63 if (@_ != 3);
64  
65 185 my $proto = shift;
66 185 ▶ my $class = ref($proto) || $proto || 'Set::IntRange';
Condition100%5/5
ref $proto || $proto || 'Set::IntRange'
l!l
1823
ref $proto or $proto
l!l&&r!l&&!r
157253
MC/DC100%2/2
ref $proto || $proto || 'Set::IntRange'
ref $proto $proto
Truth table100%3/3
A or B
A= ref $protoB= $proto
ABresult
1X1
011
000
67 185 my $lower = shift;
68 185 my $upper = shift;
69 185 my $object;
70 my $set;
71  
72 185 ▶ if ($lower <= $upper)
Branch: 1 branch
BranchTrueFalseTotal
if ($lower <= $upper) { } 183 2 185
73 {
74 183 $set = Bit::Vector->new($upper-$lower+1);
75 183 ▶ if ((defined $set) && ref($set) && (${$set} != 0))
Branch: 1 branch
BranchTrueFalseTotal
if (defined $set and ref $set and ${$set;} != 0) { } 183 0 183
Condition33%2/6
defined $set and ref $set and ${$set;} != 0
!ll&&!rl&&r
00183
defined $set and ref $set
!ll&&!rl&&r
00183
MC/DC0%0/3
defined $set and ref $set and ${$set;} != 0
defined $set ref $set ${$set;} != 0
Truth table25%1/4
A and B and C
A= defined $setB= ref $setC= ${$set;} != 0
ABCresult
0XX0
10X0
1100
1111
76 {
77 183 $object = [ $set, $lower, $upper ];
78 183 bless($object, $class);
79 183 return($object);
80 }
81 else
82 {
83 0 croak
84 "Set::IntRange::new(): unable to create new 'Set::IntRange' object";
85 }
86 }
87 else
88 {
89 2 croak
90 "Set::IntRange::new(): lower > upper boundary";
91 }
92 }
93  
94 sub Resize
95 81 ▶{
Subroutine Resize: called CC=5 SCAR=16.1
Pod undocumented
96 81 ▶ croak "Usage: \$set->Resize(\$lower,\$upper);"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 3 0 81 81
97 if (@_ != 3);
98  
99 81 my($object,$new_lower,$new_upper) = @_;
100 81 my($old_lower,$old_upper) = ($object->[1],$object->[2]);
101 81 my($diff);
102  
103 81 ▶ if ($new_lower <= $new_upper)
Branch: 1 branch
BranchTrueFalseTotal
if ($new_lower <= $new_upper) { } 73 8 81
104 {
105 73 $diff = $new_lower - $old_lower;
106 73 ▶ if ($diff == 0)
Branch: 1 branch
BranchTrueFalseTotal
if ($diff == 0) { } 9 64 73
107 {
108 9 $object->[0]->Resize($new_upper-$new_lower+1);
109 }
110 else
111 {
112 64 ▶ if ($diff > 0)
Branch: 1 branch
BranchTrueFalseTotal
if ($diff > 0) { } 37 27 64
113 {
114 37 $object->[0]->Delete(0,$diff);
115 37 $object->[0]->Resize($new_upper-$new_lower+1);
116 }
117 else
118 {
119 27 $object->[0]->Resize($new_upper-$new_lower+1);
120 27 $object->[0]->Insert(0,-$diff);
121 }
122 }
123 73 ($object->[1],$object->[2]) = ($new_lower,$new_upper);
124 }
125 else
126 {
127 8 croak "Set::IntRange::Resize(): lower > upper boundary";
128 }
129 }
130  
131 sub Size
132 18 ▶{
Subroutine Size: called CC=2 SCAR=6.9
Pod undocumented
133 18 ▶ croak "Usage: (\$lower,\$upper) = \$set->Size();"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 1 2 16 18
134 if (@_ != 1);
135  
136 16 my($object) = @_;
137  
138 16 return( $object->[1], $object->[2] );
139 }
140  
141 sub Bit_Vector
142 3 ▶{
Subroutine Bit_Vector: called CC=2 SCAR=6.9
Pod undocumented
143 3 ▶ croak "Usage: \$set2->Bit_Vector->Bit_Vector_method(\$set1->Bit_Vector);"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 1 2 1 3
144 if (@_ != 1);
145  
146 1 my($object) = @_;
147  
148 1 return( $object->[0] );
149 }
150  
151 sub Empty
152 7 ▶{
Subroutine Empty: called CC=2 SCAR=6.9
Pod undocumented
153 7 ▶ croak "Usage: \$set->Empty();"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 1 2 5 7
154 if (@_ != 1);
155  
156 5 my($object) = @_;
157  
158 5 $object->[0]->Empty();
159 }
160  
161 sub Fill
162 21 ▶{
Subroutine Fill: called CC=2 SCAR=6.9
Pod undocumented
163 21 ▶ croak "Usage: \$set->Fill();"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 1 2 19 21
164 if (@_ != 1);
165  
166 19 my($object) = @_;
167  
168 19 $object->[0]->Fill();
169 }
170  
171 sub Flip
172 4 ▶{
Subroutine Flip: called CC=2 SCAR=6.9
Pod undocumented
173 4 ▶ croak "Usage: \$set->Flip();"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 1 2 2 4
174 if (@_ != 1);
175  
176 2 my($object) = @_;
177  
178 2 $object->[0]->Flip();
179 }
180  
181 sub Interval_Empty
182 120 ▶{
Subroutine Interval_Empty: called CC=7 SCAR=19.5
Pod undocumented
183 120 ▶ croak "Usage: \$set->Interval_Empty(\$min,\$max);"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 3 4 116 120
184 if (@_ != 3);
185  
186 116 my($object,$min,$max) = @_;
187 116 my($lower,$upper) = ($object->[1],$object->[2]);
188  
189 116 ▶ croak "Set::IntRange::Interval_Empty(): minimum index out of range"
Branch: 1 branch
BranchTrueFalseTotal
if $min < $lower or $min > $upper 22 94 116
Condition100%3/3
$min < $lower or $min > $upper
l!l&&r!l&&!r
111194
MC/DC100%2/2
$min < $lower or $min > $upper
$min < $lower $min > $upper
Truth table100%3/3
A or B
A= $min < $lowerB= $min > $upper
ABresult
1X1
011
000
190 if (($min < $lower) || ($min > $upper));
191  
192 94 ▶ croak "Set::IntRange::Interval_Empty(): maximum index out of range"
Branch: 1 branch
BranchTrueFalseTotal
if $max < $lower or $max > $upper 1 93 94
Condition66%2/3
$max < $lower or $max > $upper
l!l&&r!l&&!r
0193
MC/DC50%1/2
$max < $lower or $max > $upper
$max < $lower $max > $upper
Truth table66%2/3
A or B
A= $max < $lowerB= $max > $upper
ABresult
1X1
011
000
193 if (($max < $lower) || ($max > $upper));
194  
195 93 ▶ croak "Set::IntRange::Interval_Empty(): minimum > maximum index"
Branch: 1 branch
BranchTrueFalseTotal
if $min > $max 1 92 93
196 if ($min > $max);
197  
198 92 $object->[0]->Interval_Empty($min-$lower,$max-$lower);
199 }
200  
201 sub Interval_Fill
202 121 ▶{
Subroutine Interval_Fill: called CC=7 SCAR=19.5
Pod undocumented
203 121 ▶ croak "Usage: \$set->Interval_Fill(\$min,\$max);"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 3 4 117 121
204 if (@_ != 3);
205  
206 117 my($object,$min,$max) = @_;
207 117 my($lower,$upper) = ($object->[1],$object->[2]);
208  
209 117 ▶ croak "Set::IntRange::Interval_Fill(): minimum index out of range"
Branch: 1 branch
BranchTrueFalseTotal
if $min < $lower or $min > $upper 22 95 117
Condition100%3/3
$min < $lower or $min > $upper
l!l&&r!l&&!r
111195
MC/DC100%2/2
$min < $lower or $min > $upper
$min < $lower $min > $upper
Truth table100%3/3
A or B
A= $min < $lowerB= $min > $upper
ABresult
1X1
011
000
210 if (($min < $lower) || ($min > $upper));
211  
212 95 ▶ croak "Set::IntRange::Interval_Fill(): maximum index out of range"
Branch: 1 branch
BranchTrueFalseTotal
if $max < $lower or $max > $upper 1 94 95
Condition66%2/3
$max < $lower or $max > $upper
l!l&&r!l&&!r
0194
MC/DC50%1/2
$max < $lower or $max > $upper
$max < $lower $max > $upper
Truth table66%2/3
A or B
A= $max < $lowerB= $max > $upper
ABresult
1X1
011
000
213 if (($max < $lower) || ($max > $upper));
214  
215 94 ▶ croak "Set::IntRange::Interval_Fill(): minimum > maximum index"
Branch: 1 branch
BranchTrueFalseTotal
if $min > $max 1 93 94
216 if ($min > $max);
217  
218 93 $object->[0]->Interval_Fill($min-$lower,$max-$lower);
219 }
220  
221 sub Interval_Flip
222 156 ▶{
Subroutine Interval_Flip: called CC=7 SCAR=19.5
Pod undocumented
223 156 ▶ croak "Usage: \$set->Interval_Flip(\$min,\$max);"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 3 4 152 156
224 if (@_ != 3);
225  
226 152 my($object,$min,$max) = @_;
227 152 my($lower,$upper) = ($object->[1],$object->[2]);
228  
229 152 ▶ croak "Set::IntRange::Interval_Flip(): minimum index out of range"
Branch: 1 branch
BranchTrueFalseTotal
if $min < $lower or $min > $upper 22 130 152
Condition100%3/3
$min < $lower or $min > $upper
l!l&&r!l&&!r
1111130
MC/DC100%2/2
$min < $lower or $min > $upper
$min < $lower $min > $upper
Truth table100%3/3
A or B
A= $min < $lowerB= $min > $upper
ABresult
1X1
011
000
230 if (($min < $lower) || ($min > $upper));
231  
232 130 ▶ croak "Set::IntRange::Interval_Flip(): maximum index out of range"
Branch: 1 branch
BranchTrueFalseTotal
if $max < $lower or $max > $upper 1 129 130
Condition66%2/3
$max < $lower or $max > $upper
l!l&&r!l&&!r
01129
MC/DC50%1/2
$max < $lower or $max > $upper
$max < $lower $max > $upper
Truth table66%2/3
A or B
A= $max < $lowerB= $max > $upper
ABresult
1X1
011
000
233 if (($max < $lower) || ($max > $upper));
234  
235 129 ▶ croak "Set::IntRange::Interval_Flip(): minimum > maximum index"
Branch: 1 branch
BranchTrueFalseTotal
if $min > $max 1 128 129
236 if ($min > $max);
237  
238 128 $object->[0]->Interval_Flip($min-$lower,$max-$lower);
239 }
240  
241 sub Interval_Scan_inc
242 118 ▶{
Subroutine Interval_Scan_inc: called CC=5 SCAR=16.2
Pod undocumented
243 118 ▶ croak "Usage: (\$min,\$max) = \$set->Interval_Scan_inc(\$start);"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 2 3 115 118
244 if (@_ != 2);
245  
246 115 my($object,$start) = @_;
247 115 my($lower,$upper) = ($object->[1],$object->[2]);
248 115 my($min,$max);
249  
250 115 ▶ croak "Set::IntRange::Interval_Scan_inc(): start index out of range"
Branch: 1 branch
BranchTrueFalseTotal
if $start < $lower or $start > $upper 23 92 115
Condition100%3/3
$start < $lower or $start > $upper
l!l&&r!l&&!r
111292
MC/DC100%2/2
$start < $lower or $start > $upper
$start < $lower $start > $upper
Truth table100%3/3
A or B
A= $start < $lowerB= $start > $upper
ABresult
1X1
011
000
251 if (($start < $lower) || ($start > $upper));
252  
253 92 ▶ if (($min,$max) = $object->[0]->Interval_Scan_inc($start-$lower))
Branch: 1 branch
BranchTrueFalseTotal
if (() = $object->[0]->Interval_Scan_inc($start - $lower)) { } 92 0 92
254 {
255 92 $min += $lower;
256 92 $max += $lower;
257 92 return($min,$max);
258 }
259 else
260 {
261 0 return();
262 }
263 }
264  
265 sub Interval_Scan_dec
266 118 ▶{
Subroutine Interval_Scan_dec: called CC=5 SCAR=16.1
Pod undocumented
267 118 ▶ croak "Usage: (\$min,\$max) = \$set->Interval_Scan_dec(\$start);"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 2 3 115 118
268 if (@_ != 2);
269  
270 115 my($object,$start) = @_;
271 115 my($lower,$upper) = ($object->[1],$object->[2]);
272 115 my($min,$max);
273  
274 115 ▶ croak "Set::IntRange::Interval_Scan_dec(): start index out of range"
Branch: 1 branch
BranchTrueFalseTotal
if $start < $lower or $start > $upper 23 92 115
Condition100%3/3
$start < $lower or $start > $upper
l!l&&r!l&&!r
111292
MC/DC100%2/2
$start < $lower or $start > $upper
$start < $lower $start > $upper
Truth table100%3/3
A or B
A= $start < $lowerB= $start > $upper
ABresult
1X1
011
000
275 if (($start < $lower) || ($start > $upper));
276  
277 92 ▶ if (($min,$max) = $object->[0]->Interval_Scan_dec($start-$lower))
Branch: 1 branch
BranchTrueFalseTotal
if (() = $object->[0]->Interval_Scan_dec($start - $lower)) { } 36 56 92
278 {
279 36 $min += $lower;
280 36 $max += $lower;
281 36 return($min,$max);
282 }
283 else
284 {
285 56 return();
286 }
287 }
288  
289 sub Bit_Off
290 3422 ▶{
Subroutine Bit_Off: called CC=4 SCAR=13.9
Pod undocumented
291 3422 ▶ croak "Usage: \$set->Bit_Off(\$index);"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 2 3 3419 3422
292 if (@_ != 2);
293  
294 3419 my($object,$index) = @_;
295 3419 my($lower,$upper) = ($object->[1],$object->[2]);
296  
297 3419 ▶ if (($index >= $lower) && ($index <= $upper))
Branch: 1 branch
BranchTrueFalseTotal
if ($index >= $lower and $index <= $upper) { } 3398 21 3419
Condition100%3/3
$index >= $lower and $index <= $upper
!ll&&!rl&&r
10113398
MC/DC100%2/2
$index >= $lower and $index <= $upper
$index >= $lower $index <= $upper
Truth table100%3/3
A and B
A= $index >= $lowerB= $index <= $upper
ABresult
0X0
100
111
298 {
299 3398 $object->[0]->Bit_Off($index-$lower);
300 }
301 else
302 {
303 21 croak "Set::IntRange::Bit_Off(): index out of range";
304 }
305 }
306  
307 sub Bit_On
308 1139 ▶{
Subroutine Bit_On: called CC=4 SCAR=13.9
Pod undocumented
309 1139 ▶ croak "Usage: \$set->Bit_On(\$index);"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 2 3 1136 1139
310 if (@_ != 2);
311  
312 1136 my($object,$index) = @_;
313 1136 my($lower,$upper) = ($object->[1],$object->[2]);
314  
315 1136 ▶ if (($index >= $lower) && ($index <= $upper))
Branch: 1 branch
BranchTrueFalseTotal
if ($index >= $lower and $index <= $upper) { } 1115 21 1136
Condition100%3/3
$index >= $lower and $index <= $upper
!ll&&!rl&&r
10111115
MC/DC100%2/2
$index >= $lower and $index <= $upper
$index >= $lower $index <= $upper
Truth table100%3/3
A and B
A= $index >= $lowerB= $index <= $upper
ABresult
0X0
100
111
316 {
317 1115 $object->[0]->Bit_On($index-$lower);
318 }
319 else
320 {
321 21 croak "Set::IntRange::Bit_On(): index out of range";
322 }
323 }
324  
325 sub bit_flip
326 122 ▶{
Subroutine bit_flip: called CC=4 SCAR=13.9
Pod undocumented
327 122 ▶ croak "Usage: if (\$set->bit_flip(\$index))"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 2 3 119 122
328 if (@_ != 2);
329  
330 119 my($object,$index) = @_;
331 119 my($lower,$upper) = ($object->[1],$object->[2]);
332  
333 119 ▶ if (($index >= $lower) && ($index <= $upper))
Branch: 1 branch
BranchTrueFalseTotal
if ($index >= $lower and $index <= $upper) { } 98 21 119
Condition100%3/3
$index >= $lower and $index <= $upper
!ll&&!rl&&r
101198
MC/DC100%2/2
$index >= $lower and $index <= $upper
$index >= $lower $index <= $upper
Truth table100%3/3
A and B
A= $index >= $lowerB= $index <= $upper
ABresult
0X0
100
111
334 {
335 98 return( $object->[0]->bit_flip($index-$lower) );
336 }
337 else
338 {
339 21 croak "Set::IntRange::bit_flip(): index out of range";
340 }
341 }
342  
343 sub bit_test
344 103596 ▶{
Subroutine bit_test: called CC=4 SCAR=13.9
Pod undocumented
345 103596 ▶ croak "Usage: if (\$set->bit_test(\$index))"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 2 6 103590 103596
346 if (@_ != 2);
347  
348 103590 my($object,$index) = @_;
349 103590 my($lower,$upper) = ($object->[1],$object->[2]);
350  
351 103590 ▶ if (($index >= $lower) && ($index <= $upper))
Branch: 1 branch
BranchTrueFalseTotal
if ($index >= $lower and $index <= $upper) { } 103548 42 103590
Condition100%3/3
$index >= $lower and $index <= $upper
!ll&&!rl&&r
2022103548
MC/DC100%2/2
$index >= $lower and $index <= $upper
$index >= $lower $index <= $upper
Truth table100%3/3
A and B
A= $index >= $lowerB= $index <= $upper
ABresult
0X0
100
111
352 {
353 103548 return( $object->[0]->bit_test($index-$lower) );
354 }
355 else
356 {
357 42 croak "Set::IntRange::bit_test(): index out of range";
358 }
359 }
360  
361 sub contains
362 101 ▶{
Subroutine contains: called CC=1 SCAR=0.0
Pod undocumented
363 101 return( bit_test(@_) );
364 }
365  
366 sub Norm
367 208 ▶{
Subroutine Norm: called CC=2 SCAR=6.9
Pod undocumented
368 208 ▶ croak "Usage: \$norm = \$set->Norm();"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 1 2 206 208
369 if (@_ != 1);
370  
371 206 my($object) = @_;
372  
373 206 return( $object->[0]->Norm() );
374 }
375  
376 sub Min
377 188 ▶{
Subroutine Min: called CC=4 SCAR=13.9
Pod undocumented
378 188 ▶ croak "Usage: \$min = \$set->Min();"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 1 2 186 188
379 if (@_ != 1);
380  
381 186 my($object) = @_;
382 186 my($lower,$upper) = ($object->[1],$object->[2]);
383 186 my($result);
384  
385 186 $result = $object->[0]->Min();
386 186 ▶ return( (($result >= 0) && ($result <= ($upper-$lower))) ?
Branch: 1 branch
BranchTrueFalseTotal
$result >= 0 && $result <= $upper - $lower ? : 106 80 186
Condition66%2/3
$result >= 0 and $result <= $upper - $lower
!ll&&!rl&&r
080106
MC/DC50%1/2
$result >= 0 and $result <= $upper - $lower
$result >= 0 $result <= $upper - $lower
Truth table66%2/3
A and B
A= $result >= 0B= $result <= $upper - $lower
ABresult
0X0
100
111
387 ($result+$lower) : $result );
388 }
389  
390 sub Max
391 188 ▶{
Subroutine Max: called CC=4 SCAR=13.9
Pod undocumented
392 188 ▶ croak "Usage: \$max = \$set->Max();"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 1 2 186 188
393 if (@_ != 1);
394  
395 186 my($object) = @_;
396 186 my($lower,$upper) = ($object->[1],$object->[2]);
397 186 my($result);
398  
399 186 $result = $object->[0]->Max();
400 186 ▶ return( (($result >= 0) && ($result <= ($upper-$lower))) ?
Branch: 1 branch
BranchTrueFalseTotal
$result >= 0 && $result <= $upper - $lower ? : 106 80 186
Condition66%2/3
$result >= 0 and $result <= $upper - $lower
!ll&&!rl&&r
800106
MC/DC50%1/2
$result >= 0 and $result <= $upper - $lower
$result >= 0 $result <= $upper - $lower
Truth table66%2/3
A and B
A= $result >= 0B= $result <= $upper - $lower
ABresult
0X0
100
111
401 ($result+$lower) : $result );
402 }
403  
404 sub Union
405 21 ▶{
Subroutine Union: called CC=6 SCAR=18.0
Pod undocumented
406 21 ▶ croak "Usage: \$set1->Union(\$set2,\$set3);"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 3 4 17 21
407 if (@_ != 3);
408  
409 17 my($set1,$set2,$set3) = @_;
410 17 my($lower1,$upper1) = ($set1->[1],$set1->[2]);
411 17 my($lower2,$upper2) = ($set2->[1],$set2->[2]);
412 17 my($lower3,$upper3) = ($set3->[1],$set3->[2]);
413  
414 17 ▶ if (($lower1 == $lower2) && ($lower1 == $lower3) &&
Branch: 1 branch
BranchTrueFalseTotal
if ($lower1 == $lower2 and $lower1 == $lower3 and $upper1 == $upper2 and $upper1 == $upper3) { } 13 4 17
Condition77%7/9
$lower1 == $lower2 and $lower1 == $lower3 and $upper1 == $upper2 and $upper1 == $upper3
!ll&&!rl&&r
4013
$lower1 == $lower2 and $lower1 == $lower3 and $upper1 == $upper2
!ll&&!rl&&r
4013
$lower1 == $lower2 and $lower1 == $lower3
!ll&&!rl&&r
3113
MC/DC50%2/4
$lower1 == $lower2 and $lower1 == $lower3 and $upper1 == $upper2 and $upper1 == $upper3
$lower1 == $lower2 $lower1 == $lower3 $upper1 == $upper2 $upper1 == $upper3
Truth table60%3/5
A and B and C and D
A= $lower1 == $lower2B= $lower1 == $lower3C= $upper1 == $upper2D= $upper1 == $upper3
ABCDresult
0XXX0
10XX0
110X0
11100
11111
415 ($upper1 == $upper2) && ($upper1 == $upper3))
416 {
417 13 $set1->[0]->Union($set2->[0],$set3->[0]);
418 }
419 else
420 {
421 4 croak "Set::IntRange::Union(): set size mismatch";
422 }
423 }
424  
425 sub Intersection
426 21 ▶{
Subroutine Intersection: called CC=6 SCAR=18.0
Pod undocumented
427 21 ▶ croak "Usage: \$set1->Intersection(\$set2,\$set3);"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 3 4 17 21
428 if (@_ != 3);
429  
430 17 my($set1,$set2,$set3) = @_;
431 17 my($lower1,$upper1) = ($set1->[1],$set1->[2]);
432 17 my($lower2,$upper2) = ($set2->[1],$set2->[2]);
433 17 my($lower3,$upper3) = ($set3->[1],$set3->[2]);
434  
435 17 ▶ if (($lower1 == $lower2) && ($lower1 == $lower3) &&
Branch: 1 branch
BranchTrueFalseTotal
if ($lower1 == $lower2 and $lower1 == $lower3 and $upper1 == $upper2 and $upper1 == $upper3) { } 13 4 17
Condition77%7/9
$lower1 == $lower2 and $lower1 == $lower3 and $upper1 == $upper2 and $upper1 == $upper3
!ll&&!rl&&r
4013
$lower1 == $lower2 and $lower1 == $lower3 and $upper1 == $upper2
!ll&&!rl&&r
4013
$lower1 == $lower2 and $lower1 == $lower3
!ll&&!rl&&r
3113
MC/DC50%2/4
$lower1 == $lower2 and $lower1 == $lower3 and $upper1 == $upper2 and $upper1 == $upper3
$lower1 == $lower2 $lower1 == $lower3 $upper1 == $upper2 $upper1 == $upper3
Truth table60%3/5
A and B and C and D
A= $lower1 == $lower2B= $lower1 == $lower3C= $upper1 == $upper2D= $upper1 == $upper3
ABCDresult
0XXX0
10XX0
110X0
11100
11111
436 ($upper1 == $upper2) && ($upper1 == $upper3))
437 {
438 13 $set1->[0]->Intersection($set2->[0],$set3->[0]);
439 }
440 else
441 {
442 4 croak "Set::IntRange::Intersection(): set size mismatch";
443 }
444 }
445  
446 sub Difference
447 16 ▶{
Subroutine Difference: called CC=6 SCAR=18.0
Pod undocumented
448 16 ▶ croak "Usage: \$set1->Difference(\$set2,\$set3);"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 3 4 12 16
449 if (@_ != 3);
450  
451 12 my($set1,$set2,$set3) = @_;
452 12 my($lower1,$upper1) = ($set1->[1],$set1->[2]);
453 12 my($lower2,$upper2) = ($set2->[1],$set2->[2]);
454 12 my($lower3,$upper3) = ($set3->[1],$set3->[2]);
455  
456 12 ▶ if (($lower1 == $lower2) && ($lower1 == $lower3) &&
Branch: 1 branch
BranchTrueFalseTotal
if ($lower1 == $lower2 and $lower1 == $lower3 and $upper1 == $upper2 and $upper1 == $upper3) { } 8 4 12
Condition77%7/9
$lower1 == $lower2 and $lower1 == $lower3 and $upper1 == $upper2 and $upper1 == $upper3
!ll&&!rl&&r
408
$lower1 == $lower2 and $lower1 == $lower3 and $upper1 == $upper2
!ll&&!rl&&r
408
$lower1 == $lower2 and $lower1 == $lower3
!ll&&!rl&&r
318
MC/DC50%2/4
$lower1 == $lower2 and $lower1 == $lower3 and $upper1 == $upper2 and $upper1 == $upper3
$lower1 == $lower2 $lower1 == $lower3 $upper1 == $upper2 $upper1 == $upper3
Truth table60%3/5
A and B and C and D
A= $lower1 == $lower2B= $lower1 == $lower3C= $upper1 == $upper2D= $upper1 == $upper3
ABCDresult
0XXX0
10XX0
110X0
11100
11111
457 ($upper1 == $upper2) && ($upper1 == $upper3))
458 {
459 8 $set1->[0]->Difference($set2->[0],$set3->[0]);
460 }
461 else
462 {
463 4 croak "Set::IntRange::Difference(): set size mismatch";
464 }
465 }
466  
467 sub ExclusiveOr
468 13 ▶{
Subroutine ExclusiveOr: called CC=6 SCAR=18.0
Pod undocumented
469 13 ▶ croak "Usage: \$set1->ExclusiveOr(\$set2,\$set3);"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 3 4 9 13
470 if (@_ != 3);
471  
472 9 my($set1,$set2,$set3) = @_;
473 9 my($lower1,$upper1) = ($set1->[1],$set1->[2]);
474 9 my($lower2,$upper2) = ($set2->[1],$set2->[2]);
475 9 my($lower3,$upper3) = ($set3->[1],$set3->[2]);
476  
477 9 ▶ if (($lower1 == $lower2) && ($lower1 == $lower3) &&
Branch: 1 branch
BranchTrueFalseTotal
if ($lower1 == $lower2 and $lower1 == $lower3 and $upper1 == $upper2 and $upper1 == $upper3) { } 5 4 9
Condition77%7/9
$lower1 == $lower2 and $lower1 == $lower3 and $upper1 == $upper2 and $upper1 == $upper3
!ll&&!rl&&r
405
$lower1 == $lower2 and $lower1 == $lower3 and $upper1 == $upper2
!ll&&!rl&&r
405
$lower1 == $lower2 and $lower1 == $lower3
!ll&&!rl&&r
315
MC/DC50%2/4
$lower1 == $lower2 and $lower1 == $lower3 and $upper1 == $upper2 and $upper1 == $upper3
$lower1 == $lower2 $lower1 == $lower3 $upper1 == $upper2 $upper1 == $upper3
Truth table60%3/5
A and B and C and D
A= $lower1 == $lower2B= $lower1 == $lower3C= $upper1 == $upper2D= $upper1 == $upper3
ABCDresult
0XXX0
10XX0
110X0
11100
11111
478 ($upper1 == $upper2) && ($upper1 == $upper3))
479 {
480 5 $set1->[0]->ExclusiveOr($set2->[0],$set3->[0]);
481 }
482 else
483 {
484 4 croak "Set::IntRange::ExclusiveOr(): set size mismatch";
485 }
486 }
487  
488 sub Complement
489 14 ▶{
Subroutine Complement: called CC=4 SCAR=13.9
Pod undocumented
490 14 ▶ croak "Usage: \$set1->Complement(\$set2);"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 2 3 11 14
491 if (@_ != 2);
492  
493 11 my($set1,$set2) = @_;
494 11 my($lower1,$upper1) = ($set1->[1],$set1->[2]);
495 11 my($lower2,$upper2) = ($set2->[1],$set2->[2]);
496  
497 11 ▶ if (($lower1 == $lower2) && ($upper1 == $upper2))
Branch: 1 branch
BranchTrueFalseTotal
if ($lower1 == $lower2 and $upper1 == $upper2) { } 10 1 11
Condition66%2/3
$lower1 == $lower2 and $upper1 == $upper2
!ll&&!rl&&r
1010
MC/DC50%1/2
$lower1 == $lower2 and $upper1 == $upper2
$lower1 == $lower2 $upper1 == $upper2
Truth table66%2/3
A and B
A= $lower1 == $lower2B= $upper1 == $upper2
ABresult
0X0
100
111
498 {
499 10 $set1->[0]->Complement($set2->[0]);
500 }
501 else
502 {
503 1 croak "Set::IntRange::Complement(): set size mismatch";
504 }
505 }
506  
507 sub is_empty
508 51 ▶{
Subroutine is_empty: called CC=2 SCAR=6.9
Pod undocumented
509 51 ▶ croak "Usage: if (\$set->is_empty())"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 1 2 49 51
510 if (@_ != 1);
511  
512 49 my($object) = @_;
513  
514 49 return( $object->[0]->is_empty() );
515 }
516  
517 sub is_full
518 35 ▶{
Subroutine is_full: called CC=2 SCAR=6.9
Pod undocumented
519 35 ▶ croak "Usage: if (\$set->is_full())"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 1 2 33 35
520 if (@_ != 1);
521  
522 33 my($object) = @_;
523  
524 33 return( $object->[0]->is_full() );
525 }
526  
527 sub equal
528 148 ▶{
Subroutine equal: called CC=4 SCAR=13.9
Pod undocumented
529 148 ▶ croak "Usage: if (\$set1->equal(\$set2))"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 2 3 145 148
530 if (@_ != 2);
531  
532 145 my($set1,$set2) = @_;
533 145 my($lower1,$upper1) = ($set1->[1],$set1->[2]);
534 145 my($lower2,$upper2) = ($set2->[1],$set2->[2]);
535  
536 145 ▶ if (($lower1 == $lower2) && ($upper1 == $upper2))
Branch: 1 branch
BranchTrueFalseTotal
if ($lower1 == $lower2 and $upper1 == $upper2) { } 144 1 145
Condition66%2/3
$lower1 == $lower2 and $upper1 == $upper2
!ll&&!rl&&r
10144
MC/DC50%1/2
$lower1 == $lower2 and $upper1 == $upper2
$lower1 == $lower2 $upper1 == $upper2
Truth table66%2/3
A and B
A= $lower1 == $lower2B= $upper1 == $upper2
ABresult
0X0
100
111
537 {
538 144 return( $set1->[0]->equal($set2->[0]) );
539 }
540 else
541 {
542 1 croak "Set::IntRange::equal(): set size mismatch";
543 }
544 }
545  
546 sub subset
547 29 ▶{
Subroutine subset: called CC=4 SCAR=13.9
Pod undocumented
548 29 ▶ croak "Usage: if (\$set1->subset(\$set2))"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 2 3 26 29
549 if (@_ != 2);
550  
551 26 my($set1,$set2) = @_;
552 26 my($lower1,$upper1) = ($set1->[1],$set1->[2]);
553 26 my($lower2,$upper2) = ($set2->[1],$set2->[2]);
554  
555 26 ▶ if (($lower1 == $lower2) && ($upper1 == $upper2))
Branch: 1 branch
BranchTrueFalseTotal
if ($lower1 == $lower2 and $upper1 == $upper2) { } 25 1 26
Condition66%2/3
$lower1 == $lower2 and $upper1 == $upper2
!ll&&!rl&&r
1025
MC/DC50%1/2
$lower1 == $lower2 and $upper1 == $upper2
$lower1 == $lower2 $upper1 == $upper2
Truth table66%2/3
A and B
A= $lower1 == $lower2B= $upper1 == $upper2
ABresult
0X0
100
111
556 {
557 25 return( $set1->[0]->subset($set2->[0]) );
558 }
559 else
560 {
561 1 croak "Set::IntRange::subset(): set size mismatch";
562 }
563 }
564  
565 sub Lexicompare
566 5 ▶{
Subroutine Lexicompare: called CC=4 SCAR=13.9
Pod undocumented
567 5 ▶ croak "Usage: \$cmp = \$set1->Lexicompare(\$set2);"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 2 3 2 5
568 if (@_ != 2);
569  
570 2 my($set1,$set2) = @_;
571 2 my($lower1,$upper1) = ($set1->[1],$set1->[2]);
572 2 my($lower2,$upper2) = ($set2->[1],$set2->[2]);
573  
574 2 ▶ if (($lower1 == $lower2) && ($upper1 == $upper2))
Branch: 1 branch
BranchTrueFalseTotal
if ($lower1 == $lower2 and $upper1 == $upper2) { } 1 1 2
Condition66%2/3
$lower1 == $lower2 and $upper1 == $upper2
!ll&&!rl&&r
101
MC/DC50%1/2
$lower1 == $lower2 and $upper1 == $upper2
$lower1 == $lower2 $upper1 == $upper2
Truth table66%2/3
A and B
A= $lower1 == $lower2B= $upper1 == $upper2
ABresult
0X0
100
111
575 {
576 1 return( $set1->[0]->Lexicompare($set2->[0]) );
577 }
578 else
579 {
580 1 croak "Set::IntRange::Lexicompare(): set size mismatch";
581 }
582 }
583  
584 sub Compare
585 26 ▶{
Subroutine Compare: called CC=4 SCAR=13.9
Pod undocumented
586 26 ▶ croak "Usage: \$cmp = \$set1->Compare(\$set2);"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 2 3 23 26
587 if (@_ != 2);
588  
589 23 my($set1,$set2) = @_;
590 23 my($lower1,$upper1) = ($set1->[1],$set1->[2]);
591 23 my($lower2,$upper2) = ($set2->[1],$set2->[2]);
592  
593 23 ▶ if (($lower1 == $lower2) && ($upper1 == $upper2))
Branch: 1 branch
BranchTrueFalseTotal
if ($lower1 == $lower2 and $upper1 == $upper2) { } 22 1 23
Condition66%2/3
$lower1 == $lower2 and $upper1 == $upper2
!ll&&!rl&&r
1022
MC/DC50%1/2
$lower1 == $lower2 and $upper1 == $upper2
$lower1 == $lower2 $upper1 == $upper2
Truth table66%2/3
A and B
A= $lower1 == $lower2B= $upper1 == $upper2
ABresult
0X0
100
111
594 {
595 22 return( $set1->[0]->Compare($set2->[0]) );
596 }
597 else
598 {
599 1 croak "Set::IntRange::Compare(): set size mismatch";
600 }
601 }
602  
603 sub Copy
604 108 ▶{
Subroutine Copy: called CC=4 SCAR=13.9
Pod undocumented
605 108 ▶ croak "Usage: \$set1->Copy(\$set2);"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 2 3 105 108
606 if (@_ != 2);
607  
608 105 my($set1,$set2) = @_;
609 105 my($lower1,$upper1) = ($set1->[1],$set1->[2]);
610 105 my($lower2,$upper2) = ($set2->[1],$set2->[2]);
611  
612 105 ▶ if (($lower1 == $lower2) && ($upper1 == $upper2))
Branch: 1 branch
BranchTrueFalseTotal
if ($lower1 == $lower2 and $upper1 == $upper2) { } 104 1 105
Condition66%2/3
$lower1 == $lower2 and $upper1 == $upper2
!ll&&!rl&&r
10104
MC/DC50%1/2
$lower1 == $lower2 and $upper1 == $upper2
$lower1 == $lower2 $upper1 == $upper2
Truth table66%2/3
A and B
A= $lower1 == $lower2B= $upper1 == $upper2
ABresult
0X0
100
111
613 {
614 104 $set1->[0]->Copy($set2->[0]);
615 }
616 else
617 {
618 1 croak "Set::IntRange::Copy(): set size mismatch";
619 }
620 }
621  
622 sub Shadow
623 1 ▶{
Subroutine Shadow: called CC=2 SCAR=7.0
Pod undocumented
624 1 ▶ croak "Usage: \$other_set = \$some_set->Shadow();"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 1 0 1 1
625 if (@_ != 1);
626  
627 1 my($object) = @_;
628 1 my($result);
629  
630 1 $result = $object->new($object->[1],$object->[2]);
631 1 return($result);
632 }
633  
634 sub Clone
635 81 ▶{
Subroutine Clone: called CC=2 SCAR=7.0
Pod undocumented
636 81 ▶ croak "Usage: \$twin_set = \$some_set->Clone();"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 1 0 81 81
637 if (@_ != 1);
638  
639 81 my($object) = @_;
640 81 my($result);
641  
642 81 $result = $object->new($object->[1],$object->[2]);
643 81 $result->Copy($object);
644 81 return($result);
645 }
646  
647 sub to_Enum
648 1 ▶{
Subroutine to_Enum: called CC=6 SCAR=17.9
Pod undocumented
649 1 ▶ croak "Usage: \$string = \$set->to_Enum();"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 1 0 1 1
650 if (@_ != 1);
651  
652 1 my($object) = @_;
653 1 my($lower) = $object->[1];
654 1 my($start,$string);
655 1 my($min,$max);
656  
657 1 $start = 0;
658 1 $string = '';
659 1 ▶ while (($start < $object->[0]->Size()) &&
Branch: 1 branch
BranchTrueFalseTotal
if ($start < $object->[0]->Size and () = $object->[0]->Interval_Scan_inc($start)) 38 1 39
Condition66%2/3
$start < $object->[0]->Size and () = $object->[0]->Interval_Scan_inc($start)
!ll&&!rl&&r
0138
MC/DC50%1/2
$start < $object->[0]->Size and () = $object->[0]->Interval_Scan_inc($start)
$start < $object->[0]->Size () = $object->[0]->Interval_Scan_inc($start)
Truth table66%2/3
A and B
A= $start < $object->[0]->SizeB= () = $object->[0]->Interval_Scan_inc($start)
ABresult
0X0
100
111
660 (($min,$max) = $object->[0]->Interval_Scan_inc($start)))
661 {
662 38 $start = $max + 2;
663 38 $min += $lower;
664 38 $max += $lower;
665 38 ▶ if ($min == $max) { $string .= "${min},"; }
Branch: 2 branches
BranchTrueFalseTotal
if ($min == $max) { } 33 5 38
elsif ($min == $max - 1) { } 1 4 5
666 1 elsif ($min == $max-1) { $string .= "${min},${max},"; }
667 4 else { $string .= "${min}..${max},"; }
668 }
669 1 $string =~ s/,$//;
670 1 return($string);
671 }
672  
673 sub from_Enum
674 7 ▶{
Subroutine from_Enum: called CC=12 SCAR=25.4
Pod undocumented
675 7 ▶ croak "Usage: \$set->from_Enum(\$string);"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 2 0 7 7
676 if (@_ != 2);
677  
678 7 my($object,$string) = @_;
679 7 my($lower,$upper) = ($object->[1],$object->[2]);
680 7 my(@intervals,$interval);
681 7 my($min,$max);
682  
683 7 ▶ croak "Set::IntRange::from_Enum(): syntax error in input string"
Branch: 1 branch
BranchTrueFalseTotal
unless $string =~ /^ (?: [+-]? \d+ (?: \.\. [+-]? \d+ )? ) (?: , (?: [+-]? \d+ (?: \.\. [+-]? \d+ )? ) )* $/x 0 7 7
684 unless ($string =~ /^ (?: [+-]? \d+ (?: \.\. [+-]? \d+ )? )
685 (?: , (?: [+-]? \d+ (?: \.\. [+-]? \d+ )? ) )* $/x);
686  
687 7 $object->[0]->Empty();
688  
689 7 @intervals = split(/,/, $string);
690  
691 7 foreach $interval (@intervals)
692 {
693 83 ▶ if ($interval =~ /\.\./)
Branch: 1 branch
BranchTrueFalseTotal
if ($interval =~ /\.\./) { } 13 70 83
694 {
695 13 ($min,$max) = split(/\.\./, $interval);
696  
697 13 ▶ croak "Set::IntRange::from_Enum(): minimum index out of range"
Branch: 1 branch
BranchTrueFalseTotal
if $min < $lower or $min > $upper 1 12 13
Condition66%2/3
$min < $lower or $min > $upper
l!l&&r!l&&!r
1012
MC/DC50%1/2
$min < $lower or $min > $upper
$min < $lower $min > $upper
Truth table66%2/3
A or B
A= $min < $lowerB= $min > $upper
ABresult
1X1
011
000
698 if (($min < $lower) || ($min > $upper));
699  
700 12 ▶ croak "Set::IntRange::from_Enum(): maximum index out of range"
Branch: 1 branch
BranchTrueFalseTotal
if $max < $lower or $max > $upper 1 11 12
Condition66%2/3
$max < $lower or $max > $upper
l!l&&r!l&&!r
0111
MC/DC50%1/2
$max < $lower or $max > $upper
$max < $lower $max > $upper
Truth table66%2/3
A or B
A= $max < $lowerB= $max > $upper
ABresult
1X1
011
000
701 if (($max < $lower) || ($max > $upper));
702  
703 11 ▶ croak "Set::IntRange::from_Enum(): minimum > maximum index"
Branch: 1 branch
BranchTrueFalseTotal
if $min > $max 1 10 11
704 if ($min > $max);
705  
706 10 $min -= $lower;
707 10 $max -= $lower;
708  
709 10 $object->[0]->Interval_Fill($min,$max);
710 }
711 else
712 {
713 70 ▶ croak "Set::IntRange::from_Enum(): index out of range"
Branch: 1 branch
BranchTrueFalseTotal
if $interval < $lower or $interval > $upper 0 70 70
Condition33%1/3
$interval < $lower or $interval > $upper
l!l&&r!l&&!r
0070
MC/DC0%0/2
$interval < $lower or $interval > $upper
$interval < $lower $interval > $upper
Truth table33%1/3
A or B
A= $interval < $lowerB= $interval > $upper
ABresult
1X1
011
000
714 if (($interval < $lower) || ($interval > $upper));
715  
716 70 $interval -= $lower;
717  
718 70 $object->[0]->Bit_On($interval);
719 }
720 }
721 }
722  
723 sub to_Hex
724 1 ▶{
Subroutine to_Hex: called CC=2 SCAR=7.1
Pod undocumented
725 1 ▶ croak "Usage: \$string = \$set->to_Hex();"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 1 0 1 1
726 if (@_ != 1);
727  
728 1 my($object) = @_;
729  
730 1 return( $object->[0]->to_Hex() );
731 }
732  
733 sub from_Hex
734 1 ▶{
Subroutine from_Hex: called CC=3 SCAR=11.8
Pod undocumented
735 1 ▶ croak "Usage: \$set->from_Hex(\$string);"
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 2 0 1 1
736 if (@_ != 2);
737  
738 1 my($object,$string) = @_;
739  
740 1 eval { $object->[0]->from_Hex($string); };
741 1 ▶ if ($@)
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 1 1
742 {
743 0 croak "Set::IntRange::from_Hex(): syntax error in input string";
744 }
745 }
746  
747 ########################################
748 # #
749 # define overloaded operators section: #
750 # #
751 ########################################
752  
753 sub _string
754 0 ▶{
Subroutine _string: not called CC=1 SCAR=6.9
755 0 my($object,$argument,$flag) = @_;
756 # my($name) = '""'; #&_trace($name,$object,$argument,$flag);
757 0 my($vector) = $object->[0];
758  
759 0 return( "$vector" );
760 }
761  
762 sub _complement
763 6 ▶{
Subroutine _complement: called CC=1 SCAR=0.0
764 6 my($object,$argument,$flag) = @_;
765 # my($name) = "'~'"; #&_trace($name,$object,$argument,$flag);
766 6 my($result);
767  
768 6 $result = $object->new($object->[1],$object->[2]);
769 6 $result->Complement($object);
770 6 return($result);
771 }
772  
773 sub _boolean
774 10 ▶{
Subroutine _boolean: called CC=1 SCAR=0.0
775 10 my($object,$argument,$flag) = @_;
776 # my($name) = "bool"; #&_trace($name,$object,$argument,$flag);
777  
778 10 return( ! $object->is_empty() );
779 }
780  
781 sub _not_boolean
782 6 ▶{
Subroutine _not_boolean: called CC=1 SCAR=0.0
783 6 my($object,$argument,$flag) = @_;
784 # my($name) = "'!'"; #&_trace($name,$object,$argument,$flag);
785  
786 6 return( $object->is_empty() );
787 }
788  
789 sub _norm
790 35 ▶{
Subroutine _norm: called CC=1 SCAR=0.0
791 35 my($object,$argument,$flag) = @_;
792 # my($name) = "abs"; #&_trace($name,$object,$argument,$flag);
793  
794 35 return( $object->Norm() );
795 }
796  
797 sub _union
798 1041 ▶{
Subroutine _union: called CC=8 SCAR=20.8
799 1041 my($object,$argument,$flag) = @_;
800 1041 my($name) = "'+'"; #&_trace($name,$object,$argument,$flag);
801 1041 my($result);
802  
803 1041 ▶ if ((defined $argument) && ref($argument) &&
Branch: 2 branches
BranchTrueFalseTotal
if (defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/) { } 12 1029 1041
elsif (defined $argument and not ref $argument) { } 1009 20 1029
Condition83%5/6
defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
!ll&&!rl&&r
10092012
defined $argument and ref $argument
!ll&&!rl&&r
0100932
MC/DC66%2/3
defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
defined $argument ref $argument not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
Truth table75%3/4
A and B and not(C)
A= defined $argumentB= ref $argumentC= not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
ABCresult
0XX0
10X0
1100
1111
804 (ref($argument) !~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/))
805 {
806 12 ▶ if (defined $flag)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $flag) { } 10 2 12
807 {
808 10 $result = $object->new($object->[1],$object->[2]);
809 10 $result->Union($object,$argument);
810 10 return($result);
811 }
812 else
813 {
814 2 $object->Union($object,$argument);
815 2 return($object);
816 }
817 }
818 ▶ elsif ((defined $argument) && !(ref($argument)))
Condition66%2/3
defined $argument and not ref $argument
!ll&&!rl&&r
0201009
MC/DC50%1/2
defined $argument and not ref $argument
defined $argument not ref $argument
Truth table66%2/3
A and not(B)
A= defined $argumentB= not ref $argument
ABresult
0X0
100
111
819 {
820 1009 ▶ if (defined $flag)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $flag) { } 5 1004 1009
821 {
822 5 $result = $object->new($object->[1],$object->[2]);
823 5 $result->Copy($object);
824 5 $result->Bit_On($argument);
825 5 return($result);
826 }
827 else
828 {
829 1004 $object->Bit_On($argument);
830 1004 return($object);
831 }
832 }
833 else
834 {
835 20 croak "Set::IntRange $name: wrong argument type";
836 }
837 }
838  
839 sub _difference
840 1645 ▶{
Subroutine _difference: called CC=11 SCAR=24.8
841 1645 my($object,$argument,$flag) = @_;
842 1645 my($name) = "'-'"; #&_trace($name,$object,$argument,$flag);
843 1645 my($result);
844  
845 1645 ▶ if ((defined $argument) && ref($argument) &&
Branch: 2 branches
BranchTrueFalseTotal
if (defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/) { } 7 1638 1645
elsif (defined $argument and not ref $argument) { } 1628 10 1638
Condition83%5/6
defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
!ll&&!rl&&r
1628107
defined $argument and ref $argument
!ll&&!rl&&r
0162817
MC/DC66%2/3
defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
defined $argument ref $argument not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
Truth table75%3/4
A and B and not(C)
A= defined $argumentB= ref $argumentC= not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
ABCresult
0XX0
10X0
1100
1111
846 (ref($argument) !~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/))
847 {
848 7 ▶ if (defined $flag)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $flag) { } 6 1 7
849 {
850 6 $result = $object->new($object->[1],$object->[2]);
851 0 ▶ if ($flag) { $result->Difference($argument,$object); }
Branch: 1 branch
BranchTrueFalseTotal
if ($flag) { } 0 6 6
852 6 else { $result->Difference($object,$argument); }
853 6 return($result);
854 }
855 else
856 {
857 1 $object->Difference($object,$argument);
858 1 return($object);
859 }
860 }
861 ▶ elsif ((defined $argument) && !(ref($argument)))
Condition66%2/3
defined $argument and not ref $argument
!ll&&!rl&&r
0101628
MC/DC50%1/2
defined $argument and not ref $argument
defined $argument not ref $argument
Truth table66%2/3
A and not(B)
A= defined $argumentB= not ref $argument
ABresult
0X0
100
111
862 {
863 1628 ▶ if (defined $flag)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $flag) { } 3 1625 1628
864 {
865 3 $result = $object->new($object->[1],$object->[2]);
866 3 ▶ if ($flag)
Branch: 1 branch
BranchTrueFalseTotal
if ($flag) { } 0 3 3
867 {
868 0 ▶ unless ($object->bit_test($argument))
Branch: 1 branch
BranchTrueFalseTotal
unless ($object->bit_test($argument)) 0 0 0
869 0 { $result->Bit_On($argument); }
870 }
871 else
872 {
873 3 $result->Copy($object);
874 3 $result->Bit_Off($argument);
875 }
876 3 return($result);
877 }
878 else
879 {
880 1625 $object->Bit_Off($argument);
881 1625 return($object);
882 }
883 }
884 else
885 {
886 10 croak "Set::IntRange $name: wrong argument type";
887 }
888 }
889  
890 sub _intersection
891 36 ▶{
Subroutine _intersection: called CC=10 SCAR=23.1
892 36 my($object,$argument,$flag) = @_;
893 36 my($name) = "'*'"; #&_trace($name,$object,$argument,$flag);
894 36 my($result);
895  
896 36 ▶ if ((defined $argument) && ref($argument) &&
Branch: 2 branches
BranchTrueFalseTotal
if (defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/) { } 12 24 36
elsif (defined $argument and not ref $argument) { } 4 20 24
Condition83%5/6
defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
!ll&&!rl&&r
42012
defined $argument and ref $argument
!ll&&!rl&&r
0432
MC/DC66%2/3
defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
defined $argument ref $argument not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
Truth table75%3/4
A and B and not(C)
A= defined $argumentB= ref $argumentC= not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
ABCresult
0XX0
10X0
1100
1111
897 (ref($argument) !~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/))
898 {
899 12 ▶ if (defined $flag)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $flag) { } 10 2 12
900 {
901 10 $result = $object->new($object->[1],$object->[2]);
902 10 $result->Intersection($object,$argument);
903 10 return($result);
904 }
905 else
906 {
907 2 $object->Intersection($object,$argument);
908 2 return($object);
909 }
910 }
911 ▶ elsif ((defined $argument) && !(ref($argument)))
Condition66%2/3
defined $argument and not ref $argument
!ll&&!rl&&r
0204
MC/DC50%1/2
defined $argument and not ref $argument
defined $argument not ref $argument
Truth table66%2/3
A and not(B)
A= defined $argumentB= not ref $argument
ABresult
0X0
100
111
912 {
913 4 ▶ if (defined $flag)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $flag) { } 2 2 4
914 {
915 2 $result = $object->new($object->[1],$object->[2]);
916 2 ▶ if ($object->bit_test($argument))
Branch: 1 branch
BranchTrueFalseTotal
if ($object->bit_test($argument)) 2 0 2
917 2 { $result->Bit_On($argument); }
918 2 return($result);
919 }
920 else
921 {
922 2 $flag = $object->bit_test($argument);
923 2 $object->Empty();
924 2 ▶ if ($flag) { $object->Bit_On($argument); }
Branch: 1 branch
BranchTrueFalseTotal
if ($flag) 2 0 2
925 2 return($object);
926 }
927 }
928 else
929 {
930 20 croak "Set::IntRange $name: wrong argument type";
931 }
932 }
933  
934 sub _exclusive_or
935 19 ▶{
Subroutine _exclusive_or: called CC=8 SCAR=20.8
936 19 my($object,$argument,$flag) = @_;
937 19 my($name) = "'^'"; #&_trace($name,$object,$argument,$flag);
938 19 my($result);
939  
940 19 ▶ if ((defined $argument) && ref($argument) &&
Branch: 2 branches
BranchTrueFalseTotal
if (defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/) { } 3 16 19
elsif (defined $argument and not ref $argument) { } 6 10 16
Condition83%5/6
defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
!ll&&!rl&&r
6103
defined $argument and ref $argument
!ll&&!rl&&r
0613
MC/DC66%2/3
defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
defined $argument ref $argument not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
Truth table75%3/4
A and B and not(C)
A= defined $argumentB= ref $argumentC= not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
ABCresult
0XX0
10X0
1100
1111
941 (ref($argument) !~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/))
942 {
943 3 ▶ if (defined $flag)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $flag) { } 2 1 3
944 {
945 2 $result = $object->new($object->[1],$object->[2]);
946 2 $result->ExclusiveOr($object,$argument);
947 2 return($result);
948 }
949 else
950 {
951 1 $object->ExclusiveOr($object,$argument);
952 1 return($object);
953 }
954 }
955 ▶ elsif ((defined $argument) && !(ref($argument)))
Condition66%2/3
defined $argument and not ref $argument
!ll&&!rl&&r
0106
MC/DC50%1/2
defined $argument and not ref $argument
defined $argument not ref $argument
Truth table66%2/3
A and not(B)
A= defined $argumentB= not ref $argument
ABresult
0X0
100
111
956 {
957 6 ▶ if (defined $flag)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $flag) { } 1 5 6
958 {
959 1 $result = $object->new($object->[1],$object->[2]);
960 1 $result->Copy($object);
961 1 $result->bit_flip($argument);
962 1 return($result);
963 }
964 else
965 {
966 5 $object->bit_flip($argument);
967 5 return($object);
968 }
969 }
970 else
971 {
972 10 croak "Set::IntRange $name: wrong argument type";
973 }
974 }
975  
976 sub _assign_union
977 1006 ▶{
Subroutine _assign_union: called CC=1 SCAR=0.0
978 1006 my($object,$argument,$flag) = @_;
979 # my($name) = "'+='"; #&_trace($name,$object,$argument,$flag);
980  
981 1006 return( &_union($object,$argument,undef) );
982 }
983  
984 sub _assign_difference
985 1626 ▶{
Subroutine _assign_difference: called CC=1 SCAR=0.0
986 1626 my($object,$argument,$flag) = @_;
987 # my($name) = "'-='"; #&_trace($name,$object,$argument,$flag);
988  
989 1626 return( &_difference($object,$argument,undef) );
990 }
991  
992 sub _assign_intersection
993 4 ▶{
Subroutine _assign_intersection: called CC=1 SCAR=0.0
994 4 my($object,$argument,$flag) = @_;
995 # my($name) = "'*='"; #&_trace($name,$object,$argument,$flag);
996  
997 4 return( &_intersection($object,$argument,undef) );
998 }
999  
1000 sub _assign_exclusive_or
1001 6 ▶{
Subroutine _assign_exclusive_or: called CC=1 SCAR=0.0
1002 6 my($object,$argument,$flag) = @_;
1003 # my($name) = "'^='"; #&_trace($name,$object,$argument,$flag);
1004  
1005 6 return( &_exclusive_or($object,$argument,undef) );
1006 }
1007  
1008 sub _equal
1009 52 ▶{
Subroutine _equal: called CC=6 SCAR=18.0
1010 52 my($object,$argument,$flag) = @_;
1011 52 my($name) = "'=='"; #&_trace($name,$object,$argument,$flag);
1012 52 my($result);
1013  
1014 52 ▶ if ((defined $argument) && ref($argument) &&
Branch: 2 branches
BranchTrueFalseTotal
if (defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/) { } 30 22 52
elsif (defined $argument and not ref $argument) { } 12 10 22
Condition83%5/6
defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
!ll&&!rl&&r
121030
defined $argument and ref $argument
!ll&&!rl&&r
01240
MC/DC66%2/3
defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
defined $argument ref $argument not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
Truth table75%3/4
A and B and not(C)
A= defined $argumentB= ref $argumentC= not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
ABCresult
0XX0
10X0
1100
1111
1015 (ref($argument) !~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/))
1016 {
1017 30 $result = $argument;
1018 }
1019 ▶ elsif ((defined $argument) && !(ref($argument)))
Condition66%2/3
defined $argument and not ref $argument
!ll&&!rl&&r
01012
MC/DC50%1/2
defined $argument and not ref $argument
defined $argument not ref $argument
Truth table66%2/3
A and not(B)
A= defined $argumentB= not ref $argument
ABresult
0X0
100
111
1020 {
1021 12 $result = $object->new($object->[1],$object->[2]);
1022 12 $result->Bit_On($argument);
1023 }
1024 else
1025 {
1026 10 croak "Set::IntRange $name: wrong argument type";
1027 }
1028 42 return( $object->equal($result) );
1029 }
1030  
1031 sub _not_equal
1032 13 ▶{
Subroutine _not_equal: called CC=6 SCAR=20.5
1033 13 my($object,$argument,$flag) = @_;
1034 13 my($name) = "'!='"; #&_trace($name,$object,$argument,$flag);
1035 13 my($result);
1036  
1037 13 ▶ if ((defined $argument) && ref($argument) &&
Branch: 2 branches
BranchTrueFalseTotal
if (defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/) { } 3 10 13
elsif (defined $argument and not ref $argument) { } 0 10 10
Condition50%3/6
defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
!ll&&!rl&&r
0103
defined $argument and ref $argument
!ll&&!rl&&r
0013
MC/DC33%1/3
defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
defined $argument ref $argument not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
Truth table50%2/4
A and B and not(C)
A= defined $argumentB= ref $argumentC= not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
ABCresult
0XX0
10X0
1100
1111
1038 (ref($argument) !~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/))
1039 {
1040 3 $result = $argument;
1041 }
1042 ▶ elsif ((defined $argument) && !(ref($argument)))
Condition33%1/3
defined $argument and not ref $argument
!ll&&!rl&&r
0100
MC/DC0%0/2
defined $argument and not ref $argument
defined $argument not ref $argument
Truth table33%1/3
A and not(B)
A= defined $argumentB= not ref $argument
ABresult
0X0
100
111
1043 {
1044 0 $result = $object->new($object->[1],$object->[2]);
1045 0 $result->Bit_On($argument);
1046 }
1047 else
1048 {
1049 10 croak "Set::IntRange $name: wrong argument type";
1050 }
1051 3 return( !($object->equal($result)) );
1052 }
1053  
1054 sub _true_sub_set
1055 16 ▶{
Subroutine _true_sub_set: called CC=10 SCAR=23.5
1056 16 my($object,$argument,$flag) = @_;
1057 16 my($name) = "'<'"; #&_trace($name,$object,$argument,$flag);
1058 16 my($result);
1059  
1060 16 ▶ if ((defined $argument) && ref($argument) &&
Branch: 2 branches
BranchTrueFalseTotal
if (defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/) { } 4 12 16
elsif (defined $argument and not ref $argument) { } 2 10 12
Condition83%5/6
defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
!ll&&!rl&&r
2104
defined $argument and ref $argument
!ll&&!rl&&r
0214
MC/DC66%2/3
defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
defined $argument ref $argument not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
Truth table75%3/4
A and B and not(C)
A= defined $argumentB= ref $argumentC= not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
ABCresult
0XX0
10X0
1100
1111
1061 (ref($argument) !~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/))
1062 {
1063 4 $result = $argument;
1064 }
1065 ▶ elsif ((defined $argument) && !(ref($argument)))
Condition66%2/3
defined $argument and not ref $argument
!ll&&!rl&&r
0102
MC/DC50%1/2
defined $argument and not ref $argument
defined $argument not ref $argument
Truth table66%2/3
A and not(B)
A= defined $argumentB= not ref $argument
ABresult
0X0
100
111
1066 {
1067 2 $result = $object->new($object->[1],$object->[2]);
1068 2 $result->Bit_On($argument);
1069 }
1070 else
1071 {
1072 10 croak "Set::IntRange $name: wrong argument type";
1073 }
1074 6 ▶ if ((defined $flag) && $flag)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $flag and $flag) { } 1 5 6
Condition66%2/3
defined $flag and $flag
!ll&&!rl&&r
051
MC/DC50%1/2
defined $flag and $flag
defined $flag $flag
Truth table66%2/3
A and B
A= defined $flagB= $flag
ABresult
0X0
100
111
1075 {
1076 1 ▶ return( !($result->equal($object)) &&
Condition33%1/3
!$result->equal($object) && $result->subset($object)
!ll&&!rl&&r
001
MC/DC0%0/2
!$result->equal($object) && $result->subset($object)
!$result->equal($object) $result->subset($object)
Truth table33%1/3
not(A) && B
A= !$result->equal($object)B= $result->subset($object)
ABresult
0X0
100
111
1077 ($result->subset($object)) );
1078 }
1079 else
1080 {
1081 5 ▶ return( !($object->equal($result)) &&
Condition66%2/3
!$object->equal($result) && $object->subset($result)
!ll&&!rl&&r
032
MC/DC50%1/2
!$object->equal($result) && $object->subset($result)
!$object->equal($result) $object->subset($result)
Truth table66%2/3
not(A) && B
A= !$object->equal($result)B= $object->subset($result)
ABresult
0X0
100
111
1082 ($object->subset($result)) );
1083 }
1084 }
1085  
1086 sub _sub_set
1087 16 ▶{
Subroutine _sub_set: called CC=8 SCAR=20.9
1088 16 my($object,$argument,$flag) = @_;
1089 16 my($name) = "'<='"; #&_trace($name,$object,$argument,$flag);
1090 16 my($result);
1091  
1092 16 ▶ if ((defined $argument) && ref($argument) &&
Branch: 2 branches
BranchTrueFalseTotal
if (defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/) { } 4 12 16
elsif (defined $argument and not ref $argument) { } 2 10 12
Condition83%5/6
defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
!ll&&!rl&&r
2104
defined $argument and ref $argument
!ll&&!rl&&r
0214
MC/DC66%2/3
defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
defined $argument ref $argument not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
Truth table75%3/4
A and B and not(C)
A= defined $argumentB= ref $argumentC= not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
ABCresult
0XX0
10X0
1100
1111
1093 (ref($argument) !~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/))
1094 {
1095 4 $result = $argument;
1096 }
1097 ▶ elsif ((defined $argument) && !(ref($argument)))
Condition66%2/3
defined $argument and not ref $argument
!ll&&!rl&&r
0102
MC/DC50%1/2
defined $argument and not ref $argument
defined $argument not ref $argument
Truth table66%2/3
A and not(B)
A= defined $argumentB= not ref $argument
ABresult
0X0
100
111
1098 {
1099 2 $result = $object->new($object->[1],$object->[2]);
1100 2 $result->Bit_On($argument);
1101 }
1102 else
1103 {
1104 10 croak "Set::IntRange $name: wrong argument type";
1105 }
1106 6 ▶ if ((defined $flag) && $flag)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $flag and $flag) { } 1 5 6
Condition66%2/3
defined $flag and $flag
!ll&&!rl&&r
051
MC/DC50%1/2
defined $flag and $flag
defined $flag $flag
Truth table66%2/3
A and B
A= defined $flagB= $flag
ABresult
0X0
100
111
1107 {
1108 1 return( $result->subset($object) );
1109 }
1110 else
1111 {
1112 5 return( $object->subset($result) );
1113 }
1114 }
1115  
1116 sub _true_super_set
1117 16 ▶{
Subroutine _true_super_set: called CC=10 SCAR=23.5
1118 16 my($object,$argument,$flag) = @_;
1119 16 my($name) = "'>'"; #&_trace($name,$object,$argument,$flag);
1120 16 my($result);
1121  
1122 16 ▶ if ((defined $argument) && ref($argument) &&
Branch: 2 branches
BranchTrueFalseTotal
if (defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/) { } 4 12 16
elsif (defined $argument and not ref $argument) { } 2 10 12
Condition83%5/6
defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
!ll&&!rl&&r
2104
defined $argument and ref $argument
!ll&&!rl&&r
0214
MC/DC66%2/3
defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
defined $argument ref $argument not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
Truth table75%3/4
A and B and not(C)
A= defined $argumentB= ref $argumentC= not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
ABCresult
0XX0
10X0
1100
1111
1123 (ref($argument) !~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/))
1124 {
1125 4 $result = $argument;
1126 }
1127 ▶ elsif ((defined $argument) && !(ref($argument)))
Condition66%2/3
defined $argument and not ref $argument
!ll&&!rl&&r
0102
MC/DC50%1/2
defined $argument and not ref $argument
defined $argument not ref $argument
Truth table66%2/3
A and not(B)
A= defined $argumentB= not ref $argument
ABresult
0X0
100
111
1128 {
1129 2 $result = $object->new($object->[1],$object->[2]);
1130 2 $result->Bit_On($argument);
1131 }
1132 else
1133 {
1134 10 croak "Set::IntRange $name: wrong argument type";
1135 }
1136 6 ▶ if ((defined $flag) && $flag)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $flag and $flag) { } 1 5 6
Condition66%2/3
defined $flag and $flag
!ll&&!rl&&r
051
MC/DC50%1/2
defined $flag and $flag
defined $flag $flag
Truth table66%2/3
A and B
A= defined $flagB= $flag
ABresult
0X0
100
111
1137 {
1138 1 ▶ return( !($object->equal($result)) &&
Condition33%1/3
!$object->equal($result) && $object->subset($result)
!ll&&!rl&&r
010
MC/DC0%0/2
!$object->equal($result) && $object->subset($result)
!$object->equal($result) $object->subset($result)
Truth table33%1/3
not(A) && B
A= !$object->equal($result)B= $object->subset($result)
ABresult
0X0
100
111
1139 ($object->subset($result)) );
1140 }
1141 else
1142 {
1143 5 ▶ return( !($result->equal($object)) &&
Condition66%2/3
!$result->equal($object) && $result->subset($object)
!ll&&!rl&&r
023
MC/DC50%1/2
!$result->equal($object) && $result->subset($object)
!$result->equal($object) $result->subset($object)
Truth table66%2/3
not(A) && B
A= !$result->equal($object)B= $result->subset($object)
ABresult
0X0
100
111
1144 ($result->subset($object)) );
1145 }
1146 }
1147  
1148 sub _super_set
1149 16 ▶{
Subroutine _super_set: called CC=8 SCAR=20.9
1150 16 my($object,$argument,$flag) = @_;
1151 16 my($name) = "'>='"; #&_trace($name,$object,$argument,$flag);
1152 16 my($result);
1153  
1154 16 ▶ if ((defined $argument) && ref($argument) &&
Branch: 2 branches
BranchTrueFalseTotal
if (defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/) { } 4 12 16
elsif (defined $argument and not ref $argument) { } 2 10 12
Condition83%5/6
defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
!ll&&!rl&&r
2104
defined $argument and ref $argument
!ll&&!rl&&r
0214
MC/DC66%2/3
defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
defined $argument ref $argument not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
Truth table75%3/4
A and B and not(C)
A= defined $argumentB= ref $argumentC= not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
ABCresult
0XX0
10X0
1100
1111
1155 (ref($argument) !~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/))
1156 {
1157 4 $result = $argument;
1158 }
1159 ▶ elsif ((defined $argument) && !(ref($argument)))
Condition66%2/3
defined $argument and not ref $argument
!ll&&!rl&&r
0102
MC/DC50%1/2
defined $argument and not ref $argument
defined $argument not ref $argument
Truth table66%2/3
A and not(B)
A= defined $argumentB= not ref $argument
ABresult
0X0
100
111
1160 {
1161 2 $result = $object->new($object->[1],$object->[2]);
1162 2 $result->Bit_On($argument);
1163 }
1164 else
1165 {
1166 10 croak "Set::IntRange $name: wrong argument type";
1167 }
1168 6 ▶ if ((defined $flag) && $flag)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $flag and $flag) { } 1 5 6
Condition66%2/3
defined $flag and $flag
!ll&&!rl&&r
051
MC/DC50%1/2
defined $flag and $flag
defined $flag $flag
Truth table66%2/3
A and B
A= defined $flagB= $flag
ABresult
0X0
100
111
1169 {
1170 1 return( $object->subset($result) );
1171 }
1172 else
1173 {
1174 5 return( $result->subset($object) );
1175 }
1176 }
1177  
1178 sub _compare
1179 91 ▶{
Subroutine _compare: called CC=8 SCAR=20.9
1180 91 my($object,$argument,$flag) = @_;
1181 91 my($name) = "cmp"; #&_trace($name,$object,$argument,$flag);
1182 91 my($result);
1183  
1184 91 ▶ if ((defined $argument) && ref($argument) &&
Branch: 2 branches
BranchTrueFalseTotal
if (defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/) { } 19 72 91
elsif (defined $argument and not ref $argument) { } 2 70 72
Condition83%5/6
defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
!ll&&!rl&&r
27019
defined $argument and ref $argument
!ll&&!rl&&r
0289
MC/DC66%2/3
defined $argument and ref $argument and not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
defined $argument ref $argument not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
Truth table75%3/4
A and B and not(C)
A= defined $argumentB= ref $argumentC= not ref($argument) =~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/
ABCresult
0XX0
10X0
1100
1111
1185 (ref($argument) !~ /^SCALAR$|^ARRAY$|^HASH$|^CODE$|^REF$/))
1186 {
1187 19 $result = $argument;
1188 }
1189 ▶ elsif ((defined $argument) && !(ref($argument)))
Condition66%2/3
defined $argument and not ref $argument
!ll&&!rl&&r
0702
MC/DC50%1/2
defined $argument and not ref $argument
defined $argument not ref $argument
Truth table66%2/3
A and not(B)
A= defined $argumentB= not ref $argument
ABresult
0X0
100
111
1190 {
1191 2 $result = $object->new($object->[1],$object->[2]);
1192 2 $result->Bit_On($argument);
1193 }
1194 else
1195 {
1196 70 croak "Set::IntRange $name: wrong argument type";
1197 }
1198 21 ▶ if ((defined $flag) && $flag)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $flag and $flag) { } 1 20 21
Condition66%2/3
defined $flag and $flag
!ll&&!rl&&r
0201
MC/DC50%1/2
defined $flag and $flag
defined $flag $flag
Truth table66%2/3
A and B
A= defined $flagB= $flag
ABresult
0X0
100
111
1199 {
1200 1 return( $result->Compare($object) );
1201 }
1202 else
1203 {
1204 20 return( $object->Compare($result) );
1205 }
1206 }
1207  
1208 sub _clone
1209 1 ▶{
Subroutine _clone: called CC=1 SCAR=0.0
1210 1 my($object,$argument,$flag) = @_;
1211 # my($name) = "'='"; #&_trace($name,$object,$argument,$flag);
1212 1 my($result);
1213  
1214 1 $result = $object->new($object->[1],$object->[2]);
1215 1 $result->Copy($object);
1216 1 return($result);
1217 }
1218  
1219 sub _trace
1220 0 ▶{
Subroutine _trace: not called CC=6 SCAR=37.4
1221 0 my($text,$object,$argument,$flag) = @_;
1222  
1223 0 ▶ unless (defined $object) { $object = 'undef'; };
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $object) 0 0 0
1224 0 ▶ unless (defined $argument) { $argument = 'undef'; };
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $argument) 0 0 0
1225 0 ▶ unless (defined $flag) { $flag = 'undef'; };
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $flag) 0 0 0
1226 0 ▶ if (ref($object)) { $object = ref($object); }
Branch: 1 branch
BranchTrueFalseTotal
if (ref $object) 0 0 0
1227 0 ▶ if (ref($argument)) { $argument = ref($argument); }
Branch: 1 branch
BranchTrueFalseTotal
if (ref $argument) 0 0 0
1228 0 print "$text: \$obj='$object' \$arg='$argument' \$flag='$flag'\n";
1229 }
1230  
1231 8 1;
1232  
1233 __END__
↑ Summary