diff options
Diffstat (limited to 'src/main/scala/reading/models/Program.scala')
-rw-r--r-- | src/main/scala/reading/models/Program.scala | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/scala/reading/models/Program.scala b/src/main/scala/reading/models/Program.scala index 4603b03..641f352 100644 --- a/src/main/scala/reading/models/Program.scala +++ b/src/main/scala/reading/models/Program.scala @@ -2,9 +2,13 @@ package reading.models import enumeratum._ -sealed trait Program extends EnumEntry { +sealed trait Program extends EnumEntry with Ordered[Program] { import Program._ + def compare(that: Program): Int = { + values.indexOf(that) - values.indexOf(this) + } + override def toString(): String = this match { case Monstre => "Le monstre, aux limites de l'humain" case RecitAventure => "Récits d'aventures" |