com.strumenta.kolasu.lionweb.BiMap.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kolasu-lionweb Show documentation
Show all versions of kolasu-lionweb Show documentation
Integration of Kolasu with LIonWeb
package com.strumenta.kolasu.lionweb
class BiMap {
val `as`: Set
get() = _asToBs.keys
val bs: Set
get() = _bsToAs.keys
val asToBsMap: Map
get() = _asToBs
val bsToAsMap: Map
get() = _bsToAs
private val _asToBs = mutableMapOf()
private val _bsToAs = mutableMapOf()
fun associate(a: A, b: B) {
_asToBs[a] = b
_bsToAs[b] = a
}
fun byA(a: A): B? = _asToBs[a]
fun byB(b: B): A? = _bsToAs[b]
fun containsA(a: A): Boolean = _asToBs.containsKey(a)
fun containsB(b: B): Boolean = _bsToAs.containsKey(b)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy