line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dallycot::AST::All; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:JSMITH'; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
# ABSTRACT: Return true iff all expressions evaluate true |
5
|
|
|
|
|
|
|
|
6
|
23
|
|
|
23
|
|
12036
|
use strict; |
|
23
|
|
|
|
|
42
|
|
|
23
|
|
|
|
|
707
|
|
7
|
23
|
|
|
23
|
|
91
|
use warnings; |
|
23
|
|
|
|
|
28
|
|
|
23
|
|
|
|
|
465
|
|
8
|
|
|
|
|
|
|
|
9
|
23
|
|
|
23
|
|
85
|
use utf8; |
|
23
|
|
|
|
|
33
|
|
|
23
|
|
|
|
|
101
|
|
10
|
23
|
|
|
23
|
|
403
|
use parent 'Dallycot::AST::LoopBase'; |
|
23
|
|
|
|
|
33
|
|
|
23
|
|
|
|
|
100
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
0
|
|
|
0
|
0
|
|
my ( $class, @exprs ) = @_; |
14
|
|
|
|
|
|
|
|
15
|
0
|
|
0
|
|
|
|
$class = ref $class || $class; |
16
|
0
|
|
|
|
|
|
return bless \@exprs => $class; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub to_rdf { |
20
|
0
|
|
|
0
|
0
|
|
my($self, $model) = @_; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# |
23
|
|
|
|
|
|
|
# node -> expression_set -> [ ... ] |
24
|
|
|
|
|
|
|
# |
25
|
0
|
|
|
|
|
|
return $model -> apply( |
26
|
|
|
|
|
|
|
$model -> meta_uri('loc:all-true'), |
27
|
|
|
|
|
|
|
[ @$self ], |
28
|
|
|
|
|
|
|
{} |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub simplify { |
33
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
return bless [ map { $_->simplify } @$self ] => __PACKAGE__; |
|
0
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub process_loop { |
39
|
0
|
|
|
0
|
0
|
|
my ( $self, $engine, $d, @expressions ) = @_; |
40
|
|
|
|
|
|
|
|
41
|
0
|
0
|
|
|
|
|
if ( !@expressions ) { |
42
|
0
|
|
|
|
|
|
$d->resolve( $engine->TRUE ); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
else { |
45
|
|
|
|
|
|
|
$engine->execute( shift @expressions, ['Boolean'] )->done( |
46
|
|
|
|
|
|
|
sub { |
47
|
0
|
0
|
|
0
|
|
|
if ( $_[0]->value ) { |
48
|
0
|
|
|
|
|
|
$self->process_loop( $engine, $d, @expressions ); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
else { |
51
|
0
|
|
|
|
|
|
$d->resolve( $engine->FALSE ); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
}, |
54
|
|
|
|
|
|
|
sub { |
55
|
0
|
|
|
0
|
|
|
$d->reject(@_); |
56
|
|
|
|
|
|
|
} |
57
|
0
|
|
|
|
|
|
); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
return; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |