line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package UR::BoolExpr::Template::PropertyComparison::NotIn; |
3
|
|
|
|
|
|
|
|
4
|
6
|
|
|
6
|
|
318
|
use strict; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
177
|
|
5
|
6
|
|
|
6
|
|
20
|
use warnings; |
|
6
|
|
|
|
|
6
|
|
|
6
|
|
|
|
|
154
|
|
6
|
6
|
|
|
6
|
|
23
|
use UR; |
|
6
|
|
|
|
|
6
|
|
|
6
|
|
|
|
|
37
|
|
7
|
|
|
|
|
|
|
our $VERSION = "0.46"; # UR $VERSION; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
UR::Object::Type->define( |
10
|
|
|
|
|
|
|
class_name => __PACKAGE__, |
11
|
|
|
|
|
|
|
is => ['UR::BoolExpr::Template::PropertyComparison'], |
12
|
|
|
|
|
|
|
doc => "Returns false if any of the property's values appears in the comparison value list", |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub _compare { |
16
|
56
|
|
|
56
|
|
107
|
my ($class,$comparison_values,@property_values) = @_; |
17
|
|
|
|
|
|
|
|
18
|
56
|
50
|
33
|
|
|
124
|
if (@property_values == 1 and ref($property_values[0]) eq 'ARRAY') { |
19
|
0
|
|
|
|
|
0
|
@property_values = @{$property_values[0]}; |
|
0
|
|
|
|
|
0
|
|
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# undef should match missing values, which will be sorted at the end - the sorter in |
23
|
|
|
|
|
|
|
# UR::BoolExpr::resolve() takes care of the sorting for us |
24
|
56
|
50
|
66
|
|
|
128
|
if (! @property_values and !defined($comparison_values->[-1])) { |
25
|
0
|
|
|
|
|
0
|
return ''; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
56
|
|
|
|
|
58
|
my($pv_idx, $cv_idx); |
29
|
6
|
|
|
6
|
|
23
|
no warnings; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
398
|
|
30
|
56
|
|
|
277
|
|
191
|
my $sorter = sub { return $property_values[$pv_idx] cmp $comparison_values->[$cv_idx] }; |
|
277
|
|
|
|
|
229
|
|
31
|
6
|
|
|
6
|
|
23
|
use warnings; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
681
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# Binary search within @$comparison_values |
34
|
56
|
|
|
|
|
47
|
my $cv_min = 0; |
35
|
56
|
|
|
|
|
55
|
my $cv_max = $#$comparison_values; |
36
|
56
|
|
|
|
|
113
|
for ( $pv_idx = 0; $pv_idx < @property_values; $pv_idx++ ) { |
37
|
248
|
|
|
|
|
144
|
do { |
38
|
277
|
|
|
|
|
191
|
$cv_idx = ($cv_min + $cv_max) >> 1; |
39
|
277
|
|
|
|
|
221
|
my $result = &$sorter; |
40
|
277
|
100
|
|
|
|
367
|
if (!$result) { |
|
|
100
|
|
|
|
|
|
41
|
8
|
|
|
|
|
46
|
return ''; |
42
|
|
|
|
|
|
|
} elsif ($result > 0) { |
43
|
227
|
|
|
|
|
413
|
$cv_min = $cv_idx + 1; |
44
|
|
|
|
|
|
|
} else { |
45
|
42
|
|
|
|
|
92
|
$cv_max = $cv_idx - 1; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} until ($cv_min > $cv_max); |
48
|
|
|
|
|
|
|
} |
49
|
48
|
|
|
|
|
301
|
return 1; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=pod |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 NAME |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
UR::BoolExpr::Template::PropertyComparison::NotIn - perform a negated In comparison |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 DESCRIPTION |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Returns false if any of the property's values appears in the comparison value list |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=cut |