Coverage Summary for Class: StateEnd (it.unibo.tuprolog.argumentation.core.engine.fsm)

Class Class, % Method, % Branch, % Line, % Instruction, %
StateEnd 100% (1/1) 100% (3/3) 50% (1/2) 87.5% (7/8) 96.9% (63/65)


 // Forked from 2p-kt's solve-prolog 3.0.2 (Apache License 2.0): see README.md in this package
 package it.unibo.tuprolog.argumentation.core.engine.fsm
 
 import it.unibo.tuprolog.argumentation.core.engine.PrologExecutionContext
 import it.unibo.tuprolog.solve.Solution
 
 /**
  * "End": a *resumable* terminal -- a solution (positive or negative) has just been emitted, but if
  * [PrologExecutionContext.hasOpenAlternatives] is true, [computeNext] loops back into `StateBacktracking`
  * rather than truly stopping. This is what makes `Solver.solve`'s lazy [Sequence] of
  * [it.unibo.tuprolog.solve.Solution]s work: pulling the next item from the sequence is exactly what triggers
  * this transition. Never times out ([isTimeout] is always `false`), since it is reached only after a solution
  * has already been produced.
  */
 data class StateEnd(
     override val solution: Solution,
     override val context: PrologExecutionContext,
 ) : AbstractEndState(solution, context) {
     override val isTimeout: Boolean
         get() = false
 
     override fun computeNext(): State =
         if (context.hasOpenAlternatives) {
             StateBacktracking(context.copy(step = nextStep(), startTime = currentTime()))
         } else {
             super.computeNext()
         }
 }