From: Matt S Trout Date: Mon, 13 Feb 2017 20:58:24 +0000 (+0000) Subject: rename alternatives to adjustments X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=df377b33658256c77066606f28d4fe4e3f5f974e;p=scpubgit%2FDX.git rename alternatives to adjustments --- diff --git a/lib/DX/Deparse.pm b/lib/DX/Deparse.pm index 228c1b0..ce3f177 100644 --- a/lib/DX/Deparse.pm +++ b/lib/DX/Deparse.pm @@ -176,7 +176,7 @@ sub _fmt_scope { sub _fmt_searchstate { my ($self, $ss, $meta) = @_; $self->_fmt_object([ - [ alternatives => '{...}' ], + [ adjustments_made => '{...}' ], [ current_hypothesis => $ss->current_hypothesis ], ], $meta); } diff --git a/lib/DX/SearchProcess.pm b/lib/DX/SearchProcess.pm index b66d350..4e44db1 100644 --- a/lib/DX/SearchProcess.pm +++ b/lib/DX/SearchProcess.pm @@ -6,7 +6,7 @@ use DX::Class; has current_search_state => ( is => 'ro', isa => SearchState, required => 1, handles => [ qw( - current_hypothesis next_step propositions alternatives + current_hypothesis next_step propositions adjustments_made ) ], ); diff --git a/lib/DX/SearchState.pm b/lib/DX/SearchState.pm index 1742ff5..eea032c 100644 --- a/lib/DX/SearchState.pm +++ b/lib/DX/SearchState.pm @@ -12,7 +12,7 @@ has next_step => (is => 'ro', isa => Maybe[Step], required => 1); has propositions => (is => 'ro', isa => PropositionSequence, required => 1); -has alternatives => (is => 'ro', isa => AlternativeList, required => 1); +has adjustments_made => (is => 'ro', isa => AdjustmentList, required => 1); has is_solution_state => (is => 'ro', required => 1); @@ -32,7 +32,7 @@ sub new_for { my ($class, $hyp, $props) = @_; $class->new( current_hypothesis => $hyp, - alternatives => [], + adjustments_made => [], propositions => $props, (@{$props->members} ? ( @@ -57,7 +57,7 @@ sub with_one_step { sub force_backtrack { my ($self) = @_; - my ($first_alt, @rest_alt) = @{$self->alternatives}; + my ($first_alt, @rest_alt) = @{$self->adjustments_made}; return undef unless $first_alt; return $self->but( next_step => DX::Step::Backtrack->new, diff --git a/lib/DX/Step/Backtrack.pm b/lib/DX/Step/Backtrack.pm index 9c489fa..ca565bc 100644 --- a/lib/DX/Step/Backtrack.pm +++ b/lib/DX/Step/Backtrack.pm @@ -6,11 +6,11 @@ with 'DX::Role::Step'; sub apply_to { my ($self, $ss) = @_; - my ($first_alt, @rest_alt) = @{$ss->alternatives}; + my ($first_alt, @rest_alt) = @{$ss->adjustments_made}; return $ss->but(next_step => $ss->on_exhaustion_step) unless $first_alt; return $ss->but( current_hypothesis => $first_alt->[1], - alternatives => \@rest_alt, + adjustments_made => \@rest_alt, next_step => $first_alt->[0]->alternative_step, is_solution_state => 0, ); diff --git a/lib/DX/Step/EnterRecheck.pm b/lib/DX/Step/EnterRecheck.pm index 2b7ac56..9bb3564 100644 --- a/lib/DX/Step/EnterRecheck.pm +++ b/lib/DX/Step/EnterRecheck.pm @@ -49,7 +49,7 @@ sub apply_to { my $ss = DX::SearchState->new( current_hypothesis => $hyp, - alternatives => [], + adjustments_made => [], propositions => $pseq, next_step => DX::Step::ConsiderProposition->new( proposition => $prop, diff --git a/lib/DX/Step/ResolveProposition.pm b/lib/DX/Step/ResolveProposition.pm index e56b19c..17df581 100644 --- a/lib/DX/Step/ResolveProposition.pm +++ b/lib/DX/Step/ResolveProposition.pm @@ -56,9 +56,9 @@ sub apply_to { my $ss = $old_ss->but( next_step => $ns, ($alt_step - ? (alternatives => [ + ? (adjustments_made => [ [ $self, $old_ss->current_hypothesis ], - @{$old_ss->alternatives} + @{$old_ss->adjustments_made} ]) : () ), diff --git a/lib/DX/Types.pm b/lib/DX/Types.pm index 8c2602a..c9a79e7 100644 --- a/lib/DX/Types.pm +++ b/lib/DX/Types.pm @@ -33,7 +33,7 @@ foreach my $role (our @ROLES) { class_type DictValue => { class => 'DX::Value::Dict' }; -declare AlternativeList => as ArrayRef[Tuple[Step, Hypothesis]]; +declare AdjustmentList => as ArrayRef[Tuple[Step, Hypothesis]]; declare DependencyType => where { foreach my $cand (EXISTENCE_OF, TYPE_OF, INDICES_OF, CONTENTS_OF) {