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

org.marid.fx.extensions.EnumExtensions.kt Maven / Gradle / Ivy

There is a newer version: 0.9.8.10
Show newest version
package org.marid.fx.extensions

import kotlin.math.max

inline val > E.progress: Double get() = ordinal.toDouble() / enumValues().size.toDouble()

inline fun > E.progress(subProgress: Double): Double {
  val step = 1.0 / enumValues().size.toDouble()
  val value = max(step * subProgress, step)
  return progress + value
}

inline fun , reified P : Enum

> E.progress(subItem: P): Double = progress(subItem.progress)





© 2015 - 2024 Weber Informatics LLC | Privacy Policy