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

net.dankito.utils.Size.kt Maven / Gradle / Ivy

There is a newer version: 1.0.20
Show newest version
package net.dankito.utils


data class Size(val width: Int, val height: Int) : Comparable {

    fun isSquare(): Boolean {
        return width == height
    }

    fun getDisplayText(): String {
        return "$width x $height"
    }


    override fun compareTo(other: Size): Int {
        if(width == other.width) {
            return height.compareTo(other.height)
        }

        return width.compareTo(other.width)
    }


    override fun toString(): String {
        return getDisplayText()
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy