StorageUnit.kt 314 Bytes
Newer Older
1
package org.chronopolis.rest.models.enums
Michael Ritter's avatar
Michael Ritter committed
2

3
enum class StorageUnit(val power: Int) {
Michael Ritter's avatar
Michael Ritter committed
4 5 6 7 8
    B(0), KiB(1), MiB(2), GiB(3), TiB(4), PiB(5), OOB(-1);

    fun next() = when (this) {
        B -> KiB
        KiB -> MiB
9
        MiB -> GiB
Michael Ritter's avatar
Michael Ritter committed
10 11 12 13 14 15 16
        GiB -> TiB
        TiB -> PiB
        PiB -> OOB
        OOB -> OOB
    }

}