Solution

io.github.kelvindev15.prolog.solver.Solver.Solution
enum Solution

Attributes

Graph
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Type members

Enum entries

final case class Halt(exception: Exception)

A wrapper for the exception raised by the solver.

A wrapper for the exception raised by the solver.

Attributes

final case class No(query: Struct)

A No solution, the the attempted query.

A No solution, the the attempted query.

Attributes

final case class Yes(query: Struct, substitution: Substitution)

A Yes solution, with the resolved query and the inferred substitutions.

A Yes solution, with the resolved query and the inferred substitutions.

Attributes

Value members

Concrete methods

def apply(variable: Variable): Option[Term]
Extension method from Solver

Returns an option filled with the substitution term for the provided variable. The option will be empty if the solution is No or Halt or the provided variable is not in the Substitution.

Returns an option filled with the substitution term for the provided variable. The option will be empty if the solution is No or Halt or the provided variable is not in the Substitution.

Attributes

def as[T <: Solution](using ClassTag[T]): T
Extension method from Solver

Cast the solution to a Solution of type T.

Cast the solution to a Solution of type T.

Type parameters

T

the type of the expected solution

Attributes

Throws
ClassCastException

if T is not the runtime type of the solution.

def asHalt: Halt
Extension method from Solver

Cast the solution to a Halt Solution.

Cast the solution to a Halt Solution.

Attributes

Throws
ClassCastException

if Halt is not the runtime type of the solution.

def asNo: No
Extension method from Solver

Cast the solution to a No Solution.

Cast the solution to a No Solution.

Attributes

Throws
ClassCastException

if No is not the runtime type of the solution.

def asYes: Yes
Extension method from Solver

Cast the solution to a Yes Solution.

Cast the solution to a Yes Solution.

Attributes

Throws
ClassCastException

if Yes is not the runtime type of the solution.

def instance: Option[Term]
Extension method from Solver

Returns an option filled with the application of the substitution to the query, if the the solution is Solution.Yes, None otherwise.

Returns an option filled with the application of the substitution to the query, if the the solution is Solution.Yes, None otherwise.

Attributes

def isHalt: Boolean
Extension method from Solver

Returns true if the solution is a Halt.

Returns true if the solution is a Halt.

Attributes

def isNo: Boolean
Extension method from Solver

Returns true if the solution is a No.

Returns true if the solution is a No.

Attributes

def isYes: Boolean
Extension method from Solver

Returns true if the solution is a Yes.

Returns true if the solution is a Yes.

Attributes