line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OPTIMADE::Filter::Negation; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
68
|
use strict; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
147
|
|
4
|
5
|
|
|
5
|
|
25
|
use warnings; |
|
5
|
|
|
|
|
17
|
|
|
5
|
|
|
|
|
130
|
|
5
|
|
|
|
|
|
|
|
6
|
5
|
|
|
5
|
|
25
|
use parent 'OPTIMADE::Filter::Modifiable'; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
20
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
21
|
|
|
21
|
0
|
48
|
my( $class, $inner ) = @_; |
10
|
21
|
|
|
|
|
71
|
return bless { inner => $inner }, $class; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub inner |
14
|
|
|
|
|
|
|
{ |
15
|
60
|
|
|
60
|
0
|
104
|
my( $self, $inner ) = @_; |
16
|
60
|
|
|
|
|
102
|
my $previous_inner = $self->{inner}; |
17
|
60
|
50
|
|
|
|
120
|
$self->{inner} = $inner if defined $inner; |
18
|
60
|
|
|
|
|
155
|
return $previous_inner; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub to_filter |
22
|
|
|
|
|
|
|
{ |
23
|
20
|
|
|
20
|
0
|
1888
|
my( $self ) = @_; |
24
|
20
|
|
|
|
|
51
|
$self->validate; |
25
|
20
|
|
|
|
|
45
|
return '(NOT ' . $self->inner->to_filter . ')'; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub to_SQL |
29
|
|
|
|
|
|
|
{ |
30
|
10
|
|
|
10
|
0
|
43
|
my( $self, $options ) = @_; |
31
|
10
|
|
|
|
|
26
|
$self->validate; |
32
|
|
|
|
|
|
|
|
33
|
10
|
|
|
|
|
23
|
my( $sql, $values ) = $self->inner->to_SQL( $options ); |
34
|
10
|
100
|
|
|
|
27
|
if( wantarray ) { |
35
|
8
|
|
|
|
|
31
|
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
|
48
|
my $self = shift; |
53
|
30
|
50
|
|
|
|
59
|
die 'inner undefined for OPTIMADE::Filter::Negation' if !$self->inner; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |