mark propositionless search states as solutions
[scpubgit/DX.git] / lib / DX / SearchState.pm
index dcfb606..1548f11 100644 (file)
@@ -13,6 +13,8 @@ has propositions => (is => 'ro', isa => PropositionSequence, required => 1);
 
 has alternatives => (is => 'ro', isa => AlternativeList, required => 1);
 
+has is_solution_state => (is => 'ro', required => 1);
+
 sub next_proposition {
   my ($self, $hyp) = @_;
   $hyp ||= $self->current_hypothesis;
@@ -26,10 +28,16 @@ sub new_for {
   $class->new(
     current_hypothesis => $hyp,
     alternatives => [],
-    next_step => DX::Step::InvokeNextPredicate->new(
-      proposition => $props->members->[0],
-    ),
     propositions => $props,
+    (@{$props->members}
+      ? (
+          next_step => DX::Step::InvokeNextPredicate->new(
+            proposition => $props->members->[0],
+          ),
+          is_solution_state => 0,
+        )
+      : ( is_solution_state => 1 )
+    ),
   );
 }