commonMain.it.unibo.tuprolog.solve.channel.InputChannel.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
import it.unibo.tuprolog.core.Struct
import it.unibo.tuprolog.solve.channel.impl.InputChannelFromFunction
import kotlin.js.JsName
import kotlin.jvm.JvmOverloads
import kotlin.jvm.JvmStatic
interface InputChannel : Channel {
companion object {
@JvmStatic
@JsName("stdIn")
fun stdIn(): InputChannel = stdin()
@JvmStatic
@JsName("ofWithAvailabilityChecker")
fun of(
generator: () -> X?,
availabilityChecker: () -> Boolean,
): InputChannel = InputChannelFromFunction(generator, availabilityChecker)
@JvmStatic
@JsName("of")
fun of(generator: () -> X?): InputChannel = InputChannelFromFunction(generator, { true })
@JvmStatic
@JsName("ofString")
fun of(string: String): InputChannel = stringInputChannel(string)
@JvmStatic
@JvmOverloads
@JsName("streamTerm")
fun streamTerm(id: String? = null): Struct = Channel.streamTerm(input = true, id)
}
@JsName("available")
val available: Boolean
@JsName("isOver")
val isOver: Boolean
@JsName("read")
fun read(): T?
@JsName("peek")
fun peek(): T?
@JsName("use")
fun use(function: InputChannel.() -> R): R = this.function().also { close() }
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy