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

commonMain.it.unibo.tuprolog.solve.channel.impl.ChannelStoreUtils.kt Maven / Gradle / Ivy

There is a newer version: 1.0.4
Show newest version
package it.unibo.tuprolog.solve.channel.impl

import it.unibo.tuprolog.solve.channel.Channel
import it.unibo.tuprolog.solve.channel.ChannelStore

internal object ChannelStoreUtils {
    fun > MutableMap.ensureAliasRefersToChannel(
        key: String,
        channel: C,
    ): MutableMap {
        this[key] = channel
        return this
    }

    fun > MutableMap.setCurrent(
        key: String,
        defaultChannel: C,
    ): MutableMap {
        if (ChannelStore.CURRENT !in this) {
            this[ChannelStore.CURRENT] = this[key] ?: defaultChannel
        }
        return this
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy