Skip to content

Instantly share code, notes, and snippets.

@Jire
Created September 25, 2016 05:39
Show Gist options
  • Save Jire/72159ac32778a25f86d8e42161ede08f to your computer and use it in GitHub Desktop.
Save Jire/72159ac32778a25f86d8e42161ede08f to your computer and use it in GitHub Desktop.
import it.unimi.dsi.fastutil.longs.Long2FloatArrayMap
import org.jire.strukt.Strukt
import kotlin.reflect.KProperty
class FloatMember(private val default: Float) : Member() {
private val current = Long2FloatArrayMap()
operator fun getValue(ref: Strukt, prop: KProperty<*>) = current[key]
operator fun setValue(ref: Strukt, prop: KProperty<*>, value: Float) {
current[key] = value
}
override fun default() {
current[key] = default
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment