blib/lib/Logic/Relational/Goal/Any.pm

filter: Statementstmt 81.4% 22 / 27 Branchbran 25.0% 1 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 6 / 8 Podpod 60.0% 3 / 5 totaltotal 72.7% 32 / 44 CC 5 SCAR 14.7
CC
5
Cov
74%
is_ground
12.0
expand
3.0
goals
2.0
CRAP 4.3
« blib/lib/Logic/Relational/Goal/Guard.pm ↑ Summary blib/lib/Logic/Relational/Goal/All.pm »
1 package Logic::Relational::Goal::Any;
2  
3 31 ▶use v5.38;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 31 ▶use experimental 'signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 31 ▶use parent 'Logic::Relational::Goal';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 =head1 NAME
8  
9 Logic::Relational::Goal::Any - Disjunction of goals (OR).
10  
11 =cut
12  
13 5 ▶sub new ( $class, $goals ) {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
14 5 return bless { goals => $goals }, $class;
15 }
16  
17 0 ▶sub goals ($self) { return $self->{goals}; }
Subroutine goals: not called CC=1 SCAR=6.9
Pod undocumented
18  
19 3 ▶sub expand ( $self, %args ) {
Subroutine expand: called CC=3 SCAR=11.0
Pod documented
20 3 my $state = $args{state};
21 3 my $remaining = $args{remaining};
22 3 my @successors;
23 3 for my $goal ( @{ $self->{goals} } ) {
24 7 my $succ = $state->derive( goals => [ $goal, @$remaining ], );
25 7 ▶ push @successors, $succ if $succ;
Branch: 1 branch
BranchTrueFalseTotal
if $succ 7 0 7
26 }
27 3 return @successors;
28 }
29  
30 2 ▶sub freshen ( $self, $var_map ) {
Subroutine freshen: called CC=1 SCAR=0.0
Pod documented
31 2 my @fresh_goals = map { $_->freshen($var_map) } @{ $self->{goals} };
32 2 return ref($self)->new( \@fresh_goals );
33 }
34  
35 0 ▶sub is_ground ( $self, $subst ) {
Subroutine is_ground: not called CC=3 SCAR=24.8
Pod documented
36 0 for my $goal ( @{ $self->{goals} } ) {
37 0 ▶ return 0 unless $goal->is_ground($subst);
Branch: 1 branch
BranchTrueFalseTotal
unless $goal->is_ground($subst) 0 0 0
38 }
39 0 return 1;
40 }
41  
42 31 1;
« blib/lib/Logic/Relational/Goal/Guard.pm ↑ Summary blib/lib/Logic/Relational/Goal/All.pm »