commonMain.it.unibo.tuprolog.collections.RetrieveResult.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of theory-jvm Show documentation
Show all versions of theory-jvm Show documentation
In-memory storage and indexing facilities for ordered and unordered knowledge bases composed by logic clauses
package it.unibo.tuprolog.collections
import it.unibo.tuprolog.core.Clause
import kotlin.js.JsName
sealed class RetrieveResult {
open val isSuccess: Boolean
get() = false
open val isFailure: Boolean
get() = false
@JsName("collection")
abstract val collection: C
@JsName("clauses")
abstract val clauses: List?
@JsName("firstClause")
abstract val firstClause: Clause?
data class Success(
override val collection: C,
override val clauses: List,
) : RetrieveResult() {
override val isSuccess: Boolean
get() = true
override val firstClause: Clause
get() = clauses.first()
}
data class Failure(override val collection: C) : RetrieveResult() {
override val isFailure: Boolean
get() = true
override val clauses: Nothing?
get() = null
override val firstClause: Nothing?
get() = null
}
}