introduce next_step method to rspace
[scpubgit/DX.git] / lib / DX / ResolutionSpace.pm
CommitLineData
7f385fb2 1package DX::ResolutionSpace;
2
0c1b8f3b 3use DX::Utils qw(step);
7f385fb2 4use DX::Class;
5
0c1b8f3b 6has proposition => (is => 'ro');
7
7f385fb2 8has geometry_depends_on => (is => 'ro', required => 1);
9
10has members => (is => 'ro', required => 1);
11
113f21b9 12sub next_resolution {
13 my ($self) = @_;
14 return undef unless my ($first) = @{$self->members};
15 return $first->next_resolution;
16}
17
18sub 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 24sub 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 331;