| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
=head1 NAME |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
Bio::Polloc::GroupCriteria::operator::bool - A boolean operator |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 AUTHOR - Luis M. Rodriguez-R |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Email lmrodriguezr at gmail dot com |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=cut |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
package Bio::Polloc::GroupCriteria::operator::bool; |
|
12
|
3
|
|
|
3
|
|
17
|
use base qw(Bio::Polloc::GroupCriteria::operator); |
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
277
|
|
|
13
|
3
|
|
|
3
|
|
26
|
use strict; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
1615
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = 1.0503; # [a-version] from Bio::Polloc::Polloc::Version |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 APPENDIX |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Methods provided by the package |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head2 new |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Generic initialization method. |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head3 Arguments |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
See L<Bio::Polloc::GroupCriteria::operator->new()> |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head3 Returns |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
A L<Bio::Polloc::GroupCriteria::operator::bool> object. |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub new { |
|
36
|
0
|
|
|
0
|
1
|
0
|
my($caller,@args) = @_; |
|
37
|
0
|
|
|
|
|
0
|
my $self = $caller->SUPER::new(@args); |
|
38
|
0
|
|
|
|
|
0
|
$self->_initialize(@args); |
|
39
|
0
|
|
|
|
|
0
|
return $self; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 operate |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head3 Returns |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
A boolean value. |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub operate { |
|
51
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
52
|
0
|
0
|
|
|
|
0
|
return $self->val if defined $self->val; |
|
53
|
0
|
0
|
0
|
|
|
0
|
$self->throw('Bad operators', $self->operators) |
|
54
|
|
|
|
|
|
|
unless ref($self->operators) and ref($self->operators)=~/ARRAY/; |
|
55
|
0
|
|
|
|
|
0
|
my $o1 = $self->operators->[0]->operate; |
|
56
|
0
|
0
|
|
|
|
0
|
$self->throw("Undefined first operator", $self->operators) unless defined $o1; |
|
57
|
0
|
0
|
|
|
|
0
|
return (not $o1) if $self->operation =~ /^\s*(?:\!|not)\s*$/i; |
|
58
|
0
|
|
|
|
|
0
|
my $o2 = $self->operators->[1]->operate; |
|
59
|
0
|
0
|
|
|
|
0
|
$self->throw("Undefined second operator") unless defined $o2; |
|
60
|
0
|
0
|
|
|
|
0
|
return ($o1 > $o2) if $self->operation =~ /^\s*(?:>|gt)\s*$/i; |
|
61
|
0
|
0
|
|
|
|
0
|
return ($o1 < $o2) if $self->operation =~ /^\s*(?:<|lt)\s*$/i; |
|
62
|
0
|
0
|
|
|
|
0
|
return ($o1 >= $o2) if $self->operation =~ /^\s*(?:>=|ge)\s*$/i; |
|
63
|
0
|
0
|
|
|
|
0
|
return ($o1 <= $o2) if $self->operation =~ /^\s*(?:<=|le)\s*$/i; |
|
64
|
0
|
0
|
0
|
|
|
0
|
return ($o1 and $o2) if $self->operation =~ /^\s*(?:&&?|and)\s*$/i; |
|
65
|
0
|
0
|
0
|
|
|
0
|
return ($o1 or $o2) if $self->operation =~ /^\s*(?:\|\|?|or)\s*$/i; |
|
66
|
0
|
0
|
0
|
|
|
0
|
return ($o1 xor $o2) if $self->operation =~ /^\s*(?:\^|xor)\s*$/i; |
|
67
|
0
|
|
|
|
|
0
|
$self->throw("Unknown boolean operation", $self->operation); |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 INTERNAL METHODS |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Methods intended to be used only within the scope of Bio::Polloc::* |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head2 _initialize |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=cut |
|
77
|
|
|
|
|
|
|
|
|
78
|
42
|
|
|
42
|
|
74
|
sub _initialize { } |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |