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