Bimba.git

ref: 85f4ee806ced6e075630cfb0cb52cead4c4a0f25

app/src/main/java/ml/adamsprogs/bimba/Declinator.kt


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
package ml.adamsprogs.bimba

class Declinator {
    companion object {
        fun decline(number: Long): Int {
            when {
                number == 0L -> return R.string.now
                number % 10 == 0L -> return R.string.departure_in__plural_genitive
                number == 1L -> return R.string.departure_in__singular_genitive
                number in listOf<Long>(12,13,14) -> return R.string.departure_in__plural_genitive
                number % 10 in listOf<Long>(2, 3, 4) -> return R.string.departure_in__plural_nominative
                number % 10 in listOf<Long>(1,5,6,7,8,9) -> return R.string.departure_in__plural_genitive
                else -> return -1
            }
        }
    }
}