add exhaustionstep and resumesearch concepts
[scpubgit/DX.git] / lib / DX / Step / ResumeSearch.pm
1 package DX::Step::ResumeSearch;
2
3 use DX::Class;
4
5 with 'DX::Role::Step';
6
7 sub apply_to {
8   my ($self, $ss) = @_;
9   trace resume => [ statement => [ [ symbol => 'resume' ] ] ];
10   foreach my $adj (@{$ss->decisions_taken}) {
11     my ($rspace_was, $ss_was) = @$adj;
12     next unless @{$rspace_was->remaining_resolution_space->members};
13     trace rspace => [ statement => [
14       [ symbol => 'remaining' ],
15       @{$rspace_was->remaining_resolution_space->for_deparse->[1]}
16     ] ];
17     return $ss_was->but(
18       is_solution_state => 0,
19       next_step => $rspace_was->remaining_resolution_space->next_step
20     );
21   }
22   return $ss->but(
23     is_solution_state => 0,
24     next_step => $ss->on_exhaustion_step
25   );
26 }
27
28 1;