line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OPTIMADE::Filter::Negation; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
34
|
use strict; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
142
|
|
4
|
5
|
|
|
5
|
|
24
|
use warnings; |
|
5
|
|
|
|
|
19
|
|
|
5
|
|
|
|
|
129
|
|
5
|
|
|
|
|
|
|
|
6
|
5
|
|
|
5
|
|
23
|
use parent 'OPTIMADE::Filter::Modifiable'; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
21
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
21
|
|
|
21
|
0
|
73
|
my( $class, $inner ) = @_; |
10
|
21
|
|
|
|
|
75
|
return bless { inner => $inner }, $class; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub inner |
14
|
|
|
|
|
|
|
{ |
15
|
60
|
|
|
60
|
0
|
101
|
my( $self, $inner ) = @_; |
16
|
60
|
|
|
|
|
85
|
my $previous_inner = $self->{inner}; |
17
|
60
|
50
|
|
|
|
119
|
$self->{inner} = $inner if defined $inner; |
18
|
60
|
|
|
|
|
152
|
return $previous_inner; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub to_filter |
22
|
|
|
|
|
|
|
{ |
23
|
20
|
|
|
20
|
0
|
1938
|
my( $self ) = @_; |
24
|
20
|
|
|
|
|
56
|
$self->validate; |
25
|
20
|
|
|
|
|
44
|
return '(NOT ' . $self->inner->to_filter . ')'; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub to_SQL |
29
|
|
|
|
|
|
|
{ |
30
|
10
|
|
|
10
|
0
|
42
|
my( $self, $options ) = @_; |
31
|
10
|
|
|
|
|
27
|
$self->validate; |
32
|
|
|
|
|
|
|
|
33
|
10
|
|
|
|
|
23
|
my( $sql, $values ) = $self->inner->to_SQL( $options ); |
34
|
10
|
100
|
|
|
|
25
|
if( wantarray ) { |
35
|
8
|
|
|
|
|
32
|
return ( "(NOT $sql)", $values ); |
36
|
|
|
|
|
|
|
} else { |
37
|
2
|
|
|
|
|
11
|
return "(NOT $sql)"; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub modify |
42
|
|
|
|
|
|
|
{ |
43
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
44
|
0
|
|
|
|
|
0
|
my $code = shift; |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
0
|
$self->inner( $self->inner->modify( $code, @_ ) ); |
47
|
0
|
|
|
|
|
0
|
return $code->( $self, @_ ); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub validate |
51
|
|
|
|
|
|
|
{ |
52
|
30
|
|
|
30
|
0
|
51
|
my $self = shift; |
53
|
30
|
50
|
|
|
|
56
|
die 'inner undefined for OPTIMADE::Filter::Negation' if !$self->inner; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |