Commit | Line | Data |
7f385fb2 |
1 | package DX::ResolutionSpace; |
2 | |
0c1b8f3b |
3 | use DX::Utils qw(step); |
7f385fb2 |
4 | use DX::Class; |
5 | |
0c1b8f3b |
6 | has proposition => (is => 'ro'); |
7 | |
7f385fb2 |
8 | has geometry_depends_on => (is => 'ro', required => 1); |
9 | |
10 | has members => (is => 'ro', required => 1); |
11 | |
113f21b9 |
12 | sub next_resolution { |
13 | my ($self) = @_; |
14 | return undef unless my ($first) = @{$self->members}; |
15 | return $first->next_resolution; |
16 | } |
17 | |
18 | sub remaining_resolution_space { |
19 | my ($self) = @_; |
20 | die "Sense makes not" unless my ($first, @rest) = @{$self->members}; |
21 | return $self->but(members => [ $first->remainder, @rest ]); |
22 | } |
23 | |
0c1b8f3b |
24 | sub next_step { |
25 | my ($self) = @_; |
26 | return undef unless @{$self->members}; |
27 | return step( |
28 | resolves => $self->proposition, |
29 | resolution_space => $self, |
30 | ); |
31 | } |
32 | |
7f385fb2 |
33 | 1; |