line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OPTiMaDe::Filter::Known; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
31
|
use strict; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
132
|
|
4
|
5
|
|
|
5
|
|
22
|
use warnings; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
1887
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub new { |
7
|
4
|
|
|
4
|
0
|
10
|
my( $class, $is_known, $property ) = @_; |
8
|
4
|
|
|
|
|
14
|
return bless { is_known => $is_known, property => $property }, $class; |
9
|
|
|
|
|
|
|
} |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub is_known |
12
|
|
|
|
|
|
|
{ |
13
|
6
|
|
|
6
|
0
|
10
|
my( $self, $is_known ) = @_; |
14
|
6
|
|
|
|
|
8
|
my $previous_is_known = $self->{is_known}; |
15
|
6
|
50
|
|
|
|
12
|
$self->{is_known} = $is_known if defined $is_known; |
16
|
6
|
|
|
|
|
18
|
return $previous_is_known; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub property |
20
|
|
|
|
|
|
|
{ |
21
|
16
|
|
|
16
|
0
|
25
|
my( $self, $property ) = @_; |
22
|
16
|
|
|
|
|
27
|
my $previous_property = $self->{property}; |
23
|
16
|
100
|
|
|
|
23
|
$self->{property} = $property if defined $property; |
24
|
16
|
|
|
|
|
40
|
return $previous_property; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub to_filter |
28
|
|
|
|
|
|
|
{ |
29
|
4
|
|
|
4
|
0
|
6
|
my( $self ) = @_; |
30
|
4
|
|
|
|
|
11
|
$self->validate; |
31
|
4
|
100
|
|
|
|
6
|
return $self->property->to_filter . ' IS ' . |
32
|
|
|
|
|
|
|
($self->is_known ? 'KNOWN' : 'UNKNOWN'); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub to_SQL |
36
|
|
|
|
|
|
|
{ |
37
|
2
|
|
|
2
|
0
|
5
|
my( $self, $options ) = @_; |
38
|
2
|
|
|
|
|
5
|
$self->validate; |
39
|
|
|
|
|
|
|
|
40
|
2
|
|
|
|
|
3
|
my( $sql, $values ) = $self->property->to_SQL( $options ); |
41
|
2
|
100
|
|
|
|
6
|
$sql = "$sql IS " . ($self->is_known ? 'NOT NULL' : 'NULL'); |
42
|
2
|
50
|
|
|
|
5
|
if( wantarray ) { |
43
|
2
|
|
|
|
|
6
|
return ( $sql, $values ); |
44
|
|
|
|
|
|
|
} else { |
45
|
0
|
|
|
|
|
0
|
return $sql; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub modify |
50
|
|
|
|
|
|
|
{ |
51
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
52
|
0
|
|
|
|
|
0
|
my $code = shift; |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
0
|
$self->property( OPTiMaDe::Filter::modify( $self->property, $code, @_ ) ); |
55
|
0
|
|
|
|
|
0
|
return $code->( $self, @_ ); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub validate |
59
|
|
|
|
|
|
|
{ |
60
|
6
|
|
|
6
|
0
|
8
|
my $self = shift; |
61
|
6
|
50
|
|
|
|
9
|
die 'property undefined for OPTiMaDe::Filter::Known' if !$self->property; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |