| 1 | package Dallycot::AST::Any; | ||||||||||
| 2 | 29 | our $AUTHORITY = 'cpan:JSMITH'; | |||||||||
| 3 | |||||||||||
| 4 | # ABSTRACT: Return true iff any expression evaluates 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 simplify { | ||||||||||
| 13 | 0 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
simplify: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 14 | |||||||||||
| 15 | 0 | return bless [ map { $_->simplify } @$self ] => __PACKAGE__; | |||||||||
| 16 | } | ||||||||||
| 17 | |||||||||||
| 18 | sub to_rdf { | ||||||||||
| 19 | 0 | ▶ | my($self, $model) = @_; | ||||||||
|
Subroutine
to_rdf: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 20 | |||||||||||
| 21 | # | ||||||||||
| 22 | # node -> expression_set -> [ ... ] | ||||||||||
| 23 | # | ||||||||||
| 24 | 0 | return $model -> apply( | |||||||||
| 25 | $model -> meta_uri('loc:any-true'), | ||||||||||
| 26 | [ @$self ], | ||||||||||
| 27 | {} | ||||||||||
| 28 | ); | ||||||||||
| 29 | # my $bnode = $model->bnode(); | ||||||||||
| 30 | # | ||||||||||
| 31 | # $model -> add_type($bnode, 'loc:AnyTrue'); | ||||||||||
| 32 | # | ||||||||||
| 33 | # foreach my $expr (@$self) { | ||||||||||
| 34 | # $model -> add_expression($bnode, $expr); | ||||||||||
| 35 | # } | ||||||||||
| 36 | # return $bnode; | ||||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | sub process_loop { | ||||||||||
| 40 | 0 | ▶ | my ( $self, $engine, $d, @expressions ) = @_; | ||||||||
|
Subroutine
process_loop: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 41 | |||||||||||
| 42 | 0 | ▶ | if ( !@expressions ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | 0 | $d->resolve( $engine->FALSE ); | |||||||||
| 44 | } | ||||||||||
| 45 | else { | ||||||||||
| 46 | $engine->execute( shift @expressions, ['Boolean'] )->done( | ||||||||||
| 47 | sub { | ||||||||||
| 48 | 0 | ▶ | if ( $_[0]->value ) { | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||
| 49 | 0 | $d->resolve( $engine->TRUE ); | |||||||||
| 50 | } | ||||||||||
| 51 | else { | ||||||||||
| 52 | 0 | $self->process_loop( $engine, $d, @expressions ); | |||||||||
| 53 | } | ||||||||||
| 54 | }, | ||||||||||
| 55 | sub { | ||||||||||
| 56 | 0 | ▶ | $d->reject(@_); | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 57 | } | ||||||||||
| 58 | 0 | ); | |||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | 0 | return; | |||||||||
| 62 | } | ||||||||||
| 63 | |||||||||||
| 64 | 29 | 1; | |||||||||