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

commonMain.it.unibo.tuprolog.solve.streams.solver.fsm.AlreadyExecutedState.kt Maven / Gradle / Ivy

Go to download

Experimental, functional-programming-based implementation of Prolog's SLDNF resolution principle

There is a newer version: 1.0.4
Show newest version
package it.unibo.tuprolog.solve.streams.solver.fsm

/**
 * A wrapper class representing States that should not be executed again, because they've already executed their behaviour
 *
 * @author Enrico
 */
internal class AlreadyExecutedState(internal val wrappedState: State) : State by wrappedState {
    override val hasBehaved: Boolean = true

    override fun toString(): String = "AlreadyExecutedState of: $wrappedState"
}

/** Extension method to wrap a [State], marking it as already executed */
internal fun State.asAlreadyExecuted(): AlreadyExecutedState =
    (this as? AlreadyExecutedState)
        ?.let { it }
        ?: AlreadyExecutedState(this)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy