Theory

interface Theory: Iterable<Clause>, Any

Fields

Name Description
open isMutable: Boolean
abstract clauses: Iterable<Clause>

All Clauses in this theory

open rules: Iterable<Rule>

Only clauses that are Rules

open directives: Iterable<Directive>

Only clauses that are Directives

abstract size: Long

The amount of clauses in this Theory

Methods

toMutableTheory

abstract fun toMutableTheory(): MutableTheory

ReturnValue

Name Description
MutableTheory

toImmutableTheory

abstract fun toImmutableTheory(): Theory

ReturnValue

Name Description
Theory

plus

abstract operator fun plus(theory: Theory): Theory

Adds given Theory to this

Parameters

Name Description
theory: Theory

ReturnValue

Name Description
Theory

plus

open operator fun plus(clause: Clause): Theory

Adds given Clause to this Theory

Parameters

Name Description
clause: Clause

ReturnValue

Name Description
Theory

contains

abstract operator fun contains(clause: Clause): Boolean

Checks if given clause is contained in this theory

Parameters

Name Description
clause: Clause

ReturnValue

Name Description
Boolean

contains

abstract operator fun contains(head: Struct): Boolean

Checks if given clause is present in this theory

Parameters

Name Description
head: Struct

ReturnValue

Name Description
Boolean

contains

abstract operator fun contains(indicator: Indicator): Boolean

Checks if clauses exists in this theory having the specified Indicator as head; this should be well-formed

Parameters

Name Description
indicator: Indicator

ReturnValue

Name Description
Boolean

get

abstract operator fun get(clause: Clause): Sequence<Clause>

Retrieves matching clauses from this theory

Parameters

Name Description
clause: Clause

ReturnValue

Name Description
Sequence<Clause>

get

abstract operator fun get(head: Struct): Sequence<Rule>

Retrieves matching rules from this theory

Parameters

Name Description
head: Struct

ReturnValue

Name Description
Sequence<Rule>

get

abstract operator fun get(indicator: Indicator): Sequence<Rule>

Retrieves all rules in this theory having the specified Indicator as head; this should be well-formed

Parameters

Name Description
indicator: Indicator

ReturnValue

Name Description
Sequence<Rule>

assertA

abstract fun assertA(clause: Clause): Theory

Adds given clause before all other clauses in this theory

Parameters

Name Description
clause: Clause

ReturnValue

Name Description
Theory

assertA

open fun assertA(struct: Struct): Theory

Adds given clause before all other clauses in this theory

Parameters

Name Description
struct: Struct

ReturnValue

Name Description
Theory

assertA

abstract fun assertA(clauses: Iterable<Clause>): Theory

Adds the given clauses before all other clauses in this theory

Parameters

Name Description
clauses: Iterable<Clause>

ReturnValue

Name Description
Theory

assertA

abstract fun assertA(clauses: Sequence<Clause>): Theory

Adds the given clauses before all other clauses in this theory

Parameters

Name Description
clauses: Sequence<Clause>

ReturnValue

Name Description
Theory

assertZ

abstract fun assertZ(clause: Clause): Theory

Adds given clause after all other clauses in this theory

Parameters

Name Description
clause: Clause

ReturnValue

Name Description
Theory

assertZ

open fun assertZ(struct: Struct): Theory

Adds given clause after all other clauses in this theory

Parameters

Name Description
struct: Struct

ReturnValue

Name Description
Theory

assertZ

abstract fun assertZ(clauses: Iterable<Clause>): Theory

Adds the given clauses after all other clauses in this theory

Parameters

Name Description
clauses: Iterable<Clause>

ReturnValue

Name Description
Theory

assertZ

abstract fun assertZ(clauses: Sequence<Clause>): Theory

Adds the given clauses after all other clauses in this theory

Parameters

Name Description
clauses: Sequence<Clause>

ReturnValue

Name Description
Theory

retract

abstract fun retract(clause: Clause): RetractResult<Theory>

Tries to delete a matching clause from this theory

Parameters

Name Description
clause: Clause

ReturnValue

Name Description
RetractResult<Theory>

retract

abstract fun retract(clauses: Iterable<Clause>): RetractResult<Theory>

Tries to delete the matching clauses from this theory

Parameters

Name Description
clauses: Iterable<Clause>

ReturnValue

Name Description
RetractResult<Theory>

retract

abstract fun retract(clauses: Sequence<Clause>): RetractResult<Theory>

Tries to delete the matching clauses from this theory

Parameters

Name Description
clauses: Sequence<Clause>

ReturnValue

Name Description
RetractResult<Theory>

retract

open fun retract(head: Struct): RetractResult<Theory>

Tries to delete a matching clause from this theory

Parameters

Name Description
head: Struct

ReturnValue

Name Description
RetractResult<Theory>

retractAll

abstract fun retractAll(clause: Clause): RetractResult<Theory>

Tries to delete all matching clauses from this theory

Parameters

Name Description
clause: Clause

ReturnValue

Name Description
RetractResult<Theory>

retractAll

open fun retractAll(head: Struct): RetractResult<Theory>

Tries to delete all matching clauses from this theory

Parameters

Name Description
head: Struct

ReturnValue

Name Description
RetractResult<Theory>

abolish

abstract fun abolish(indicator: Indicator): Theory

Parameters

Name Description
indicator: Indicator

ReturnValue

Name Description
Theory

toString

abstract fun toString(asPrologText: Boolean): String

An enhanced toString that prints the theory in a Prolog program format, if asPrologText is true

Parameters

Name Description
asPrologText: Boolean

ReturnValue

Name Description
String

equals

abstract fun equals(other: Theory, useVarCompleteName: Boolean): Boolean

Parameters

Name Description
other: Theory
useVarCompleteName: Boolean

ReturnValue

Name Description
Boolean

clone

abstract fun clone(): Theory

ReturnValue

Name Description
Theory

CompanionObject

Theory

interface Theory: Iterable<Clause>, Any

Methods

empty

fun empty(): Theory

Creates an empty Theory

ReturnValue

Name Description
Theory

of

fun of(vararg clause: Clause): Theory

Creates a Theory, containing the given clauses

Parameters

Name Description
vararg clause: Clause

ReturnValue

Name Description
Theory

of

fun of(clauses: Iterable<Clause>): Theory

Creates a Theory, containing the given clauses

Parameters

Name Description
clauses: Iterable<Clause>

ReturnValue

Name Description
Theory

of

fun of(clauses: Sequence<Clause>): Theory

Creates a Theory, containing the given clauses

Parameters

Name Description
clauses: Sequence<Clause>

ReturnValue

Name Description
Theory

of

fun of(vararg clauses: Scope.()->Clause): Theory

Let developers easily create a Theory, while avoiding variables names clashing by using a different Scope for each Clause

Parameters

Name Description
vararg clauses: Scope.()->Clause

ReturnValue

Name Description
Theory

emptyIndexed

fun emptyIndexed(): Theory

Creates an empty Theory backed by an indexed data structure

ReturnValue

Name Description
Theory

indexedOf

fun indexedOf(vararg clause: Clause): Theory

Creates a Theory backed by an indexed data structure, containing the given clauses

Parameters

Name Description
vararg clause: Clause

ReturnValue

Name Description
Theory

indexedOf

fun indexedOf(vararg clauses: Scope.()->Clause): Theory

Let developers easily create a Theory backed by an indexed data structure, while avoiding variables names clashing by using a different Scope for each Clause

Parameters

Name Description
vararg clauses: Scope.()->Clause

ReturnValue

Name Description
Theory

indexedOf

fun indexedOf(clauses: Sequence<Clause>): Theory

Creates a Theory backed by an indexed data structure, containing the given clauses

Parameters

Name Description
clauses: Sequence<Clause>

ReturnValue

Name Description
Theory

indexedOf

fun indexedOf(clauses: Iterable<Clause>): Theory

Creates a Theory backed by an indexed data structure, containing the given clauses

Parameters

Name Description
clauses: Iterable<Clause>

ReturnValue

Name Description
Theory

emptyListed

fun emptyListed(): Theory

Creates a Theory backed by a list, containing the given clauses

ReturnValue

Name Description
Theory

listedOf

fun listedOf(vararg clause: Clause): Theory

Creates a Theory backed by a list, containing the given clauses

Parameters

Name Description
vararg clause: Clause

ReturnValue

Name Description
Theory

listedOf

fun listedOf(vararg clause: Scope.()->Clause): Theory

Let developers easily create a Theory backed by a list, while avoiding variables names clashing by using a different Scope for each Clause

Parameters

Name Description
vararg clause: Scope.()->Clause

ReturnValue

Name Description
Theory

listedOf

fun listedOf(clauses: Sequence<Clause>): Theory

Creates a Theory backed by a list, containing the given clauses

Parameters

Name Description
clauses: Sequence<Clause>

ReturnValue

Name Description
Theory

listedOf

fun listedOf(clauses: Iterable<Clause>): Theory

Creates a Theory backed by a list, containing the given clauses

Parameters

Name Description
clauses: Iterable<Clause>

ReturnValue

Name Description
Theory

Extensions

parse

fun Theory.Companion.parse(input: String, operators: OperatorSet): Theory

Receiver

Name Description
Theory.Companion

Parameters

Name Description
input: String
operators: OperatorSet

ReturnValue

Name Description
Theory

parse

fun Theory.Companion.parse(input: String): Theory

Receiver

Name Description
Theory.Companion

Parameters

Name Description
input: String

ReturnValue

Name Description
Theory