All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.it.unibo.tuprolog.theory.RetractResult.kt Maven / Gradle / Ivy

Go to download

In-memory storage and indexing facilities for ordered and unordered knowledge bases composed by logic clauses

There is a newer version: 0.17.4
Show newest version
package it.unibo.tuprolog.theory

import it.unibo.tuprolog.core.Clause
import kotlin.js.JsName

/** A result given after a "retract" operation */
sealed class RetractResult {

    /** The result always present value, is the clause database resulting from the operation execution */
    @JsName("theory")
    abstract val theory: Theory

    /** A successful "retract" operation result, carrying the new [theory] and removed [clauses] */
    data class Success(
        override val theory: Theory,
        @JsName("clauses") val clauses: Iterable
    ) : RetractResult() {

        /** Gets the first successfully retracted clause */
        @JsName("firstClause")
        val firstClause: Clause
            get() = clauses.first()
    }

    /** A failed "retract" operation result, carrying the unchanged [theory] */
    data class Failure(override val theory: Theory) : RetractResult()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy