ExtensionLibrary

abstract class ExtensionLibrary(extended: Library) : AbstractLibrary

Base class for a Library that decorates an extended one, contributing everything the extended library already has plus whatever additionalOperators/additionalRules/additionalPrimitives/additionalFunctions the subclass overrides. Keeps extended's Library.alias.

Parameters

extended

the Library this one extends with additional contributions.

Throws

(lazily, on first access of primitives/functions) if an additionalPrimitives/additionalFunctions signature clashes with one already in extended or among the additional ones themselves (see Library.Companion.toMapEnsuringNoDuplicates).

Constructors

Link copied to clipboard
constructor(extended: Library)

Properties

Link copied to clipboard

Extra Operators to add on top of extended's; empty by default.

Link copied to clipboard
open override val alias: String

The alias identifying this library

Link copied to clipboard
override val clauses: List<Clause>

Rules, facts, or directories to be loaded by a solver when the library is used

Link copied to clipboard
open override val functions: Map<Signature, LogicFunction>

LogicFunctions to be loaded by a solver when the library is used, indexed by their Signature in the eyes of the solver

Link copied to clipboard
open override val operators: OperatorSet

Operators to be loaded by a solver when the library is used

Link copied to clipboard
open override val primitives: Map<Signature, Primitive>

Primitives to be loaded by a solver when the library is used, indexed by their Signature in the eyes of the solver

Link copied to clipboard

The Signature of every Rule (i.e. non-fact clause) among clauses, deduplicated.

Functions

Link copied to clipboard
open operator fun contains(operator: Operator): Boolean

Checks whether this library contains the definition of provided operator

open operator fun contains(signature: Signature): Boolean

Checks whether this library contains the provided signature.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard

Shorthand for this Library's declared Library.operators, as a Sequence.

Link copied to clipboard
open fun hasFunction(signature: Signature): Boolean

Checks whether this library has a LogicFunction with provided signature

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open fun hasPrimitive(signature: Signature): Boolean

Checks whether this library has a Primitive with provided signature

Link copied to clipboard
open fun hasProtected(signature: Signature): Boolean

Checks whether the provided signature, is protected in this library

Link copied to clipboard
open override fun hasRule(signature: Signature): Boolean

Checks whether this library has a Rule with provided signature

Link copied to clipboard
operator fun Library.plus(other: Library): Runtime

Combines this Library and other into a two-library Runtime, via Runtime.of. Note that, unlike Runtime.plus, this does not reject a clashing Library.alias: if both share the same alias, other silently wins.

Link copied to clipboard

Converts the current library into a Runtime containing a single library

Link copied to clipboard
open override fun toString(): String