1 package DX::Step::Normal;
3 use Types::Standard qw(ArrayRef);
4 use DX::Utils qw(deparse);
9 has actions => (is => 'ro', isa => ArrayRef[Action], required => 1);
11 has depends_on => (is => 'ro', isa => DependencyGroupList, required => 1);
13 has resolves => (is => 'ro', isa => Proposition);
15 has alternative_step => (is => 'ro', isa => Step);
18 my ($self, @actions) = @_;
19 $self->but(actions => [ @actions, @{$self->actions} ]);
22 sub but_with_dependencies_on {
23 my ($self, @deps) = @_;
24 $self->but(depends_on => [ @{$self->depends_on}, @deps ]);
29 my $old_hyp = $ss->current_hypothesis;
30 trace 'step.apply.old_hyp '.$self => $old_hyp;
31 trace 'step.apply.actions '.$self => $self->actions;
32 my $new_hyp = $self->_apply_to_hyp($old_hyp);
33 return $ss->but(next_step => DX::Step::Backtrack->new) unless $new_hyp;
34 trace 'step.apply.new_hyp '.$self => $new_hyp;
36 if (my $prop = $ss->next_proposition($new_hyp)) {
37 DX::Step::ConsiderProposition->new(
44 my $alt_step = $self->alternative_step;
47 current_hypothesis => $new_hyp,
50 ? (alternatives => [ [ $old_hyp, $alt_step ], @{$ss->alternatives} ])
58 my ($self, $old_hyp) = @_;
59 return undef unless my $hyp = $old_hyp->with_actions(@{$self->actions});
60 return $hyp->with_resolution($self->resolves, $self->depends_on);