Solution

sealed interface Solution: Any

A type representing a solution to a goal

Fields

Name Description
abstract query: Struct

The query to which the solution refers

abstract substitution: Substitution

The substitution that has been applied to find the solution, or a failed substitution

abstract exception: ResolutionException?
abstract solvedQuery: Struct?

The Struct representing the solution, or null in case of a non-successful solution

abstract isYes: Boolean
abstract isNo: Boolean
abstract isHalt: Boolean

Methods

asYes

open fun asYes(): Yes?

Casts the current Solution to Yes, if possible, or returns null otherwise

ReturnValue

Name Description
Yes?

the current Solution, casted to Yes, or null, if the current term is not an instance of Yes

castToYes

open fun castToYes(): Yes

Casts the current Solution to Yes, if possible

ReturnValue

Name Description
Yes

the current Solution, casted to Yes

asNo

open fun asNo(): No?

Casts the current Solution to No, if possible, or returns null otherwise

ReturnValue

Name Description
No?

the current Solution, casted to No, or null, if the current term is not an instance of No

castToNo

open fun castToNo(): No

Casts the current Solution to No, if possible

ReturnValue

Name Description
No

the current Solution, casted to No

asHalt

open fun asHalt(): Halt?

Casts the current Solution to Halt, if possible, or returns null otherwise

ReturnValue

Name Description
Halt?

the current Solution, casted to Halt, or null, if the current term is not an instance of Halt

castToHalt

open fun castToHalt(): Halt

Casts the current Solution to Halt, if possible

ReturnValue

Name Description
Halt

the current Solution, casted to Halt

whenIs

abstract fun <T> whenIs(yes: (Yes)->T, no: (No)->T, halt: (Halt)->T, otherwise: (Solution)->T): T

Parameters

Name Description
yes: (Yes)->T
no: (No)->T
halt: (Halt)->T
otherwise: (Solution)->T

ReturnValue

Name Description
T

cleanUp

abstract fun cleanUp(): Solution

ReturnValue

Name Description
Solution

valueOf

abstract fun valueOf(variable: Var): Term?

Parameters

Name Description
variable: Var

ReturnValue

Name Description
Term?

valueOf

abstract fun valueOf(variable: String): Term?

Parameters

Name Description
variable: String

ReturnValue

Name Description
Term?

CompanionObject

Solution

sealed interface Solution: Any

A type representing a solution to a goal

Methods

yes

fun yes(query: Struct, substitution: Unifier): Yes

Parameters

Name Description
query: Struct
substitution: Unifier

ReturnValue

Name Description
Yes

yes

fun yes(signature: Signature, arguments: List<Term>, substitution: Unifier): Yes

Parameters

Name Description
signature: Signature
arguments: List<Term>
substitution: Unifier

ReturnValue

Name Description
Yes

no

fun no(query: Struct): No

Parameters

Name Description
query: Struct

ReturnValue

Name Description
No

no

fun no(signature: Signature, arguments: List<Term>): No

Parameters

Name Description
signature: Signature
arguments: List<Term>

ReturnValue

Name Description
No

halt

fun halt(query: Struct, exception: ResolutionException): Halt

Parameters

Name Description
query: Struct
exception: ResolutionException

ReturnValue

Name Description
Halt

halt

fun halt(signature: Signature, arguments: List<Term>, exception: ResolutionException): Halt

Parameters

Name Description
signature: Signature
arguments: List<Term>
exception: ResolutionException

ReturnValue

Name Description
Halt