MutableSolver
General type for mutable logic Solvers. MutableSolvers differ from Solvers in that they expose public methods for letting clients affect the state of the solver -- e.g. affecting the KB -- while no resolution process is ongoing.
This is a distinct concern from the state changes a Solver performs on itself while resolving a single query (e.g. assertz/1 executed as a goal): those are expressed as it.unibo.tuprolog.solve.sideffects.SideEffects attached to a primitive's response, not through this interface. MutableSolver instead lets client code reconfigure a solver from the outside, in between resolutions.
Obtain one via SolverFactory.mutableSolverOf / SolverFactory.mutableSolverWithDefaultBuiltins, or SolverBuilder.buildMutable.
Properties
The currently open input channels
Loaded operators
The currently open output channels
Shortcut for the standard error channel defined in outputChannels. Returns null if the channel is closed
Shortcut for the standard input channel defined in inputChannels. Returns null if the channel is closed
Shortcut for the standard output channel defined in outputChannels. Returns null if the channel is closed
Shortcut for the warnings channel defined in outputChannels. Returns null if the channel is closed
Functions
Appends theory's clauses to this solver's dynamic knowledge base, keeping the existing ones.
Appends theory's clauses to this solver's static knowledge base, keeping the existing ones.
Creates a new Solver, sharing the same resolution strategy as this one, but with every explicitly-provided argument replacing the corresponding piece of state; arguments left unspecified default to this solver's current value. Useful to derive variants of a solver overriding just a few "mutable aspects" (e.g. redirecting stdOut while keeping everything else identical).
Replaces this solver's dynamic knowledge base with theory.
Loads library into this solver's Runtime, adding it to the currently loaded libraries.
Replaces this solver's static knowledge base with theory.
Empties this solver's dynamic knowledge base.
Empties this solver's static knowledge base.
Sets flag to its default term value, as reported by NotableFlag.defaultTerm.
Sets the Prolog flag identified by flag's first component to its second component.
Sets the Prolog flag named name to value in this solver's it.unibo.tuprolog.solve.flags.FlagStore.
Replaces this solver's whole Runtime of loaded libraries with libraries.
Replaces this solver's standard error channel with stdErr.
Replaces this solver's standard input channel with stdIn.
Replaces this solver's standard output channel with stdOut.
Replaces this solver's warnings channel with warnings.
Shorthand for solve with SolveOptions.DEFAULT (i.e. all solutions, lazily, without a timeout).
Shorthand for solve with options set to SolveOptions.allLazilyWithTimeout of timeout.
Solves the goal built by scopedContext within a fresh, empty Scope (useful to build the goal Struct using scoped variables inline), capping resolution to maxDuration.
Shorthand for solveList with SolveOptions.DEFAULT.
Eagerly solves goal and collects every produced Solution into a List. Unlike solve, this always computes solutions eagerly regardless of SolveOptions.isLazy -- be mindful of goals with infinite (or very large) solution sets, which will make this method never return (or exhaust memory).
Shorthand for solveList with options set to SolveOptions.allLazilyWithTimeout of timeout.
Shorthand for solveOnce with SolveOptions.someLazily of 1.
Solves goal and eagerly returns its first Solution only, regardless of options' SolveOptions.limit (which is overridden to 1 via SolveOptions.setLimit).
Shorthand for solveOnce with a timeout, and a limit of 1 solution.
Removes library from this solver's Runtime.