1 package DX::SearchState;
5 has current_hypothesis => (is => 'ro', required => 1);
7 has resume_step => (is => 'ro');
9 has alternatives => (is => 'ro', required => 1);
13 my $hyp = $self->current_hypothesis;
14 my $step = $self->resume_step
15 || $hyp->head_proposition->resolve_for($hyp->scope);
16 my @alt = @{$self->alternatives};
19 my ($new_hyp, $alt_step) = $step->apply_to($hyp);
22 current_hypothesis => $new_hyp,
33 ($hyp, $step) = @{shift(@alt)||[]};
40 while ($state and @{$state->current_hypothesis->outstanding_propositions}) {
41 $state = $state->with_one_step;
48 my ($first_alt, @rest_alt) = $self->alternatives;
49 return ref($self)->new(
50 current_hypothesis => $first_alt->[0],
51 resume_step => $first_alt->[1],
52 alternatives => \@rest_alt
56 sub find_next_solution {
58 return undef unless my $bt = $self->force_backtrack;
59 return $bt->find_solution;