1 package DX::SearchProcess;
6 has current_search_state => (
7 is => 'ro', isa => SearchState, required => 1,
9 current_hypothesis next_step propositions alternatives
14 my ($class, $hyp, $props) = @_;
16 current_search_state => DX::SearchState->new(
17 current_hypothesis => $hyp,
19 next_step => DX::Step::InvokeNextPredicate->new(
20 proposition => $props->members->[0],
22 propositions => $props,
29 my $new_ss = $self->current_search_state->with_one_step;
30 return undef unless $new_ss;
31 return $self->but(current_search_state => $new_ss);
36 my $state = $self->current_search_state;
37 while ($state and $state->next_proposition) {
38 $state = $state->with_one_step;
40 return undef unless $state;
41 trace 'search.solution.hyp' => $state->current_hypothesis;
42 return $self->but(current_search_state => $state);
47 my $new_ss = $self->current_search_state->force_backtrack;
48 return undef unless $new_ss;
49 return $self->but(current_search_state => $new_ss);
52 sub find_next_solution {
54 return undef unless my $bt = $self->force_backtrack;
55 return $bt->find_solution;