is => 'ro', isa => ResolvedPropositionSet, required => 1
);
-has outstanding_propositions => (
- is => 'ro', isa => ArrayRef[Proposition], required => 1
-);
-
has actions => (
is => 'ro', isa => ArrayRef[Action], required => 1
);
has action_policy => (is => 'ro', isa => ActionPolicy, required => 1);
-sub head_proposition { shift->outstanding_propositions->[0] }
-
sub with_actions {
my ($self, @actions) = @_;
my $hyp = $self;
+ my @events;
foreach my $act (@actions) {
return undef unless $self->action_policy->allows($act);
- ($hyp, my @events) = $act->dry_run($hyp);
- return undef unless $hyp;
- $hyp = $hyp->but_recheck_for(@events);
+ ($hyp, my @these_events) = $act->dry_run($hyp);
return undef unless $hyp;
+ push @events, @these_events;
}
+ $hyp = $hyp->but_recheck_for(@events);
return $hyp;
}
my $hyp = ref($self)->new(
scope => $self->scope,
resolved_propositions => DX::ResolvedPropositionSet->new_empty,
- outstanding_propositions => \@recheck,
actions => [],
action_applications => [],
action_policy => $ap,
);
- my $ss = DX::SearchState->new_for($hyp);
+ my $pseq = DX::PropositionSequence->new(
+ members => \@recheck,
+ external_names => {},
+ internal_names => {},
+ );
+
+ trace 'step.recheck.hyp' => $hyp;
+
+ my $ss = DX::SearchProcess->new_for($hyp, $pseq);
- return undef unless my $sol_ss = $ss->find_solution;
+ my $sol_ss = $ss->find_solution;
+
+ unless ($sol_ss) {
+ trace 'step.recheck.fail' => 'argh';
+ return undef;
+ }
my $sol_rps = $sol_ss->current_hypothesis->resolved_propositions;
$_, $sol_rps->dependencies_for($_)
) for @recheck;
+ trace 'step.recheck.done' => 'yay';
+
return $self->but(resolved_propositions => $rps);
}
-sub resolve_head_dependent_on {
- my ($self, $depends) = @_;
- my ($first, @rest) = @{$self->outstanding_propositions};
+sub with_resolution {
+ my ($self, $prop, $depends) = @_;
$self->but(
resolved_propositions => $self->resolved_propositions
->with_resolution_for(
- $first,
+ $prop,
$depends,
),
- outstanding_propositions => \@rest,
);
}