StateEnd

data class StateEnd(val solution: Solution, val context: ClassicExecutionContext) : AbstractEndState

"End": a resumable terminal -- a solution (positive or negative) has just been emitted, but if ClassicExecutionContext.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.Solutions 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.

Constructors

Link copied to clipboard
constructor(solution: Solution, context: ClassicExecutionContext)

Properties

Link copied to clipboard
open override val context: ClassicExecutionContext

The execution context this state operates on.

Link copied to clipboard

Whether asking for another solution after this one would resume resolution (via backtracking) rather than truly stop.

Link copied to clipboard

Whether this state is a terminal one for the current resolution step, i.e. an EndState.

Link copied to clipboard
open override val solution: Solution

The solution emitted by reaching this state.

Functions

Link copied to clipboard
open fun asEndState(): EndState

This state as an EndState, or null if isEndState is false.

Link copied to clipboard

This state as an EndState.

Link copied to clipboard
open override fun clone(context: ClassicExecutionContext = this.context): StateEnd

Returns a copy of this state, replacing context with the given one (defaulting to the current context).

Link copied to clipboard
open override fun next(): State

Computes the state the machine transitions into from here -- a pure function of context.