commonMain.it.unibo.tuprolog.solve.channel.impl.ChannelStoreUtils.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of solve-jvm Show documentation
Show all versions of solve-jvm Show documentation
Resolution-agnostic API for logic solvers
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
}
}