net.dankito.utils.Size.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-utils Show documentation
Show all versions of java-utils Show documentation
Some basic utils needed in many projects
The 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()
}
}