1 package DX::SearchState;
5 has current_hypothesis => (is => 'ro', isa => Hypothesis, required => 1);
7 has resume_step => (is => 'ro', isa => Step);
9 has alternatives => (is => 'ro', isa => AlternativeList, required => 1);
12 my ($class, $hyp) = @_;
14 current_hypothesis => $hyp,
21 my $hyp = $self->current_hypothesis;
22 my $step = $self->resume_step
23 || $hyp->head_proposition->resolve_for($hyp->scope);
24 my @alt = @{$self->alternatives};
27 my ($new_hyp, $alt_step) = $step->apply_to($hyp);
30 current_hypothesis => $new_hyp,
41 ($hyp, $step) = @{shift(@alt)||[]};
48 while ($state and @{$state->current_hypothesis->outstanding_propositions}) {
49 $state = $state->with_one_step;
56 my ($first_alt, @rest_alt) = $self->alternatives;
57 return ref($self)->new(
58 current_hypothesis => $first_alt->[0],
59 resume_step => $first_alt->[1],
60 alternatives => \@rest_alt
64 sub find_next_solution {
66 return undef unless my $bt = $self->force_backtrack;
67 return $bt->find_solution;