AbstractClassicSolver

abstract class AbstractClassicSolver(unificator: Unificator = Unificator.default, libraries: Runtime = Runtime.empty(), flags: FlagStore = FlagStore.empty(), initialStaticKb: Theory = Theory.empty(unificator), initialDynamicKb: Theory = MutableTheory.empty(unificator), inputChannels: InputStore = InputStore.fromStandard(), outputChannels: OutputStore = OutputStore.fromStandard(), trustKb: Boolean = false) : AbstractSolver<ClassicExecutionContext>

Base implementation of every :solve-classic it.unibo.tuprolog.solve.Solver/it.unibo.tuprolog.solve.MutableSolver (ClassicSolver and MutableClassicSolver, both internal, are the only two concrete subclasses; instances are normally obtained through ClassicSolverFactory, which is what Solver.prolog/Solver.classic resolve to).

What this class actually contributes over AbstractSolver is solveImpl: turning a goal into a Sequence of Solutions by driving the it.unibo.tuprolog.solve.classic.fsm.State finite-state machine described by the :solve-classic state-machine explanation page. Concretely, it builds the root ClassicExecutionContext for the query, wraps a fresh it.unibo.tuprolog.solve.classic.fsm.StateInit into a SolutionIterator (via the abstract solutionIterator hook, which lets subclasses choose a plain or hijackable iterator), and exposes that iterator as a lazy Sequence -- so pulling the next Solution from the sequence is exactly what drives the state machine one step further, rather than eagerly computing every solution up front. currentContext is kept in sync with the state machine's progress via updateCurrentContextAfterStateTransition, which every SolutionIterator created here is wired to call after each transition.

Running resolution as an explicit loop over it.unibo.tuprolog.solve.classic.fsm.State values, instead of host-language recursion, is what lets a resolution step be paused, resumed, or inspected without unwinding a JVM/JS call stack, and sidesteps host stack-depth limits for deeply recursive Prolog programs (the "call stack" here is the ClassicExecutionContext parent chain -- ordinary heap data).

See also

Constructors

Link copied to clipboard
constructor(unificator: Unificator = Unificator.default, libraries: Runtime = Runtime.empty(), flags: FlagStore = FlagStore.empty(), initialStaticKb: Theory = Theory.empty(unificator), initialDynamicKb: Theory = MutableTheory.empty(unificator), inputChannels: InputStore = InputStore.fromStandard(), outputChannels: OutputStore = OutputStore.fromStandard(), trustKb: Boolean = false)
constructor(unificator: Unificator = Unificator.default, libraries: Runtime = Runtime.empty(), flags: FlagStore = FlagStore.empty(), staticKb: Theory = Theory.empty(unificator), dynamicKb: Theory = MutableTheory.empty(unificator), stdIn: InputChannel<String> = InputChannel.stdIn(), stdOut: OutputChannel<String> = OutputChannel.stdOut(), stdErr: OutputChannel<String> = OutputChannel.stdErr(), warnings: OutputChannel<Warning> = OutputChannel.warn(), trustKb: Boolean = false)

Properties

Link copied to clipboard
override val dynamicKb: Theory
Link copied to clipboard
override val flags: FlagStore
Link copied to clipboard
Link copied to clipboard
override val libraries: Runtime
Link copied to clipboard
override val operators: OperatorSet
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
override val staticKb: Theory
Link copied to clipboard
override val unificator: Unificator
Link copied to clipboard

Functions

Link copied to clipboard
abstract override fun clone(): AbstractClassicSolver
Link copied to clipboard
abstract override fun copy(unificator: Unificator, libraries: Runtime, flags: FlagStore, staticKb: Theory, dynamicKb: Theory, stdIn: InputChannel<String>, stdOut: OutputChannel<String>, stdErr: OutputChannel<String>, warnings: OutputChannel<Warning>): AbstractClassicSolver
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open fun solve(goal: Struct): Sequence<Solution>
open fun solve(goal: Struct, timeout: TimeDuration): Sequence<Solution>
override fun solve(goal: Struct, options: SolveOptions): Sequence<Solution>
Link copied to clipboard
open fun solveList(goal: Struct): List<Solution>
open fun solveList(goal: Struct, options: SolveOptions): List<Solution>
open fun solveList(goal: Struct, timeout: TimeDuration): List<Solution>
Link copied to clipboard
open fun solveOnce(goal: Struct): Solution
open fun solveOnce(goal: Struct, options: SolveOptions): Solution
open fun solveOnce(goal: Struct, timeout: TimeDuration): Solution
Link copied to clipboard
open override fun toString(): String