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