Request

data class Request<C : ExecutionContext> : Solve

Class representing a Request to be full-filled by the Solver

Fields

Name Description
val query: Struct

The current query Struct of this request

val signature: Signature

Signature of the goal to be solved in this Request

val arguments: List<Term>

Arguments with which the goal is invoked in this Request

val context: C

The context that's current at Request making

val requestIssuingInstant: TimeInstant

The time instant when the request was submitted for resolution

val executionMaxDuration: TimeDuration

The execution max duration after which the computation should end, because no more useful

Constructors

<init>

constructor(signature: Signature, arguments: List<Term>, context: C, requestIssuingInstant: TimeInstant, executionMaxDuration: TimeDuration)

Class representing a Request to be full-filled by the Solver

Parameters

Name Description
signature: Signature
arguments: List<Term>
context: C
requestIssuingInstant: TimeInstant
executionMaxDuration: TimeDuration

Methods

replyWith

fun replyWith(substitution: Substitution, sideEffectManager: SideEffectManager?, vararg sideEffects: SideEffect): Response

Creates a new Response to this Request

Parameters

Name Description
substitution: Substitution
sideEffectManager: SideEffectManager?
vararg sideEffects: SideEffect

ReturnValue

Name Description
Response

replyWith

fun replyWith(substitution: Substitution, sideEffectManager: SideEffectManager?, buildSideEffects: SideEffectsBuilder.()->Unit): Response

Creates a new Response to this Request

Parameters

Name Description
substitution: Substitution
sideEffectManager: SideEffectManager?
buildSideEffects: SideEffectsBuilder.()->Unit

ReturnValue

Name Description
Response

replyWith

fun replyWith(solution: Solution, sideEffectManager: SideEffectManager?, vararg sideEffects: SideEffect): Response

Creates a new Response to this Request

Parameters

Name Description
solution: Solution
sideEffectManager: SideEffectManager?
vararg sideEffects: SideEffect

ReturnValue

Name Description
Response

replyWith

fun replyWith(solution: Solution, sideEffectManager: SideEffectManager?, buildSideEffects: SideEffectsBuilder.()->Unit): Response

Creates a new Response to this Request

Parameters

Name Description
solution: Solution
sideEffectManager: SideEffectManager?
buildSideEffects: SideEffectsBuilder.()->Unit

ReturnValue

Name Description
Response

replyWith

fun replyWith(condition: Boolean, sideEffectManager: SideEffectManager?, vararg sideEffects: SideEffect): Response

Creates a new successful or failed Response depending on condition; to be used when the substitution doesn't change

Parameters

Name Description
condition: Boolean
sideEffectManager: SideEffectManager?
vararg sideEffects: SideEffect

ReturnValue

Name Description
Response

replyWith

fun replyWith(condition: Boolean, sideEffectManager: SideEffectManager?, buildSideEffects: SideEffectsBuilder.()->Unit): Response

Creates a new successful or failed Response depending on condition; to be used when the substitution doesn't change

Parameters

Name Description
condition: Boolean
sideEffectManager: SideEffectManager?
buildSideEffects: SideEffectsBuilder.()->Unit

ReturnValue

Name Description
Response

replySuccess

fun replySuccess(substitution: Unifier, sideEffectManager: SideEffectManager?, vararg sideEffects: SideEffect): Response

Creates a new successful Response to this Request, with substitution

Parameters

Name Description
substitution: Unifier
sideEffectManager: SideEffectManager?
vararg sideEffects: SideEffect

ReturnValue

Name Description
Response

replySuccess

fun replySuccess(substitution: Unifier, sideEffectManager: SideEffectManager?, buildSideEffects: SideEffectsBuilder.()->Unit): Response

Creates a new successful Response to this Request, with substitution

Parameters

Name Description
substitution: Unifier
sideEffectManager: SideEffectManager?
buildSideEffects: SideEffectsBuilder.()->Unit

ReturnValue

Name Description
Response

replyFail

fun replyFail(sideEffectManager: SideEffectManager?, vararg sideEffects: SideEffect): Response

Creates a new failed Response to this Request

Parameters

Name Description
sideEffectManager: SideEffectManager?
vararg sideEffects: SideEffect

ReturnValue

Name Description
Response

replyFail

fun replyFail(sideEffectManager: SideEffectManager?, buildSideEffects: SideEffectsBuilder.()->Unit): Response

Creates a new failed Response to this Request

Parameters

Name Description
sideEffectManager: SideEffectManager?
buildSideEffects: SideEffectsBuilder.()->Unit

ReturnValue

Name Description
Response

replyException

fun replyException(exception: TuPrologRuntimeException, sideEffectManager: SideEffectManager?, vararg sideEffects: SideEffect): Response

Creates a new halt Response to this Request, with cause exception

Parameters

Name Description
exception: TuPrologRuntimeException
sideEffectManager: SideEffectManager?
vararg sideEffects: SideEffect

ReturnValue

Name Description
Response

replyException

fun replyException(exception: TuPrologRuntimeException, sideEffectManager: SideEffectManager?, buildSideEffects: SideEffectsBuilder.()->Unit): Response

Creates a new halt Response to this Request, with cause exception

Parameters

Name Description
exception: TuPrologRuntimeException
sideEffectManager: SideEffectManager?
buildSideEffects: SideEffectsBuilder.()->Unit

ReturnValue

Name Description
Response

subSolver

fun subSolver(): Solver

ReturnValue

Name Description
Solver

solve

fun solve(goal: Struct, maxDuration: TimeDuration): Sequence<Solution>

Parameters

Name Description
goal: Struct
maxDuration: TimeDuration

ReturnValue

Name Description
Sequence<Solution>