ConcurrentExecutionContext
The ExecutionContext implementation for :solve-concurrent: an immutable node of the resolution tree that it.unibo.tuprolog.solve.concurrent.fsm.States carry around and derive from, chained back to the root goal via parent. Each concurrently-running coroutine spawned while resolving a goal (see ConcurrentSolver) owns its own chain of these, so no synchronization is needed to read pathToRoot/logicStackTrace from within a single branch -- only knowledge-base mutation shared across branches (see ConcurrentSolver's concurrency caveat) is unsynchronized.
depth/step/parent together encode the position of this context within the (conceptually tree-shaped, but per-branch linear) resolution: parent is null exactly at the isRoot context (depth == 0), and every non-root context has a strictly greater depth than its parent (enforced by the init block). goals is the (possibly partially consumed) Cursor of remaining conjuncts for query at this point in the resolution; rule/primitive record which clause or primitive response, respectively, is currently being executed to produce the next context down the chain.
Constructors
Properties
The Vars whose bindings must be preserved when substitution is filtered/restricted while moving between contexts (e.g. when returning from a sub-goal to its parent): those of query at the root, propagated down together with the variables of whatever is left in goals at each step.
Whether this context represents a genuine "activation record" -- i.e. the entry point of a new procedure call -- as opposed to an intermediate context created while unfolding a conjunction/disjunction within the same call. Used to filter pathToRoot down to logicStackTrace.
The Prolog call stack trace up to this context, built by walking pathToRoot and keeping isActivationRecord entries.
the context this one was created from (e.g. when descending into a sub-goal), or null if this isRoot.
the response of the primitive currently being executed, if any.
the clause currently being tried against it.unibo.tuprolog.solve.concurrent.fsm.State.context's current goal, if any.
Functions
Same as ExecutionContext.apply, but statically typed to return a ConcurrentExecutionContext.
Creates a new ConcurrentExecutionContext descending into ConcurrentExecutionContext.currentGoal as a sub-goal: the new context's ConcurrentExecutionContext.goals become just that goal, its ConcurrentExecutionContext.parent is this context, and its ConcurrentExecutionContext.depth/ ConcurrentExecutionContext.step are incremented by one. Used by StatePrimitiveSelection/StateRuleSelection when a goal is not last-call-optimizable, so it gets its own stack frame to backtrack into.
Same as createChild, additionally attaching rule as the clause StateRuleExecution will unify against.
Creates a new MutableSolver backed by this same resolution strategy, sharing this context's state unless overridden.
Creates a new ConcurrentSolver, sharing this context's state unless overridden.
Same as createChild, but keeps ConcurrentExecutionContext.parent unchanged instead of pointing it at this context -- used for the last-call-optimized case (see ConcurrentExecutionContext and LastCallOptimization), reusing the current stack frame rather than growing the chain of ConcurrentExecutionContext.parents.
Same as replaceWithChild, additionally attaching rule as the clause StateRuleExecution will unify against.
Builds the Solve.Request a it.unibo.tuprolog.solve.primitive.Primitive matching signature is invoked with, for goal.
Same as ExecutionContext.update, but statically typed to return a ConcurrentExecutionContext.