io.youi.Priority.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of youi-core_sjs0.6_2.13 Show documentation
Show all versions of youi-core_sjs0.6_2.13 Show documentation
Core functionality leveraged and shared by most other sub-projects of YouI.
The newest version!
package io.youi
object Priority {
val Fallback = Priority(0)
val Low = Priority(100)
val Normal = Priority(1000)
val High = Priority(10000)
val Critical = Priority(10000)
def byName(name: String): Option[Priority] = name.toLowerCase match {
case "fallback" => Some(Priority.Fallback)
case "low" => Some(Priority.Low)
case "normal" => Some(Priority.Normal)
case "high" => Some(Priority.High)
case "critical" => Some(Priority.Critical)
case _ => None
}
}
case class Priority(value: Int) extends Ordered[Priority] {
def lower: Priority = Priority(value - 1)
def higher: Priority = Priority(value + 1)
override def compare(that: Priority): Int = that.value.compareTo(value)
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy