Package-level declarations

Types

Link copied to clipboard
interface NullRef : ObjectRef

The ObjectRef representing a null JVM/Kotlin value, i.e. the Prolog-side counterpart of null -- obtainable as ObjectRef.NULL.

Link copied to clipboard
interface ObjectRef : Ref

A Ref wrapping a live, non-null JVM/Kotlin object instance, so that it can flow through Prolog terms and be the target of invoke_method/3, assign/3, and friends.

Link copied to clipboard

Converts a JVM/Kotlin value into its Prolog Term representation -- the direction opposite to TermToObjectConverter -- e.g. as needed to turn the return value of a reflectively invoked method (Ref.invoke) back into something a Prolog computation can unify against.

Link copied to clipboard

The prolog.oop library, bridging the JVM/Kotlin object world with Prolog terms via reflection.

Link copied to clipboard

Resolves Java/Kotlin overloading -- i.e. picks, among all public members of type named alike, the one whose formal parameters best match a given list of Prolog Term arguments -- using termToObjectConverter to score how well each candidate parameter type fits each argument (see TermToObjectConverter.priorityOfConversion).

Link copied to clipboard
interface Ref : Atom

A Prolog Atom that also acts as a reflective handle onto some JVM/Kotlin entity -- either a live object (ObjectRef) or a type (TypeRef) -- letting Prolog code invoke members and assign properties on it without a hand-written it.unibo.tuprolog.solve.primitive.Primitive for each one.

Link copied to clipboard
sealed class Result

The outcome of reflectively invoking a member via Ref.invoke, Ref.assign, or TypeRef.create: either None -- there was no return value, e.g. a void/Unit-returning method -- or a Value wrapping whatever was returned (including null).

Link copied to clipboard

Converts a Prolog Term into a JVM/Kotlin value -- the direction opposite to ObjectToTermConverter -- and drives the overload-resolution machinery (OverloadSelector) used to pick the right method/constructor/property to invoke for a given set of Prolog arguments.

Link copied to clipboard
interface TypeFactory

Resolves a fully-qualified type name (as it would appear as an it.unibo.tuprolog.core.Atom in Prolog code, e.g. in a cast/3 expression X as 'java.util.ArrayList' or in new_object/2,3) into a KClass, backing type-name lookups performed by TermToObjectConverter and the type/2 predicate (it.unibo.tuprolog.solve.libs.oop.primitives.Type).

Link copied to clipboard
interface TypeRef : Ref

A Ref wrapping a JVM/Kotlin type (rather than an instance of it, as ObjectRef does), so that Prolog code can construct new instances of it (create) and invoke its static members / companion object members via the inherited Ref.invoke and Ref.assign.

Properties

Link copied to clipboard

The pattern a fully-qualified type name must match to be looked up by kClassFromName (and, transitively, by TypeFactory.default) -- e.g. java.util.ArrayList on the JVM, or <module>:<qualified name> on JS.

The pattern a fully-qualified type name must match to be looked up by kClassFromName (and, transitively, by TypeFactory.default) -- e.g. java.util.ArrayList on the JVM, or <module>:<qualified name> on JS.

The pattern a fully-qualified type name must match to be looked up by kClassFromName (and, transitively, by TypeFactory.default) -- e.g. java.util.ArrayList on the JVM, or <module>:<qualified name> on JS.

Link copied to clipboard

This KClass's companion object instance, or its Kotlin object singleton instance if it is one itself -- used by it.unibo.tuprolog.solve.libs.oop.impl.TypeRefImpl so that invoking a member on a TypeRef reaches the companion/singleton rather than requiring a null instance.

This KClass's companion object instance, or its Kotlin object singleton instance if it is one itself -- used by it.unibo.tuprolog.solve.libs.oop.impl.TypeRefImpl so that invoking a member on a TypeRef reaches the companion/singleton rather than requiring a null instance.

This KClass's companion object instance, or its Kotlin object singleton instance if it is one itself -- used by it.unibo.tuprolog.solve.libs.oop.impl.TypeRefImpl so that invoking a member on a TypeRef reaches the companion/singleton rather than requiring a null instance.

Link copied to clipboard
expect val KClass<*>.companionObjectType: Optional<out KClass<*>>

The KClass of companionObjectRef, if any. Always Optional.none on Kotlin/JS.

actual val KClass<*>.companionObjectType: Optional<out KClass<*>>

The KClass of companionObjectRef, if any. Always Optional.none on Kotlin/JS.

actual val KClass<*>.companionObjectType: Optional<out KClass<*>>

The KClass of companionObjectRef, if any. Always Optional.none on Kotlin/JS.

Link copied to clipboard

The formal parameter types of this callable (constructor, method, or property getter/setter), excluding the implicit instance receiver -- used to score how well a list of Prolog arguments matches a candidate overload (see OverloadSelector).

The formal parameter types of this callable (constructor, method, or property getter/setter), excluding the implicit instance receiver -- used to score how well a list of Prolog arguments matches a candidate overload (see OverloadSelector).

The formal parameter types of this callable (constructor, method, or property getter/setter), excluding the implicit instance receiver -- used to score how well a list of Prolog arguments matches a candidate overload (see OverloadSelector).

Link copied to clipboard
expect val KClass<*>.fullName: String

This KClass's fully-qualified name (e.g. java.util.ArrayList), as used to render TypeRef and ObjectRef atoms and in exception messages.

actual val KClass<*>.fullName: String

This KClass's fully-qualified name (e.g. java.util.ArrayList), as used to render TypeRef and ObjectRef atoms and in exception messages.

actual val KClass<*>.fullName: String

This KClass's fully-qualified name (e.g. java.util.ArrayList), as used to render TypeRef and ObjectRef atoms and in exception messages.

Link copied to clipboard
expect val Any.identifier: String

A per-platform, stable-for-the-object's-lifetime identity string (e.g. the hex identity hash code on the JVM), used to keep the Prolog rendering of two distinct ObjectRefs over equal objects distinct (see ObjectRef.nameOf).

actual val Any.identifier: String

A per-platform, stable-for-the-object's-lifetime identity string (e.g. the hex identity hash code on the JVM), used to keep the Prolog rendering of two distinct ObjectRefs over equal objects distinct (see ObjectRef.nameOf).

actual val Any.identifier: String

A per-platform, stable-for-the-object's-lifetime identity string (e.g. the hex identity hash code on the JVM), used to keep the Prolog rendering of two distinct ObjectRefs over equal objects distinct (see ObjectRef.nameOf).

Link copied to clipboard

Whether this KClass is one of Kotlin's primitive numeric/character types.

Link copied to clipboard
expect val KClass<*>.name: String

This KClass's simple (unqualified) name, as returned by the type/2 predicate (it.unibo.tuprolog.solve.libs.oop.primitives.Type) when converting a TypeRef to its name.

actual val KClass<*>.name: String

This KClass's simple (unqualified) name, as returned by the type/2 predicate (it.unibo.tuprolog.solve.libs.oop.primitives.Type) when converting a TypeRef to its name.

actual val KClass<*>.name: String

This KClass's simple (unqualified) name, as returned by the type/2 predicate (it.unibo.tuprolog.solve.libs.oop.primitives.Type) when converting a TypeRef to its name.

Link copied to clipboard

The setter of this mutable property, as a KFunction, used to actually perform an Ref.assign.

The setter of this mutable property, as a KFunction, used to actually perform an Ref.assign.

The setter of this mutable property, as a KFunction, used to actually perform an Ref.assign.

Functions

Link copied to clipboard
expect fun KClass<*>.allSupertypes(strict: Boolean): Sequence<KClass<*>>

Every supertype (superclass and implemented interface, transitively) of this KClass, plus this KClass itself unless strict is true.

actual fun KClass<*>.allSupertypes(strict: Boolean): Sequence<KClass<*>>

Every supertype (superclass and implemented interface, transitively) of this KClass, plus this KClass itself unless strict is true.

actual fun KClass<*>.allSupertypes(strict: Boolean): Sequence<KClass<*>>

Every supertype (superclass and implemented interface, transitively) of this KClass, plus this KClass itself unless strict is true.

Link copied to clipboard
expect fun <T> KCallable<T>.invoke(instance: Any?, vararg args: Any?): T

Invokes this callable (constructor, method, or property getter/setter) on instance (null for a constructor, a static member, or a companion-object member reached through companionObjectRef) with the given args, returning whatever it returns.

actual fun <T> KCallable<T>.invoke(instance: Any?, vararg args: Any?): T

Invokes this callable (constructor, method, or property getter/setter) on instance (null for a constructor, a static member, or a companion-object member reached through companionObjectRef) with the given args, returning whatever it returns.

actual fun <T> KCallable<T>.invoke(instance: Any?, vararg args: Any?): T

Invokes this callable (constructor, method, or property getter/setter) on instance (null for a constructor, a static member, or a companion-object member reached through companionObjectRef) with the given args, returning whatever it returns.

Link copied to clipboard
infix fun KClass<*>.isSubtypeOf(other: KClass<*>): Boolean

Whether this KClass is a (non-strict, by default) subtype of other.

fun KClass<*>.isSubtypeOf(other: KClass<*>, strict: Boolean): Boolean

Whether this KClass is a subtype of other -- strictly (excluding other == this) if strict is true.

Link copied to clipboard
infix fun KClass<*>.isSupertypeOf(other: KClass<*>): Boolean

Whether this KClass is a (non-strict, by default) supertype of other.

fun KClass<*>.isSupertypeOf(other: KClass<*>, strict: Boolean): Boolean

Whether this KClass is a supertype of other -- strictly (excluding other == this) if strict is true.

Link copied to clipboard
expect fun kClassFromName(qualifiedName: String): Optional<out KClass<*>>

Resolves qualifiedName (which must match CLASS_NAME_PATTERN) into the KClass it names, or Optional.none if no such type can be found. Backs TypeFactory.default.

actual fun kClassFromName(qualifiedName: String): Optional<out KClass<*>>

Resolves qualifiedName (which must match CLASS_NAME_PATTERN) into the KClass it names, or Optional.none if no such type can be found. Backs TypeFactory.default.

actual fun kClassFromName(qualifiedName: String): Optional<out KClass<*>>

Resolves qualifiedName (which must match CLASS_NAME_PATTERN) into the KClass it names, or Optional.none if no such type can be found. Backs TypeFactory.default.

Link copied to clipboard
actual fun overloadSelector(type: KClass<*>, termToObjectConverter: TermToObjectConverter): OverloadSelector
actual fun overloadSelector(type: KClass<*>, termToObjectConverter: TermToObjectConverter): OverloadSelector
Link copied to clipboard
expect fun KCallable<*>.pretty(): String

A human-readable rendering of this callable's name, parameters and return type, used in it.unibo.tuprolog.solve.libs.oop.exceptions.OopRuntimeException and it.unibo.tuprolog.solve.libs.oop.exceptions.RuntimePermissionException messages.

actual fun KCallable<*>.pretty(): String

A human-readable rendering of this callable's name, parameters and return type, used in it.unibo.tuprolog.solve.libs.oop.exceptions.OopRuntimeException and it.unibo.tuprolog.solve.libs.oop.exceptions.RuntimePermissionException messages.

actual fun KCallable<*>.pretty(): String

A human-readable rendering of this callable's name, parameters and return type, used in it.unibo.tuprolog.solve.libs.oop.exceptions.OopRuntimeException and it.unibo.tuprolog.solve.libs.oop.exceptions.RuntimePermissionException messages.

Link copied to clipboard
fun KClass<*>.subTypeDistance(other: KClass<*>): Int?

Like superTypeDistance, with the roles of this and other swapped.

Link copied to clipboard
fun KClass<*>.superTypeDistance(other: KClass<*>): Int?

How many steps up other's supertype hierarchy this KClass is found at (0 if other == this), or null if this is not a supertype of other at all. Used to rank overload candidates: the closer a formal parameter type is to an argument's actual type, the better the match.