This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pl.info.czerwinski.geom | |
class SquareMatrix(val size: Int, private val elements: (Int, Int) -> Float) { | |
operator fun get(row: Int, col: Int): Float { | |
require(row in 0..size - 1) { "Row ${row} out of bounds: 0..${size - 1}" } | |
require(col in 0..size - 1) { "Column ${col} out of bounds: 0..${size - 1}" } | |
return elements(row, col) | |
} |
NewerOlder