Commit | Line | Data |
614f3d93 |
1 | package DX::Step::EnterRecheck; |
2 | |
251177ea |
3 | use DX::Step::CompleteRecheck; |
4 | |
614f3d93 |
5 | use DX::Class; |
6 | |
7 | with 'DX::Role::Step'; |
8 | |
9 | has proposition_list => (is => 'ro', required => 1); |
10 | |
11 | sub apply_to { |
12 | my ($self, $old_ss) = @_; |
13 | |
14 | my ($prop, @rest) = @{$self->proposition_list}; |
15 | |
16 | die "NOT YET DAMNIT" if @rest; |
17 | |
18 | my $old_hyp = $old_ss->current_hypothesis; |
19 | |
20 | # we should probably be doing something about pruning the scope |
21 | # but that's completely pointless until we have rules (and also, |
22 | # the lock_to_depth arg needs to come from the proposition somehow) |
23 | |
24 | my $ap = DX::ActionPolicy::LockScope->new( |
25 | lock_to_depth => $old_hyp->scope->depth, |
26 | next_policy => $old_hyp->action_policy, |
27 | ); |
28 | |
29 | my $hyp = ref($old_hyp)->new( |
30 | scope => $old_hyp->scope, |
31 | resolved_propositions => DX::ResolvedPropositionSet->new_empty, |
32 | actions => [], |
33 | action_applications => [], |
34 | action_policy => $ap, |
35 | ); |
36 | |
37 | my $pseq = DX::PropositionSequence->new( |
38 | members => [ $prop ], |
39 | external_names => {}, |
40 | internal_names => {}, |
41 | ); |
42 | |
43 | trace 'step.recheck.hyp' => $hyp; |
44 | |
45 | my $ss = DX::SearchState->new( |
46 | current_hypothesis => $hyp, |
47 | alternatives => [], |
48 | propositions => $pseq, |
49 | next_step => DX::Step::ConsiderProposition->new( |
50 | proposition => $prop, |
51 | ), |
52 | is_solution_state => 0, |
53 | on_exhaustion_step => undef, |
251177ea |
54 | on_solution_step => DX::Step::CompleteRecheck->new( |
2ccd4b58 |
55 | resume_search_state => $old_ss, |
251177ea |
56 | was_recheck_for => $prop, |
57 | ), |
614f3d93 |
58 | ); |
59 | |
60 | return $ss; |
61 | } |
62 | |
63 | 1; |