| 1 | package Dallycot::AST::All; | ||||||||||||||||||||
| 2 | 29 | our $AUTHORITY = 'cpan:JSMITH'; | |||||||||||||||||||
| 3 | |||||||||||||||||||||
| 4 | # ABSTRACT: Return true iff all expressions evaluate true | ||||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | 29 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | 29 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 29 | ▶ | use utf8; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | 29 | ▶ | use parent 'Dallycot::AST::LoopBase'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | sub new { | ||||||||||||||||||||
| 13 | 0 | ▶ | my ( $class, @exprs ) = @_; | ||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 0 | ▶ | $class = ref $class || $class; | ||||||||||||||||||
|
Condition0%0/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table0%0/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||
| 16 | 0 | return bless \@exprs => $class; | |||||||||||||||||||
| 17 | } | ||||||||||||||||||||
| 18 | |||||||||||||||||||||
| 19 | sub to_rdf { | ||||||||||||||||||||
| 20 | 0 | ▶ | my($self, $model) = @_; | ||||||||||||||||||
|
Subroutine
to_rdf: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 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 | ▶ | my ($self) = @_; | ||||||||||||||||||
|
Subroutine
simplify: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | 0 | return bless [ map { $_->simplify } @$self ] => __PACKAGE__; | |||||||||||||||||||
| 36 | } | ||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | sub process_loop { | ||||||||||||||||||||
| 39 | 10 | ▶ | my ( $self, $engine, $d, @expressions ) = @_; | ||||||||||||||||||
|
Subroutine
process_loop: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | 10 | ▶ | if ( !@expressions ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 42 | 3 | $d->resolve( $engine->TRUE ); | |||||||||||||||||||
| 43 | } | ||||||||||||||||||||
| 44 | else { | ||||||||||||||||||||
| 45 | $engine->execute( shift @expressions, ['Boolean'] )->done( | ||||||||||||||||||||
| 46 | sub { | ||||||||||||||||||||
| 47 | 7 | ▶ | if ( $_[0]->value ) { | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||
| 48 | 6 | $self->process_loop( $engine, $d, @expressions ); | |||||||||||||||||||
| 49 | } | ||||||||||||||||||||
| 50 | else { | ||||||||||||||||||||
| 51 | 1 | $d->resolve( $engine->FALSE ); | |||||||||||||||||||
| 52 | } | ||||||||||||||||||||
| 53 | }, | ||||||||||||||||||||
| 54 | sub { | ||||||||||||||||||||
| 55 | 0 | ▶ | $d->reject(@_); | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 56 | } | ||||||||||||||||||||
| 57 | 7 | ); | |||||||||||||||||||
| 58 | } | ||||||||||||||||||||
| 59 | |||||||||||||||||||||
| 60 | 10 | return; | |||||||||||||||||||
| 61 | } | ||||||||||||||||||||
| 62 | |||||||||||||||||||||
| 63 | 29 | 1; | |||||||||||||||||||